Karabiner

See https://pqrs.org/osx/karabiner/document.html.en and https://pqrs.org/osx/karabiner/xml.html.en for documentation. Key codes are listed in https://github.com/tekezo/karabiner/blob/master/src/bridge/generator/keycode/data/KeyCode.data.

You can add custom settings in ~/Library/Application Support/Karabiner/private.xml. Press the ReloadXML button or run /Applications/Karabiner.app/Contents/Library/bin/karabiner reloadxml to apply changes to private.xml.

/Applications/Karabiner.app/Contents/Applications/EventViewer.app shows information about pressed keys, devices, and input sources.

You can search in /Applications/Karabiner.app/Contents/Resources/**/*.xml to see where something is defined.

Examples

Change the right option key to the combintation of control, option, shift, and command:

<autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::OPTION_R, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>

Change the right command key to F19 when pressed and to an extra modifier key when held:

<autogen>__KeyOverlaidModifier__ KeyCode::COMMAND_R, KeyCode::VK_MODIFIER_EXTRA1, KeyCode::F19</autogen>

Change pointing device button 4 to page down:

<autogen>__KeyToKey__ PointingButton::BUTTON4, KeyCode::PAGEDOWN</autogen>

Make the volume keys change volume in smaller increments:

<autogen>__KeyToKey__ KeyCode::VK_CONSUMERKEY_VOLUME_DOWN, ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_VOLUME_DOWN, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L</autogen>
<autogen>__KeyToKey__ KeyCode::VK_CONSUMERKEY_VOLUME_UP, ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_VOLUME_UP, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L</autogen>

Map pressing the fn key twice to caps lock:

<autogen>__DoublePressModifier__ KeyCode::FN, KeyCode::FN, KeyCode::CAPS_LOCK</autogen>

Change the input mode to English when pressing escape in MacVim:

<only>VI</only>
<autogen>__KeyToKey__ KeyCode::ESCAPE, KeyCode::ESCAPE, KeyCode::VK_CHANGE_INPUTMODE_ENGLISH</autogen>

Map control-return to enter:

<autogen>__KeyToKey__ KeyCode::RETURN, VK_CONTROL | ModifierFlag::NONE, KeyCode::ENTER</autogen>

Scroll by moving the pointer while holding the secondary pointing device button:

<autogen>__PointingRelativeToScroll__ PointingButton::RIGHT</autogen>

Scroll by moving the pointer while holding fn:

<autogen>__PointingRelativeToScroll__ PointingButton::NONE, VK_FN</autogen>

Disable command-tab and shift-command-tab:

<autogen>__KeyToKey__ KeyCode::TAB, VK_COMMAND | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>
<autogen>__KeyToKey__ KeyCode::TAB, VK_COMMAND | VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_NONE</autogen>

Map holding X to Y:

<autogen>__HoldingKeyToKey__ KeyCode::X, KeyCode::X, KeyCode::VK_NONE, KeyCode::Y, Option::NOREPEAT</autogen>

Map pressing X and Y simultaneously to Z:

<autogen>__SimultaneousKeyPresses__ KeyCode::X, KeyCode::Y, KeyCode::Z</autogen>

Temporarily switch to the Russian input mode when holding F1:

<autogen>__KeyToKey__ KeyCode::F1, KeyCode::VK_NONE, Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::VK_CHANGE_INPUTMODE_RUSSIAN, Option::KEYTOKEY_AFTER_KEYUP, KeyCode::VK_CHANGE_INPUTMODE_ENGLISH</autogen>

Map control-shift-escape to display sleep:

<autogen>__KeyToKey__ KeyCode::ESCAPE, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_EJECT, ModifierFlag::CONTROL_L | ModifierFlag::SHIFT_L</autogen>

Map pressing the left shift while holding the left option to F19:

<autogen>__KeyOverlaidModifier__ KeyCode::SHIFT_L, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::NONE, KeyCode::SHIFT_L, ModifierFlag::OPTION_L, KeyCode::F19</autogen>

Map pressing the left and up arrow keys simultaneously while holding command to F19:

<autogen>__SimultaneousKeyPresses__ KeyCode::CURSOR_UP, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND | ModifierFlag::NONE, KeyCode::F19</autogen>

Map the right option key to a holdable caps lock:

<autogen>__KeyToKey__ KeyCode::OPTION_R, Option::KEYTOKEY_BEFORE_KEYDOWN, KeyCode::CAPSLOCK, Option::KEYTOKEY_AFTER_KEYUP, KeyCode::CAPSLOCK</autogen>

Map pressing the left and right pointing device buttons simultaneously to command-W:

<autogen>__SimultaneousKeyPresses__ PointingButton::LEFT, PointingButton::RIGHT, KeyCode::W, ModifierFlag::COMMAND_L</autogen>

Modifier keys

VK_COMMAND and MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND apply to both left and right command keys, but VK_COMMAND also applies to keys remapped to command.

