1

I transitioned to Dvorak so now I'm remapping the keys on Vim.

One of the decisions are remap q to d, so I wrote the following on ~/.config/nvim

noremap q d 
noremap qq dd
noremap Q D
noremap qt dk
noremap qh dj
noremap qw dw
noremap qe de
noremap q0 d0
noremap q$ d$

However, this doesn't work if you use a number, such as q2w. Typing q makes the editor waiting, and then typing 2 triggers a single delete, and then typing w just moves the cursor.

It is practically unfeasible to map every number combination (q3w, q4w, etc...). Is there any way to remap all the number combinations together?

3

If all you want to do is have "q" work like "d" when you enter Normal mode commands then you can use the 'langmap' setting.

:set langmap=qd,QD

Now q2w will work exactly the same as d2w. The mapping is also applied in Visual mode. In all other modes nothing changes, "q" is "q".

See :h lmap because there are a couple potentially important details (e.g. what to do if there is any interference with any of your mappings.)

There are reams of information out there on using Vim with a Dvorak keyboard, BTW. The Vim Wiki is one example.

  • Strangely, while this works in neovim, the q key suddenly stopped working in vim... How can I know what is leading to it? – Blaszard Feb 23 '18 at 7:07
  • Not sure...I don't see any issues with vim. Do you have any mappings (e.g. using nmap) that might be conflicting? You can set langmap when all your other config is disabled (vim -u NONE -N ....) and see if problem still exists. – B Layer Feb 23 '18 at 8:34
  • Seems that I set noremap d h on ~/.vimrc and now the q is remapped to h as well. (so if I type in q, it moves the cursor to left). Do you know any workaround? – Blaszard Feb 23 '18 at 11:12
  • Did you read the help for 'langmap' like I suggested? They talk about mapping conflicts in there. – B Layer Feb 23 '18 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.