Vim and keyboard layout switching

    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 switch the layout often. One solution is presented here , however, it makes you get used to the new hot key for switching layouts. There are also many platform-specific solutions with the call of various utilities. The purpose of the vim-xkbswitch plugin is to provide consistent behavior for many operating systems and languages.

    The history of the plugin development from my side can be seen here , from the side of Alexei here and here .

    The plugin uses platform-specific libraries to change layout using the operating system. Currently supported:

    1. UNIX / X Server through the xkb-switch library
    2. Windows 32 / 64bit, for which I had to make my bike
    3. Mac OS X via Xkbswitch-macosx


    So in addition to directly installing the plugin in Vim, you need to download these libraries and specify in the Vim config where to download these libraries from. For example, under Windows, working functionality can be obtained like this:

    1. Download and install the plugin: from here or from here
    2. Download the language switching library (binary files for 32-bit and 64-bit , about 5kb) and copy it to the root directory of vima
    3. 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 in edit modev, then I will see NerdTree. But if I edit the text in Russian, then "m "and the plugin, of course, will not start. However, if the plugin option" g: XkbSwitchIMappings "is installed, then the plugin will go through all the mappings of the editing mode and create similar localized ones, that is, add for me"m. "

    By default, only Russian language mappings are supported out of the box. However, the plugin can load language maps from a file, which allows creating localized imapes for any language. Under Windows, this can help make charmapgen .

    If you want to get a working plugin for another OS, then you need to make a Vim-compatible library.Who have a desire and opportunity - write in a personal.

    Also popular now: