
All Vim commands must be entered in English. If the main text is entered in any other language, then this is a problem, because you need to often switch the layout. One of the solutions is presented
here , but it makes you get used to the new hot key to switch layouts. There are also many platform-specific solutions that invoke various utilities. The goal of the
vim-xkbswitch plug
-in is to provide uniform behavior for many operating systems and languages.
The history of the development of the plugin for my part can be viewed
here , from Alexey
here and
here .
The plugin uses platform-specific libraries to change the layout of the means of the operating system. Currently supported:
')
- UNIX / X Server via xkb-switch library
- Windows 32 / 64bit, for which I had to make my bike
- Mac OS X via Xkbswitch-macosx
So besides the direct installation of the plugin in Vim, you need to download these libraries and specify in the Vim config where these libraries will be loaded from. For example, under Windows, the working functionality can be obtained as follows:
- Download and install the plugin: from here or from here
- Download the language switching library (binary files for 32 bits and for 64 bits , about 5kb) and copy it to the root directory of vima
- Add the following lines to vimrc:
let g:XkbSwitchEnabled = 1 let g:XkbSwitchIMappings = ['ru']
We are approaching another interesting feature of the plugin - adding localized hot keys. For example, if I press <CN> v in edit mode, then I will see NerdTree. But if I edit the text in Russian, it will be pressed "<CN> m" and the plugin, of course, will not start. However, if the plug-in option “g: XkbSwitchIMappings” is set, the plug-in will iterate through all editing mode mappings and create similar localized ones, i.e. will add for me "<CN> m".
By default, mapping is supported only for the Russian language out of the box. However, the plugin can load language maps from a file, which will allow you to create localized imaps for any language. Under Windows this can help
charmapgen .
If you want to get a working plugin for another OS, then you need to make a Vim-compatible library. Who has the desire and opportunity - write in a personal.