Make Vim use Dvorak keybindings ONLY in insert mode?

允我心安 提交于 2019-12-19 05:48:20

问题


I would like to use the Dvorak layout when I am typing in Vim. However, I would like all of my shortcuts to stay the same (behave as if keyboard is Qwerty in command mode). I have tried using this:

set langmap=q',e.,rp,ty,yf,ug,ic,or,pl,[/,]=,aa,so,de,fu,gi,hd,jh,kt,ln,\\;s,'-,z\\;,xq,cj,vk,bx,nb,mm,.v,/z,-[,=],Q\\",W<,E>,RP,TY,YF,UG,IC,OR,PL,{?,}+,AA,SO,DE,FU,GI,HD,JH,KT,LN,:S,"_,Z:,XQ,CJ,VK,BX,NB,MM,<W,>V,?Z      

to map my qwerty keys to dvorak while in insert mode, but I found that it interfered with some of my shortcuts. I would like to do this while keeping my keyboard mapped to qwerty on the rest of my OS (Windows 7). How can I achieve this with Vim? What does langmap actually do? (had trouble finding documentation)

It would be nice if the keyboard was dvorak in search mode, but that's more of an added bonus.


回答1:


I would like to do this while keeping my keyboard mapped to qwerty on the rest of my OS (Windows 7)

– so just use :set keymap=dvorak (dvorak.vim may be found in default Vim configuration on Ubuntu in vim73/keymap/, it must be available on Windows too). It does what you describe: Dvorak method is used in insert mode and search mode.




回答2:


The documentation for langmap can be found at

:help langmap

[..] When you are typing text in Insert mode the characters are inserted directly. When in command mode the 'langmap' option takes care of translating these special characters to the original meaning of the key. [..]

but if you are using qwerty keys and only want dvorak in insert mode, you may have to use keymap instead



来源:https://stackoverflow.com/questions/14025247/make-vim-use-dvorak-keybindings-only-in-insert-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!