This only changes option-B to option-left and does not affect for example option-command-B:

<autogen>__KeyToKey__ KeyCode::B, VK_OPTION | Modifierflag::NONE, KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L</autogen>

This also changes for example option-command-B to option-command-left:

<autogen>__KeyToKey__ KeyCode::B, VK_OPTION, KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L</autogen>

vkopenurldef

<vkopenurldef>
  <name>KeyCode::VK_OPEN_URL_SAFARI</name>
  <url>file:///Applications/Safari.app</url>
</vkopenurldef>
<vkopenurldef>
  <name>KeyCode::VK_OPEN_URL_PRIVATEXML</name>
  <url>file:///{{ENV_HOME}}/Library/Application%20Support/Karabiner/private.xml</url>
</vkopenurldef>
<vkopenurldef>
  <name>KeyCode::VK_OPEN_URL_GOOGLE</name>
  <url>https://www.google.com/</url>
</vkopenurldef>
<item>
  <name>custom</name>
  <identifier>custom</identifier>
  <autogen>__KeyToKey__ KeyCode::F11 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SAFARI</autogen>
  <autogen>__KeyToKey__ KeyCode::P, ModifierFlag::OPTION_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_PRIVATEXML</autogen>
  <autogen>__KeyToKey__ KeyCode::G, ModifierFlag::OPTION_R | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_GOOGLE</autogen>
</item>

Making short presses of modifier keys open applications

<vkopenurldef>
  <name>KeyCode::VK_OPEN_URL_EMACS</name>
  <url>file:///Applications/Emacs.app</url>
</vkopenurldef>
<vkopenurldef>
  <name>KeyCode::VK_OPEN_URL_ITERM</name>
  <url>file:///Applications/iTerm.app</url>
</vkopenurldef>
<item>
  <name>custom</name>
  <identifier>custom</identifier>
  <autogen>__KeyOverlaidModifier__ KeyCode::COMMAND_L, KeyCode::COMMAND_L, KeyCode::VK_OPEN_URL_EMACS</autogen>
  <autogen>__KeyOverlaidModifier__ KeyCode::COMMAND_R, KeyCode::COMMAND_R, KeyCode::VK_OPEN_URL_ITERM</autogen>
</item>

If you trigger the short presses of keys accidentally, try to reduce the timeout for KeyOverlaidModifier from 1000 ms to something like 200 ms. The delay is higher than the delay until key repeat by default, but you can reduce the delay if you do not need key repeat for keys with a KeyOverlaidModifier autogen.

Running a shell script

<vkopenurldef>
  <name>KeyCode::VK_OPEN_URL_SHELL_display_sleep</name>
  <url type="shell">pmset displaysleepnow</url>
</vkopenurldef>
<item>
  <name>custom</name>
  <identifier>custom</identifier>
  <autogen>__KeyToKey__ KeyCode::ESCAPE, VK_CONTROL | VK_SHIFT, KeyCode::VK_OPEN_URL_SHELL_display_sleep</autogen>
</item>

Toggling settings

<item>
  <name>custom</name>
  <identifier>custom</identifier>
  <autogen>__KeyToKey__ KeyCode::ESCAPE, ModifierFlag::FN | ModifierFlag::NONE, KeyCode::VK_CONFIG_TOGGLE_swapbuttons</autogen>
</item>
<item>
  <name>swapbuttons</name>
  <identifier vk_config="true">swapbuttons</identifier>
  <autogen>__PointingButtonToPointingButton__ PointingButton::LEFT, PointingButton::RIGHT</autogen>
  <autogen>__PointingButtonToPointingButton__ PointingButton::RIGHT, PointingButton::LEFT</autogen>
</item>

Input sources

<inputsourcedef>
  <name>KOTOERI</name>
  <inputsourceid_prefix>com.apple.inputmethod.Kotoeri.</inputsourceid_prefix>
</inputsourcedef>
<item>
  <name>custom</name>
  <identifier>custom</identifier>
  <inputmode_only>KOTOERI</inputmode_only>
  <autogen>__KeyToKey__ KeyCode::A, KeyCode::B</autogen>
</item>
<vkchangeinputsourcedef>
  <name>KeyCode::VK_CHANGE_INPUTSOURCE_HIRAGANA</name>
  <inputsourceid_equal>com.apple.inputmethod.Kotoeri.Japanese</inputsourceid_equal>
</vkchangeinputsourcedef>
<item>
  <name>test2</name>
  <identifier>test2</identifier>
  <autogen>__KeyToKey__ KeyCode::E, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_ENGLISH</autogen>
  <autogen>__KeyToKey__ KeyCode::H, VK_OPTION | ModifierFlag::NONE, KeyCode::VK_CHANGE_INPUTSOURCE_HIRAGANA</autogen>
</item>

The predefined names for input sources are listed in https://github.com/tekezo/Karabiner/blob/master/src/core/server/Resources/inputsourcedef.xml.

Device-specific settings

<devicevendordef>
  <vendorname>KINESIS</vendorname>
  <vendorid>0x05f3</vendorid>
</devicevendordef>
<deviceproductdef>
  <productname>ADVANTAGE</productname>
  <productid>0x0007</productid>
</deviceproductdef>
<item>
  <name>custom</name>
  <identifier>custom</identifier>
  <device_only>DeviceVendor::KINESIS, DeviceProduct::ADVANTAGE</device_only>
  <autogen>__KeyToKey__ KeyCode::X, KeyCode::Y</autogen>
</item>

You can see the vendor and product IDs from EventViewer or by running ioreg -rn IOHIDKeyboard.

Flipping F-keys

<item>
  <name>fkeys</name>
  <identifier>fkeys</identifier>
  <autogen>__KeyToKey__ ConsumerKeyCode::BRIGHTNESS_DOWN, KeyCode::F1</autogen>
  <autogen>__KeyToKey__ ConsumerKeyCode::BRIGHTNESS_UP, KeyCode::F2</autogen>
  <autogen>__KeyToKey__ KeyCode::EXPOSE_ALL, KeyCode::F3</autogen>
  <autogen>__KeyToKey__ KeyCode::LAUNCHPAD, KeyCode::F4</autogen>
  <autogen>__KeyToKey__ ConsumerKeyCode::KEYBOARDLIGHT_LOW, KeyCode::F5</autogen>
  <autogen>__KeyToKey__ ConsumerKeyCode::KEYBOARDLIGHT_HIGH, KeyCode::F6</autogen>
  <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_PREV, KeyCode::F7</autogen>
  <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_PLAY, KeyCode::F8</autogen>
  <autogen>__KeyToKey__ ConsumerKeyCode::MUSIC_NEXT, KeyCode::F9</autogen>
  <autogen>__KeyToKey__ ConsumerKeyCode::VOLUME_MUTE, KeyCode::F10</autogen>
  <autogen>__KeyToKey__ ConsumerKeyCode::VOLUME_DOWN, KeyCode::F11</autogen>
  <autogen>__KeyToKey__ ConsumerKeyCode::VOLUME_UP, KeyCode::F12</autogen>
  <autogen>__KeyToKey__ KeyCode::F1, ConsumerKeyCode::BRIGHTNESS_DOWN</autogen>
  <autogen>__KeyToKey__ KeyCode::F2, ConsumerKeyCode::BRIGHTNESS_UP</autogen>
  <autogen>__KeyToKey__ KeyCode::F3, KeyCode::EXPOSE_ALL</autogen>
  <autogen>__KeyToKey__ KeyCode::F4, KeyCode::LAUNCHPAD</autogen>
  <autogen>__KeyToKey__ KeyCode::F5, ConsumerKeyCode::KEYBOARDLIGHT_LOW</autogen>
  <autogen>__KeyToKey__ KeyCode::F6, ConsumerKeyCode::KEYBOARDLIGHT_HIGH</autogen>
  <autogen>__KeyToKey__ KeyCode::F7, ConsumerKeyCode::MUSIC_PREV</autogen>
  <autogen>__KeyToKey__ KeyCode::F8, ConsumerKeyCode::MUSIC_PLAY</autogen>
  <autogen>__KeyToKey__ KeyCode::F9, ConsumerKeyCode::MUSIC_NEXT</autogen>
  <autogen>__KeyToKey__ KeyCode::F10, ConsumerKeyCode::VOLUME_MUTE</autogen>
  <autogen>__KeyToKey__ KeyCode::F11, ConsumerKeyCode::VOLUME_DOWN</autogen>
  <autogen>__KeyToKey__ KeyCode::F12, ConsumerKeyCode::VOLUME_UP</autogen>
</item>

Adding Emacs word and character navigation keybindings

<?xml version="1.0"?>
<root>
  <appdef>
    <appname>EMACSMODEIGNORE</appname>
    <equal>org.gnu.Emacs</equal>
    <equal>com.apple.Terminal</equal>
    <equal>com.googlecode.iterm2</equal>
    <equal>com.vmware.fusion</equal>
    <prefix>com.vmware.proxyApp.</prefix>
  </appdef>
  <item>
    <name>emacs</name>
    <identifier>emacs</identifier>
    <not>EMACSMODEIGNORE</not>
    <autogen>__KeyToKey__ KeyCode::P, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::N, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::B, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_LEFT</autogen>
    <autogen>__KeyToKey__ KeyCode::F, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT</autogen>
    <autogen>__KeyToKey__ KeyCode::P, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_UP, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::N, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_DOWN, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::B, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::F, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::B, VK_OPTION | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, VK_OPTION</autogen>
    <autogen>__KeyToKey__ KeyCode::F, VK_OPTION | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, VK_OPTION</autogen>
    <autogen>__KeyToKey__ KeyCode::B, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, VK_OPTION | VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::F, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, VK_OPTION | VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::D, VK_OPTION | ModifierFlag::NONE, KeyCode::FORWARD_DELETE, VK_OPTION</autogen>
  </item>
