evindor / vim-rusmode

Bind pressing russian key in normal mode to toggle layout and repeat same key.
http://www.vim.org/scripts/script.php?script_id=4493
18 stars 2 forks source link

Add support for keyboard layout variants #10

Open Somelauw opened 9 years ago

Somelauw commented 9 years ago

I'm not a native russian, so I use a phonetic layout.

I tried configuring your plugin like this:

call vam#ActivateAddons([ 'vim-rusmode'], {'auto_install' : 0})
    let g:rusmode_autotoggle_insertleave=0 'Setting it to 1, didn't seem to make a difference
    let g:rusmode_get_layout_command = 'setxkbmap -print | grep xkb_symbols | awk "{split($0,arr,\"+\")} END{print arr[2]}"'
    let g:rusmode_set_layout_command = 'setxkbmap -option "grp:caps_toggle" -layout "us,ru" -variant ",ownvariant"'
    let g:rusmode_normal_layout='us' 

However, when I press a key in Russian when using my own variant, it takes the position where that key would be in the "JCUKEN" layout and then inserts the key that would be at that location if I were using the US layout. Fixing this won't be easy, because right now you are directly mapping keys from JCUKEN to QWERTY.

evindor commented 9 years ago

Yeah, I don't think there are any other ways than mapping keys directly. Or mapping them in a loop over layout keys array, essentially the same thing but with less typing.

Shouldn't be that hard to add another layout though, just boring :)