Tuesday, Sep 18, 2012
OS X Vim control-6 buffer toggling fix
I recently obtained a new Retina MacBook Pro which will be my new development
box, but was annoyed to remember that
Terminal.app does not play well with
the VIM feature,
Control + 6 to toggle between two active buffers.
After talking in
irc.freenode.com#vim and not getting answers, I Google'd
harder and found this
discussion which explains clearly the issue is that
non-standard escape sequences are necessary. The solution is to use
Control + Shift + 6. This is annoying and unnecessary with the following
fix I discovered after talking with my co-worker Dan Heberden.
Dan recommended I look into keyremap4macbook which turned out to be exactly what was necessary in order to remap. Unfortunately, it's not exactly self-explanatory how to configure custom key sequences.
- Click Misc & Uninstall tab.
- Click open private.xml and from that Finder window, open in a text editor.
- Replace the contents of that file with something like:
<root> <item> <name>VIM Fix</name> <appendix>Change Ctrl+6 to Ctrl+Shift+6</appendix> <identifier>vim.owns.whatever.fix</identifier> <autogen> --KeyToKey-- KeyCode::KEY_6, ModifierFlag::CONTROL_L, KeyCode::KEY_6, ModifierFlag::CONTROL_L | ModifierFlag::SHIFT_L </autogen> </item> </root>
- Head to the Change Key and click ReloadXML.
- Click VIM Fix that now shows up in the remapping list.
So yeah, thats all there is to it. Hope this helps others out in the same boat.