Search code examples
vimneovim

Vim Bindings Based on Key Position


Is it possible to make Vim recognize bindings by the actual key positions, not by inputted symbols? If I change my layout, I can't use any bindings.

Let's say I switch my layout to Russian and I want Ш act like an I.

Old dirty keyboard.


Solution

  • I've solved my problem with xkblayout-state: I just switch my system language layout with it every time I open Vim or enter a normal mode by these autocompletes:

    " `0` is `en_US` in my case.
    au VimEnter * silent !xkblayout-state set 0
    au InsertLeave * silent !xkblayout-state set 0
    

    Also I've found another solution on Vi Stack Exchange:

    To use langmap in greek you can follow the example given in :h 'langmap' adding this line to your vimrc (Copying this line from here may not be a good idea since I'm really not sure of the encoding, yanking the line directly from the help file is probably safer):

    langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz