Skip to content

Instantly share code, notes, and snippets.

@adamjcooper
Last active January 7, 2017 12:43
Show Gist options
  • Save adamjcooper/810b07a069bde5bd9364f8f79ee3c012 to your computer and use it in GitHub Desktop.
Save adamjcooper/810b07a069bde5bd9364f8f79ee3c012 to your computer and use it in GitHub Desktop.
Karabiner private.xml
<?xml version="1.0"?>
<root>
<appdef>
<appname>WEBSTORM</appname>
<equal>com.jetbrains.WebStorm</equal>
</appdef>
<appdef>
<appname>ONENOTE</appname>
<equal>com.microsoft.onenote.mac</equal>
</appdef>
<appdef>
<appname>SUBLIME</appname>
<equal>com.sublimetext.3</equal>
</appdef>
<appdef>
<appname>VSCODE</appname>
<equal>com.microsoft.VSCode</equal>
</appdef>
<appdef>
<appname>LOGOS</appname>
<equal>com.logos.Logos</equal>
</appdef>
<item>
<name>Adam's Custom Mappings</name>
<appendix>In addition to these mappings, I also use these standard mappings in the "For PC Users" section:</appendix>
<appendix>"Use PC Style Home/End"</appendix>
<appendix>"Use PC Style PageUp/PageDown"</appendix>
<item>
<name>Logos - Flip "Control"+L and "Control"+G to make navigation more like a browser</name>
<identifier>private.logos_browser_like_nav</identifier>
<only>LOGOS</only>
<autogen>__KeyToKey__ KeyCode::L, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, KeyCode::G, ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::G, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, KeyCode::L, ModifierFlag::COMMAND_L</autogen>
</item>
<item>
<name>Remap modifier keys to feel like Windows for most Mac programs (everything except Terminal, VM, Remote Desktop, and emacs).</name>
<identifier>private.modifier_keys_like_windows</identifier>
<not>TERMINAL, VIRTUALMACHINE, REMOTEDESKTOPCONNECTION, EMACS</not>
<!--
Keyboard Labels: Control Option Command
(Win Alt) (Win Ctrl)
Become: Command Control Option
(Win Ctrl) (Win Alt)
-->
<autogen>__KeyToKey__ KeyCode::CONTROL_L, KeyCode::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::CONTROL_L</autogen>
<autogen>__KeyToKey__ KeyCode::COMMAND_L, KeyCode::OPTION_L</autogen>
<autogen>__KeyToKey__ KeyCode::CONTROL_R, KeyCode::COMMAND_R</autogen>
<autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::CONTROL_R</autogen>
<autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::OPTION_R</autogen>
</item>
<item>
<name>Remap modifier keys for Terminal, RDC and VM.</name>
<identifier>private.modifier_keys_for_terminal_rdc_and_vm</identifier>
<only>TERMINAL, VIRTUALMACHINE, REMOTEDESKTOPCONNECTION</only>
<!--
Keyboard Labels: Control Option Command
(Win Alt) (Win Key)
Become: Control Command Option
(Win Key) (Win Alt)
-->
<autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::COMMAND_L, KeyCode::OPTION_L</autogen>
<autogen>__KeyToKey__ KeyCode::OPTION_R, KeyCode::COMMAND_R</autogen>
<autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::OPTION_R</autogen>
</item>
<item>
<name>Correct "Control" + left/right keys to jump by word instead of line (applied in all except Terminal, VMs, Remote Desktop, and WebStorm).</name>
<identifier>private.correct_keyboard_nav_left_right</identifier>
<not>TERMINAL, VIRTUALMACHINE, REMOTEDESKTOPCONNECTION, WEBSTORM, ONENOTE</not>
<!-- This makes "Control"+Left/Right move to the previous/next word. -->
<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_L</autogen>
</item>
<item>
<name>Correct "Control" + left/right keys to jump by word instead of line for Terminal</name>
<identifier>private.correct_keyboard_nav_left_right_for_terminal</identifier>
<only>TERMINAL</only>
<!-- This makes "Control"+Left/Right move to the previous/next word. -->
<autogen>__KeyToKey__ KeyCode::CURSOR_LEFT, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_CONTROL, KeyCode::CURSOR_LEFT, ModifierFlag::OPTION_L</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_RIGHT, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_CONTROL, KeyCode::CURSOR_RIGHT, ModifierFlag::OPTION_L</autogen>
</item>
<item>
<name>Paste in Terminal</name>
<identifier>private.paste_for_terminal</identifier>
<only>TERMINAL</only>
<autogen>__KeyToKey__ KeyCode::V, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_CONTROL, KeyCode::V, ModifierFlag::COMMAND_L</autogen>
</item>
<item>
<name>Prevent "Control" + up/down from jumping by paragraph in key applications.</name>
<identifier>private.correct_keyboard_nav_up_down</identifier>
<only>WORD, IWORK_PAGES, GOOGLE_CHROME, SAFARI, ONENOTE</only>
<!-- This makes "Control"+Up/Down behave just like plain up/down. -->
<autogen>__KeyToKey__ KeyCode::CURSOR_UP, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, KeyCode::CURSOR_UP, ModifierFlag::NONE</autogen>
<autogen>__KeyToKey__ KeyCode::CURSOR_DOWN, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_COMMAND, KeyCode::CURSOR_DOWN, ModifierFlag::NONE</autogen>
</item>
<item>
<name>Correct "Alt" + Tab.</name>
<identifier>private.correct_application_switching</identifier>
<not>VIRTUALMACHINE, REMOTEDESKTOPCONNECTION</not>
<!-- This makes "Alt" + Tab invoke Mac's Command-Tab function, which isn't the same as Windows, but serves a similar purpose. -->
<autogen>__KeyToKey__ KeyCode::TAB, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_OPTION, KeyCode::TAB, ModifierFlag::COMMAND_L</autogen>
</item>
<item>
<name>Fix Home/End in OneNote</name>
<identifier>private.fix_home_and_end_in_OneNote</identifier>
<only>ONENOTE</only>
<autogen>__KeyToKey__ KeyCode::HOME, ModifierFlag::NONE, KeyCode::CURSOR_LEFT, ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::END, ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L</autogen>
<!-- The addition of ModifierFlag::NONE on the left ensures that we do this when only shift is pressed. If Shift+"Control"+Home is pressed,
OneNote will highlight to the beginning of the document, which is the behavior I want. -->
<autogen>__KeyToKey__ KeyCode::HOME, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_LEFT, ModifierFlag::COMMAND_L | ModifierFlag::SHIFT_L</autogen>
<autogen>__KeyToKey__ KeyCode::END, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT | ModifierFlag::NONE, KeyCode::CURSOR_RIGHT, ModifierFlag::COMMAND_L | ModifierFlag::SHIFT_L</autogen>
</item>
<!--
Customize apps that should not have "PC Style" fixes applied.
-->
<replacementdef>
<!-- cf. https://github.com/tekezo/Karabiner/blob/master/src/core/server/Resources/replacementdef.xml#L239-L251 -->
<replacementname>PC_STYLE_BINDINGS_IGNORE_APPS</replacementname>
<replacementvalue>
<!-- fixes shift+home and shift+end in VSCODE -->
VSCODE,
<!-- original list as defined by Karabiner: https://github.com/tekezo/Karabiner/blob/master/src/core/server/Resources/replacementdef.xml#L239-L251 -->
CITRIX_XEN_APP_VIEWER,
EMACS,
REMOTEDESKTOPCONNECTION,
TEAMVIEWER,
TERMINAL,
VI,
VIRTUALMACHINE,
VNC,
Wine,
X11,
</replacementvalue>
</replacementdef>
<replacementdef>
<replacementname>PC_STYLE_BINDINGS_IGNORE_APPS_DESCRIPTION</replacementname>
<replacementvalue>
<!-- Update the UI description in Karabiner settings to note that VS Code is now also an exception -->
<!-- Original value: https://github.com/tekezo/Karabiner/blob/master/src/core/server/Resources/replacementdef.xml#L263 -->
(Except in VS Code, Virtual Machine, RDC, VNC, TeamViewer, EMACS, TERMINAL, X11, Citrix Viewer)
</replacementvalue>
</replacementdef>
</item>
</root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment