Jul 232015

Apparently low-level keybindings in OS X used to be managed through


which did not exist on this 10.10.4 system. So after having created it and added

/* Context Menu */
"\U0x3fc" = "rightMouseDown:"; /* Fun-C */
"^;" = "rightMouseDown:"; /* Ctrl-; */

/* Vim movement while Ctrl key down */
"^h" = ("moveLeft:");
"^j" = ("moveDown:");
"^k" = ("moveUp:");
"^l" = ("moveRight:");


it did, of course, not work.

Googling around a bit, I found Karabiner (a powerful and stable keyboard customizer for OS X), and this seems to be able to do the trick perfectly. So, editing ~/Library/Application Support/Karabiner/private.xmlto include:

<?xml version="1.0"?>
            <name>VIM HJKL</name>
                KeyCode::H, ModifierFlag::FN,
                KeyCode::J, ModifierFlag::FN,
                KeyCode::K, ModifierFlag::FN,
                KeyCode::L, ModifierFlag::FN,
        <name>kybd control click</name>
            KeyCode::C, ModifierFlag::FN,

I have two very simple sets of keybindings available to me under Karibiner. Fn+H thru L gives me VIM movement _in any app_, and Fn+c gives me access to contextual menus without the effort of right/control clicking and visual item in OS X.

Karabiner key code data is at https://github.com/tekezo/Karabiner/blob/master/src/bridge/generator/keycode/data/KeyCode.data

OS X keycodes can be gotten fromevents.h,, thus:

$ grep '^ *kVK' /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h|tr -d ,|while read x y z;do printf '%d %s %s\n' $z $z ${x#kVK_};done|sort -n

lists them all:

Lovely jubly!

  One Response to “Customised OS X Keybindings…. with Karabiner”

  1. It seems that perhaps ~/Library/KeyBindings/DefaultKeyBinding.dict works on some hardware and not others?

    I’ve been using some custom bindings for years, but cannot get them (or any bindings) to work on my Retina Macbook Pro, although it still works on my Hackintosh. Both are running OSX 10.10.5 currently.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Social Widgets powered by AB-WebLog.com.