Many russian VIM lover as well as user, who uses not only en_US keyboard layout knows about troubles with switching keyboard layouts over and over again to switch between text input and commands in normal mode.
If you’re familiar with
set keymap=russian-jcukenwin you may find
it not so usable. Unfortunatelly, I found no
:help neither about how to bind
CapsLock key directly, nor how to change keybinding from
Ctrl + ^. So here are
my workarounds to switch MacOS keyboard layouts globally by Caps everywhere, but in Vim.
Unbind it in system settings, (note current keyboard switching keystrokes is
Next you need PCKeyboardHack and rebind your Caps:
Then you need beta version of KeyRemap4MacBook.
Last stable version
9.3.0 haven’t worked with window’s titles properly.
Into the file
private.xml paste this:
<?xml version="1.0"?> <root> <windownamedef> <name>VI</name> <regex>vim</regex> <regex>Vim</regex> <regex>VIM</regex> </windownamedef> <item> <name>CapsLock to Crtl-^ in Vim</name> <appendix>forces it to change keymap</appendix> <identifier>private.f192f19_escape</identifier> <block> <windowname_only>VI</windowname_only> <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::KEY_6, ModifierFlag::CONTROL_L | ModifierFlag::SHIFT_L</autogen> </block>> <block> <windowname_not>VI</windowname_not> <autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::SPACE, ModifierFlag::COMMAND_L</autogen> </block> </item> </root>
And load these settings:
Finally, configure Vim like this:
set keymap=russian-jcukenwin set iminsert=0 set imsearch=0 set imdisable highlight lCursor guifg=NONE guibg=Cyan nmap <C-^> <Nop>
If everything went ok, you should be able to switch keyboard layouts system-wide with
macvim this should take no effect in
normal mode, but once you switched into
insert mode and press it you should be able to type привет!, once you left it, you still have