</root>

https://github.com/tekezo/Karabiner/blob/master/src/core/server/Resources/include/checkbox/emacs_mode.xml includes some more settings.

My private.xml

I use a keyboard which has 12 keys under the thumbs. I have remapped all of the keys under the thumbs, and I use three of them as extra modifier keys. My keyboard layout is Colemak, so for example KeyCode::S is actually the R key.

<?xml version="1.0"?>
<root>
  <devicevendordef>
    <vendorname>KINESIS</vendorname>
    <vendorid>0x05f3</vendorid>
  </devicevendordef>
  <deviceproductdef>
    <productname>ADVANTAGE</productname>
    <productid>0x0007</productid>
  </deviceproductdef>

  <vkopenurldef><name>KeyCode::VK_OPEN_URL_ACTIVITYMONITOR</name><url>file:///Applications/Utilities/Activity%20Monitor.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SCRIPTEDITOR</name><url>file:///Applications/Utilities/Script%20Editor.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_APPSTORE</name><url>file:///Applications/App%20Store.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_EMACS</name><url>file:///usr/local/opt/emacs/Emacs.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_FINDER</name><url>file:///System/Library/CoreServices/Finder.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_GOOGLECHROME</name><url>file:///Applications/Google%20Chrome.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_ITERM</name><url>file:///Applications/iTerm.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_ITUNES</name><url>file:///Applications/iTunes.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_MAIL</name><url>file:///Applications/Mail.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_MOVIST</name><url>file:///Applications/Movist.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_PAGES</name><url>file:///Applications/Pages.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_PREVIEW</name><url>file:///Applications/Preview.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SAFARI</name><url>file:///Applications/Safari.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SEQUENTIAL</name><url>file:///Applications/Sequential.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SKIM</name><url>file:///Applications/Skim.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SYSTEMPREFERENCES</name><url>file:///Applications/System%20Preferences.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_TEXTEDIT</name><url>file:///Applications/TextEdit.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_TRANSMISSION</name><url>file:///Applications/Transmission.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_TWEETBOT</name><url>file:///Applications/Tweetbot.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_VMWAREFUSION</name><url>file:///Applications/VMware%20Fusion.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_WRITEROOM</name><url>file:///Applications/WriteRoom.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_LIVE</name><url>file:///Applications/Ableton%20Live%209%20Suite.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_VLC</name><url>file:///Applications/VLC.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SPOTIFY</name><url>file:///Applications/Spotify.app</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_IBOOKS</name><url>file:///Applications/iBooks.app</url></vkopenurldef>

  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_APPLESCRIPT</name><url type="shell">/usr/local/bin/emacsclient -n ~/dir/osx/applescript.md</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_BASHRC</name><url type="shell">/usr/local/bin/emacsclient -n ~/.bashrc</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_BLOGSPOT</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/blogspot</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_BUFFER</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/buffer</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_COPIED</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/copied</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_DOTEMACS</name><url type="shell">/usr/local/bin/emacsclient -n ~/.emacs</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_TOREAD</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/toread</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_EMACS</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/emacsbasic</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_JS</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/js</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_N</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/n</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_NOTES</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/notes</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_OSX</name><url type="shell">/usr/local/bin/emacsclient -n ~/Sites/me/osx.txt</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_PRIVATEXML</name><url type="shell">/usr/local/bin/emacsclient -n ~/Library/Application\ Support/Karabiner/private.xml</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_Q</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/q</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_READINGLIST</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/readinglist</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_RUBY</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/ruby</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_S1</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/s1</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_SHELL</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/shell</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_SHELLALT</name><url type="shell">/usr/local/bin/emacsclient -n ~/Sites/me/shellalt.txt</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_SHELLNOTES</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/shellnotes</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_STUDY</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/study</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_TODO</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/todo</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_TWEETS</name><url type="shell">open ~/Downloads/tweets -e</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_TWEETS2</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/tweets</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_P</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/p</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_SHELL1</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/shell1</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_HY</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/hy</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_SHELL_JAVA</name><url type="shell">/usr/local/bin/emacsclient -n ~/notes/java</url></vkopenurldef>

  <vkopenurldef><name>KeyCode::VK_OPEN_URL_TEMPLATE</name><url>file://{{ENV_HOME}}/Documents/audio/template%20Project/template.als</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_VM1</name><url>file://{{ENV_HOME}}/Documents/vm/Mavericks.vmwarevm</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_VM2</name><url>file://{{ENV_HOME}}/Documents/vm/Mountain%20Lion.vmwarevm</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_VM3</name><url>file://{{ENV_HOME}}/Documents/vm/Lion.vmwarevm</url></vkopenurldef>
  <vkopenurldef><name>KeyCode::VK_OPEN_URL_VM4</name><url>file://{{ENV_HOME}}/Documents/vm/Ubuntu.vmwarevm</url></vkopenurldef>

  <item>
    <name>custom</name>
    <identifier>custom</identifier>
    <autogen>__KeyToKey__ KeyCode::V, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_VLC</autogen>
    <autogen>__KeyToKey__ KeyCode::HOME, ModifierFlag::EXTRA1, KeyCode::VK_OPEN_URL_TEXTEDIT</autogen>
    <autogen>__KeyToKey__ KeyCode::DELETE, ModifierFlag::EXTRA1, KeyCode::VK_OPEN_URL_MAIL</autogen>
    <autogen>__KeyToKey__ KeyCode::FORWARD_DELETE, ModifierFlag::EXTRA1, KeyCode::VK_OPEN_URL_SKIM</autogen>
    <autogen>__KeyToKey__ KeyCode::END, ModifierFlag::EXTRA1, KeyCode::VK_OPEN_URL_PREVIEW</autogen>
    <autogen>__KeyToKey__ KeyCode::A, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_APPSTORE</autogen>
    <autogen>__KeyToKey__ KeyCode::F, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_TRANSMISSION</autogen>
    <autogen>__KeyToKey__ KeyCode::M, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_MOVIST</autogen>
    <autogen>__KeyToKey__ KeyCode::O, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_ACTIVITYMONITOR</autogen>
    <autogen>__KeyToKey__ KeyCode::Q, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SCRIPTEDITOR</autogen>
    <autogen>__KeyToKey__ KeyCode::R, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_PAGES</autogen>
    <autogen>__KeyToKey__ KeyCode::X, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_GOOGLECHROME</autogen>
    <autogen>__KeyToKey__ KeyCode::Z, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SEQUENTIAL</autogen>
    <autogen>__KeyToKey__ KeyCode::W, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_WRITEROOM</autogen>
    <autogen>__KeyToKey__ KeyCode::COMMA, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SYSTEMPREFERENCES</autogen>
    <autogen>__KeyToKey__ KeyCode::SLASH, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_ITUNES</autogen>
    <autogen>__KeyToKey__ KeyCode::U, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_LIVE</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_3, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SPOTIFY</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_4, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_IBOOKS</autogen>

    <autogen>__KeyToKey__ KeyCode::DELETE, ModifierFlag::EXTRA2, KeyCode::VK_OPEN_URL_SHELL_BUFFER</autogen>
    <autogen>__KeyToKey__ KeyCode::FORWARD_DELETE, ModifierFlag::EXTRA2, KeyCode::VK_OPEN_URL_SHELL_TODO</autogen>
    <autogen>__KeyToKey__ KeyCode::HOME, ModifierFlag::EXTRA2, KeyCode::VK_OPEN_URL_SHELL_TWEETS2</autogen>
    <autogen>__KeyToKey__ KeyCode::END, ModifierFlag::EXTRA2, KeyCode::VK_OPEN_URL_SHELL_P</autogen>
    <autogen>__KeyToKey__ KeyCode::A, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_APPLESCRIPT</autogen>
    <autogen>__KeyToKey__ KeyCode::B, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_BLOGSPOT</autogen>
    <autogen>__KeyToKey__ KeyCode::H, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_HY</autogen>
    <autogen>__KeyToKey__ KeyCode::C, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_COPIED</autogen>
    <autogen>__KeyToKey__ KeyCode::D, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_SHELL</autogen>
    <autogen>__KeyToKey__ KeyCode::F, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_TWEETS</autogen>
    <autogen>__KeyToKey__ KeyCode::G, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_TOREAD</autogen>
    <autogen>__KeyToKey__ KeyCode::J, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_N</autogen>
    <autogen>__KeyToKey__ KeyCode::O, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_STUDY</autogen>
    <autogen>__KeyToKey__ KeyCode::Q, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_Q</autogen>
    <autogen>__KeyToKey__ KeyCode::R, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_PRIVATEXML</autogen>
    <autogen>__KeyToKey__ KeyCode::K, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_EMACS</autogen>
    <autogen>__KeyToKey__ KeyCode::S, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_RUBY</autogen>
    <autogen>__KeyToKey__ KeyCode::U, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_SHELLALT</autogen>
    <autogen>__KeyToKey__ KeyCode::X, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_OSX</autogen>
    <autogen>__KeyToKey__ KeyCode::Y, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_JS</autogen>
    <autogen>__KeyToKey__ KeyCode::BRACKET_LEFT, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_SHELLNOTES</autogen>
    <autogen>__KeyToKey__ KeyCode::BRACKET_RIGHT, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_S1</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_1, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_VM1</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_2, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_VM2</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_3, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_VM3</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_4, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_VM4</autogen>
    <autogen>__KeyToKey__ KeyCode::DOT, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_DOTEMACS</autogen>
    <autogen>__KeyToKey__ KeyCode::COMMA, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_BASHRC</autogen>
    <autogen>__KeyToKey__ KeyCode::CURSOR_DOWN, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_READINGLIST</autogen>
    <autogen>__KeyToKey__ KeyCode::CURSOR_UP, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_SHELL1</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_6, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_SHELL_JAVA</autogen>
    <autogen>__KeyToKey__ KeyCode::F, ModifierFlag::EXTRA2 | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_TEMPLATE</autogen>

    <autogen>__KeyToKey__ KeyCode::KEY_1, ModifierFlag::EXTRA1, KeyCode::VK_CONSUMERKEY_BRIGHTNESS_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_2, ModifierFlag::EXTRA1, KeyCode::VK_CONSUMERKEY_BRIGHTNESS_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_6, ModifierFlag::EXTRA1, KeyCode::VK_CONSUMERKEY_MUSIC_PREV</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_7, ModifierFlag::EXTRA1, KeyCode::VK_CONSUMERKEY_MUSIC_PLAY</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_8, ModifierFlag::EXTRA1, KeyCode::VK_CONSUMERKEY_MUSIC_NEXT</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_9, ModifierFlag::EXTRA1, KeyCode::VK_CONSUMERKEY_VOLUME_DOWN, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_0, ModifierFlag::EXTRA1, KeyCode::VK_CONSUMERKEY_VOLUME_UP, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L</autogen>

    <autogen>__KeyOverlaidModifier__ KeyCode::PAGEUP, KeyCode::CONTROL_L, KeyCode::VK_OPEN_URL_ITERM</autogen>
    <autogen>__KeyOverlaidModifier__ KeyCode::PAGEDOWN, KeyCode::OPTION_L, KeyCode::VK_OPEN_URL_EMACS</autogen>
    <autogen>__KeyOverlaidModifier__ KeyCode::SPACE, KeyCode::SHIFT_L, KeyCode::VK_OPEN_URL_SHELL_NOTES</autogen>
    <autogen>__KeyOverlaidModifier__ KeyCode::RETURN, KeyCode::COMMAND_L, KeyCode::VK_OPEN_URL_SAFARI</autogen>
    <autogen>__KeyOverlaidModifier__ KeyCode::CONTROL_R, KeyCode::VK_MODIFIER_EXTRA1, KeyCode::F19, ModifierFlag::COMMAND_L</autogen>

    <autogen>__KeyOverlaidModifier__ KeyCode::OPTION_R, KeyCode::VK_MODIFIER_EXTRA2, KeyCode::F18, ModifierFlag::COMMAND_L</autogen>

    <autogen>__KeyToKey__ KeyCode::J, ModifierFlag::EXTRA1, KeyCode::HOME</autogen>
    <autogen>__KeyToKey__ KeyCode::K, ModifierFlag::EXTRA1, KeyCode::PAGEUP</autogen>
    <autogen>__KeyToKey__ KeyCode::L, ModifierFlag::EXTRA1, KeyCode::PAGEDOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::SEMICOLON, ModifierFlag::EXTRA1, KeyCode::END</autogen>

    <autogen>__KeyToKey__ KeyCode::G, ModifierFlag::EXTRA1 | ModifierFlag::EXTRA2, KeyCode::VK_CONSUMERKEY_EJECT, ModifierFlag::CONTROL_L | ModifierFlag::SHIFT_L</autogen>
    <autogen>__KeyToKey__ KeyCode::D, ModifierFlag::EXTRA1 | ModifierFlag::EXTRA2, KeyCode::VK_CONSUMERKEY_EJECT, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::S, ModifierFlag::EXTRA1 | ModifierFlag::EXTRA2, KeyCode::VK_CONSUMERKEY_EJECT, ModifierFlag::CONTROL_L | ModifierFlag::COMMAND_L</autogen>

    <autogen>__KeyToKey__ KeyCode::DELETE, ModifierFlag::EXTRA1 | ModifierFlag::NONE, KeyCode::ENTER</autogen>

    <autogen>__KeyToKey__ KeyCode::SHIFT_R, VK_SHIFT | ModifierFlag::NONE, KeyCode::VK_OPEN_URL_FINDER</autogen>
    <autogen>__KeyToKey__ KeyCode::SHIFT_R, VK_COMMAND, KeyCode::F17, ModifierFlag::SHIFT_L</autogen>

    <autogen>__KeyToKey__ KeyCode::MINUS, ModifierFlag::EXTRA1, KeyCode::VK_LOCK_EXTRA1</autogen>

    <autogen>__KeyToKey__ KeyCode::MINUS, ModifierFlag::NONE, KeyCode::BACKQUOTE, ModifierFlag::COMMAND_L</autogen>

    <autogen>__KeyToKey__ PointingButton::BUTTON4, KeyCode::PAGEDOWN</autogen>
    <autogen>__SimultaneousKeyPresses__ PointingButton::LEFT, PointingButton::RIGHT, KeyCode::L, ModifierFlag::COMMAND_L</autogen>
    <autogen>__SimultaneousKeyPresses__ PointingButton::BUTTON4, PointingButton::BUTTON5, KeyCode::W, ModifierFlag::COMMAND_L</autogen>

    <autogen>__KeyToKey__ KeyCode::F1, ModifierFlag::EXTRA1, KeyCode::F1, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::F2, ModifierFlag::EXTRA1, KeyCode::F2, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::F3, ModifierFlag::EXTRA1, KeyCode::F3, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::F4, ModifierFlag::EXTRA1, KeyCode::F4, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::CONTROL_L, KeyCode::F16, ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::ESCAPE, KeyCode::F17, ModifierFlag::CONTROL_L</autogen>
    <autogen>__KeyToKey__ KeyCode::E, ModifierFlag::EXTRA1, KeyCode::F13, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_3, ModifierFlag::EXTRA1, KeyCode::F13, ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_4, ModifierFlag::EXTRA1, KeyCode::F14, ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::KEY_5, ModifierFlag::EXTRA1, KeyCode::F15, ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::UK_SECTION, ModifierFlag::EXTRA1, KeyCode::F17, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, ModifierFlag::EXTRA1, KeyCode::F18, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, ModifierFlag::EXTRA1, KeyCode::F19, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::BACKQUOTE, ModifierFlag::EXTRA1, KeyCode::F16, ModifierFlag::OPTION_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::BACKQUOTE, ModifierFlag::EXTRA2, KeyCode::F16, ModifierFlag::CONTROL_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::UK_SECTION, ModifierFlag::EXTRA2, KeyCode::F17, ModifierFlag::CONTROL_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, ModifierFlag::EXTRA2, KeyCode::F18, ModifierFlag::CONTROL_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, ModifierFlag::EXTRA2, KeyCode::F19, ModifierFlag::CONTROL_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::END, ModifierFlag::EXTRA1, KeyCode::F19, ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::HOME, ModifierFlag::EXTRA1, KeyCode::F18, ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::EQUAL, ModifierFlag::EXTRA1, KeyCode::F14, ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::DELETE, ModifierFlag::EXTRA1, KeyCode::F17, ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::FORWARD_DELETE, ModifierFlag::EXTRA1, KeyCode::F16, ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::OPTION_L, ModifierFlag::EXTRA1, KeyCode::F15, ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::CONTROL_L, ModifierFlag::EXTRA2, KeyCode::F14, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::END, ModifierFlag::EXTRA2, KeyCode::F19, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::HOME, ModifierFlag::EXTRA2, KeyCode::F18, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::DELETE, ModifierFlag::EXTRA2, KeyCode::F17, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::FORWARD_DELETE, ModifierFlag::EXTRA2, KeyCode::F16, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::OPTION_L, ModifierFlag::EXTRA2, KeyCode::F15, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::CONTROL_L, ModifierFlag::EXTRA2, KeyCode::F14, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::N, ModifierFlag::EXTRA1, KeyCode::F13, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::D, ModifierFlag::EXTRA1, KeyCode::F13, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L</autogen>
    <autogen>__KeyToKey__ KeyCode::G, ModifierFlag::EXTRA1, KeyCode::F14, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L</autogen>
    <autogen>__KeyToKey__ KeyCode::TAB, ModifierFlag::NONE, KeyCode::F15, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L</autogen>

    <autogen>__KeyToKey__ KeyCode::CURSOR_UP, KeyCode::MINUS</autogen>
    <autogen>__KeyToKey__ KeyCode::CURSOR_DOWN, KeyCode::EQUAL</autogen>
    <autogen>__KeyToKey__ KeyCode::BACKQUOTE, KeyCode::CURSOR_LEFT</autogen>
    <autogen>__KeyToKey__ KeyCode::UK_SECTION, KeyCode::CURSOR_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, KeyCode::CURSOR_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::ESCAPE</autogen>
    <autogen>__KeyToKey__ KeyCode::END, KeyCode::DELETE</autogen>
    <autogen>__KeyToKey__ KeyCode::FORWARD_DELETE, KeyCode::SPACE</autogen>
    <autogen>__KeyToKey__ KeyCode::DELETE, KeyCode::RETURN</autogen>
    <autogen>__KeyToKey__ KeyCode::EQUAL, KeyCode::BACKQUOTE</autogen>
  </item>

  <appdef>
    <appname>EMACSAPP</appname>
    <equal>org.gnu.Emacs</equal>
  </appdef>

  <item>
    <identifier>emacs</identifier>
    <name>emacs</name>
    <only>EMACSAPP</only>
    <autogen>__KeyToKey__ KeyCode::HOME, KeyCode::CONTROL_R</autogen>
  </item>

  <item>
    <identifier>notemacs</identifier>
    <name>notemacs</name>
    <not>EMACSAPP</not>
    <autogen>__KeyToKey__ KeyCode::HOME, ModifierFlag::NONE, KeyCode::CONTROL_L, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
    <autogen>__KeyToKey__ KeyCode::M, VK_COMMAND | ModifierFlag::NONE, KeyCode::M, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L | ModifierFlag::COMMAND_L</autogen>
  </item>

  <item>
    <identifier>emacsmode</identifier>
    <name>emacsmode</name>
    <not>EMACSAPP</not>
    <not>TERMINAL</not>
    <autogen>__KeyToKey__ KeyCode::R, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::J, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::B, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_LEFT</autogen>
    <autogen>__KeyToKey__ KeyCode::E, VK_CONTROL | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT</autogen>
    <autogen>__KeyToKey__ KeyCode::R, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_UP, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::J, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_DOWN, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::B, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::E, VK_CONTROL | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::B, VK_OPTION | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, VK_OPTION</autogen>
    <autogen>__KeyToKey__ KeyCode::E, VK_OPTION | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, VK_OPTION</autogen>
    <autogen>__KeyToKey__ KeyCode::B, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, VK_OPTION | VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::E, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, VK_OPTION | VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::R, VK_OPTION | ModifierFlag::NONE, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::J, VK_OPTION | ModifierFlag::NONE, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::R, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_UP, VK_SHIFT, KeyCode::CURSOR_UP, VK_SHIFT, KeyCode::CURSOR_UP, VK_SHIFT, KeyCode::CURSOR_UP, VK_SHIFT, KeyCode::CURSOR_UP, VK_SHIFT, KeyCode::CURSOR_UP, VK_SHIFT, KeyCode::CURSOR_UP, VK_SHIFT, KeyCode::CURSOR_UP, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::J, VK_OPTION | VK_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_DOWN, VK_SHIFT, KeyCode::CURSOR_DOWN, VK_SHIFT, KeyCode::CURSOR_DOWN, VK_SHIFT, KeyCode::CURSOR_DOWN, VK_SHIFT, KeyCode::CURSOR_DOWN, VK_SHIFT, KeyCode::CURSOR_DOWN, VK_SHIFT, KeyCode::CURSOR_DOWN, VK_SHIFT, KeyCode::CURSOR_DOWN, VK_SHIFT</autogen>
    <autogen>__KeyToKey__ KeyCode::L, VK_CONTROL | ModifierFlag::NONE, KeyCode::TAB</autogen>
    <autogen>__KeyToKey__ KeyCode::G, VK_OPTION | ModifierFlag::NONE, KeyCode::FORWARD_DELETE, VK_OPTION</autogen>

    <autogen>__KeyToKey__ KeyCode::P, ModifierFlag::FN, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP, KeyCode::CURSOR_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::N, ModifierFlag::FN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN, KeyCode::CURSOR_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::B, ModifierFlag::FN, KeyCode::CURSOR_LEFT, KeyCode::CURSOR_LEFT, KeyCode::CURSOR_LEFT, KeyCode::CURSOR_LEFT, KeyCode::CURSOR_LEFT, KeyCode::CURSOR_LEFT, KeyCode::CURSOR_LEFT, KeyCode::CURSOR_LEFT</autogen>
    <autogen>__KeyToKey__ KeyCode::F, ModifierFlag::FN, KeyCode::CURSOR_RIGHT, KeyCode::CURSOR_RIGHT, KeyCode::CURSOR_RIGHT, KeyCode::CURSOR_RIGHT, KeyCode::CURSOR_RIGHT, KeyCode::CURSOR_RIGHT, KeyCode::CURSOR_RIGHT, KeyCode::CURSOR_RIGHT</autogen>
  </item>
</root>

Notes

__KeyToConsumer__, __ConsumerToKey__, __ConsumerToConsumer__, __KeyToPointingButton__, __PointingButtonToKey__, and __PointingButtonToPointingButton__ can be replaced with __KeyToKey__ starting from 9.3.0.

Option::NOREPEAT disables repeating a key.

You can add delays with KeyCode::VK_WAIT_10MS and KeyCode::VK_WAIT_100MS.

KeyCode::VK_IOHIDPOSTEVENT_NX_POWER_KEY or ConsumerKeyCode::POWER is the power key or button.

You can disable remapping pointing devices by enabling the "Don't remap any pointing devices" setting.

KeyCode::RawValue::0x81 is key code 129.

For example fn-J is mapped to numpad 1 by default unless you enable the "Disable NumPad Hack" setting.

The "Pass-Through Caps Lock LED Status" setting disables the caps lock light on some keyboards.

/Applications/Karabiner.app/Contents/Library/utilities/bin/warp-mouse-cursor-position front_window middle 0 center 0 moves the pointer to the center of the frontmost window.