Vim Tips Wiki
Register
Advertisement
Tip 1437 Printable Monobook Previous Next

created December 10, 2006 · complexity basic · author Jesse Read · version 6.0


Some long-time users of Vim have trouble when they try to switch to the Dvorak keyboard layout. They may want to type with the efficiency of the Dvorak layout but use the default Vim layout for navigating and commands (especially the hjkl movement keys).

You can continue using the familiar QWERTY layout for navigation and commands but when you enter insert mode you will be in Dvorak mode.

This also means you don't have to continually switch back and forth between X layouts with xmodmap.

Adding one of the lines of code in this tip to your vimrc lets you do exactly that.

Caveats

  • This potentially interferes with any normal-mode mappings you may have in your vimrc.
  • This won't change multi-key shortcuts like <c-v>, even in normal mode.
  • Many Dvorak users have no problem learning the normal Vim commands with a Dvorak layout. The movement keys may not look it at first but are in fact pretty intuitive -- J and K are on the middle and index fingers of the left hand, right next to each other in the same order as on the qwerty layout, while H and L are the index and pinky fingers of the right hand, so the one for left is on the left -- again perfectly accessible. The only real caveat here, therefore, is that both hands are needed to navigate. Most other keys are simple mnemonics or just as easy to access in Dvorak anyway. Don't let Dvorak be a barrier to learning Vim nor let Vim be a barrier to learn Dvorak just because you don't want to remap everything to get started. Just give it a chance first!
  • You may also want to try the ":e $VIMRUNTIME/macros/dvorak" command, that guides you to the vim stock dvorak description. It is also broken some times, so the langmap is preferable, though less portable.
  • Remapping the keyboard so that Dvorak is only used in insert mode will make some commands like "w" for "move forward a word", "f" for "find a character", etc. much harder to remember if your brain works in Dvorak mode (press "u" to find a character and "," to move forward a word, etc.).

dvorak to qwerty

set langmap='q,\,w,.e,pr,yt,fy,gu,ci,ro,lp,/[,=],aa,os,ed,uf,ig,dh,hj,tk,nl,s\\;,-',\\;z,qx,jc,kv,xb,bn,mm,w\,,v.,z/,[-,]=,\"Q,<W,>E,PR,YT,FY,GU,CI,RO,LP,?{,+},AA,OS,ED,UF,IG,DH,HJ,TK,NL,S:,_\",:Z,QX,JC,KV,XB,BN,MM,W<,V>,Z?

dvorak.fr to azerty

Here is a mapping for dvorak.fr to azerty :

set langmap=:a,àz,ée,gr,.t,hy,vu,ci,mo,kp,è^,z$,oq,as,ud,ef,bg,fh,sj,tk,nl,dm,wù,ù*,ç<,'w,qx,\,c,iv,yb,xn,r\,,p:,j!,l;;,?A,ÀZ,ÉE,GR,.T,HY,VU,CI,MO,KP,Ȩ,Z£,OQ,AS,UD,EF,BG,FH,SJ,TK,NL,DM,W%,Ù*,Ç>,'W,QX,\\;C,IV,YB,XN,RG,L.,P/,J§,/&,+é,*',=(,(è,`_,)ç,"à,[),]=,°{,+},\-,-"

Comments

This is a really bad idea in my opinion. Using two different keyboard layouts at the same time is confusing and will prevent you from really learning Dvorak. I have trouble believing, that the solution above can actually be used efficiently by anyone.

I have been using Dvorak (as X keyboard map) and Vim for about two years now, without *any* adjustments (concerning Dvorak) to Vim at all, and it works great. The solution imho is to simply remember Vim commands by their name, rather than their keyboard position (e.g. I think I want to d(elete) 2 w(ords), and hit d2w without thinking about the key positions (my fingers know the position themselves).

Personally, I agree, and have had the same experience. I would not recommend this tip to anyone. Hence some of the warnings in the caveats section. Someone obviously thought this useful, however. If you think the warning should be more prominent, feel free to move it to the beginning of the tip somewhere. --Fritzophrenic 13:15, September 27, 2009 (UTC)
I also agree. I learned vim on a Dvorak keyboard, so the qwerty (real) layout feels weird to me. I find that having j and k on the LH is extremely useful because my LH is usually on the keyboard. The h and l split isn't that bad either, since it's just one row up (which is easy to reach). The only real issues I've ever encountered is when I'm using spell commands `[s', `]s' (for qwerty-ists, equivalent to `-;' and `=;'). I ended up mapping these to `gn' and `gN' so they really aren't an issue anymore. Every once in a while I'll run across a command that was awkward to input, but usually it's smooth.
I find I like the well thought-out layout of both the original vim commands and the layout of dvorak. You shouldn't have to choose between them. Yes, you should know the actual key letters for the commands, and that way you don't forget the qwerty layout. Useful idea to fix it, I wish it actually worked well.
Please let us know of any specific issues you may have encountered so they can be fixed in the tip. Or fix them yourself. "I wish it actually worked well" tells us nothing. --Fritzophrenic 14:30, August 3, 2010 (UTC)
Nah, just use Dvorak as-is—it's no problem. 24.86.184.60 05:54, August 3, 2010 (UTC)
It's not only "no problem" in some cases it makes things easier. I use the _ and g_ commands all the time because they are so easy to reach, even easier than ^ and $ which (roughly) correspond on QWERTY (which I could also use on Dvorak if I had a mind to). --Fritzophrenic 14:30, August 3, 2010 (UTC)
Advertisement