vimkeyboard-layoutideavim

IdeaVim and russian layout


Is there any way to make IdeaVim understand russian layout in modes other than Input? In my .vimrc I have

set keymap=russian-jcukenwin

so I can switch languages in VIM by pressing Ctrl+^ and relatively happy with that. But it seems that IdeaVim doesn't read or understand this setting. It can be very annoying to stop typing something (for example comment) in russian, switch to command mode and stuck. Is there any workaround?


Solution

  • First i tried to use langmap like in this gist but IdeaVim does not support langmap.

    Next I tried to use map so I made this solution:

    let rumap = 'йцукенгшщзхъфывапролджэёячсмитьбюЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ'
    let enmap = 'qwertyuiop[]asdfghjkl;''\zxcvbnm,.QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>' 
    let mapLen = strchars(rumap)
    let i = 0
    while i < mapLen
        let ruChar = matchstr(rumap, ".", byteidx(rumap, i))
        let enChar = enmap[i]
        "echo 'map '.ruChar.' '.enChar
        execute 'map '.ruChar.' '.enChar
        execute 'cmap '.ruChar.' '.enChar
        let i += 1
    endwhile
    
    map Ё \|
    cmap Ё \|
    

    You can customize it for your keyboard layout.

    But I forgot that IdeaVim does not support vimscript and cmap and I added echo 'map '.ruChar.' '.enChar (commented line), appended code from above to .vimrc and opened vim from command line so it printed me all map commands. I added them to .ideavimrc and appended mapping of pipe (|) character:

    map й q
    map ц w
    map у e
    map к r
    map е t
    map н y
    map г u
    map ш i
    map щ o
    map з p
    map х [
    map ъ ]
    map ф a
    map ы s
    map в d
    map а f
    map п g
    map р h
    map о j
    map л k
    map д l
    map ж ;
    map э '
    map ё \
    map я z
    map ч x
    map с c
    map м v
    map и b
    map т n
    map ь m
    map б ,
    map ю .
    map Й Q
    map Ц W
    map У E
    map К R
    map Е T
    map Н Y
    map Г U
    map Ш I
    map Щ O
    map З P
    map Х {
    map Ъ }
    map Ф A
    map Ы S
    map В D
    map А F
    map П G
    map Р H
    map О J
    map Л K
    map Д L
    map Ж :
    map Э "
    map Я Z
    map Ч X
    map С C
    map М V
    map И B
    map Т N
    map Ь M
    map Б <
    map Ю >
    map Ё /|
    

    Now I have IdeaVim working with cyrillic layout in normal, visual+select and operator-pending modes.