Vim Dvorak keybindings (rebindings :)

2019-01-20 23:46发布

问题:

Although I played with it before, I'm finally starting to use Dvorak (Simplified) regularly. I've been in a steady relationship with Vim for several years now, and I'm trying to figure out the best way to remap the key bindings to suit my newfound Dvorak skills.

How do you remap Vim's key bindings to best work with Dvorak?

Explanations encouraged!

回答1:

I use one of the more common recommended keybindings:

Dvorak it!
no d h
no h j
no t k
no n l
no s :
no S :
no j d
no l n
no L N
Added benefits
no - $
no _ ^
no N <C-w><C-w>
no T <C-w><C-r>
no H 8<Down>
no T 8<Up>
no D <C-w><C-r>

Movement keys stay in the same location. Other changes:

  • Delete 'd' -> Junk 'j'
  • Next 'n' -> Look 'l'
  • Previous 'N' -> Look Back 'L'

There were also some changes for familiarity, 's'/'S' can be used to access command mode (the old location of the :, which still works).

Added Benefits

  • End of line '$' -also- '-'
  • Beginning of line '^' -also- '_'
  • Move up 8 'T'
  • Move down 8 'H'
  • Next window <C-w><C-w> -also- 'N'
  • Swap windows <C-w><C-r> -also- 'D'

-Adam



回答2:

I don't find that I need to remap the keys for Dvorak -- I very quickly got used to using the default keybindings when I switched layouts.

As a bonus, it means that I don't have to remember two different key combinations when I switch between Dvorak and Qwerty. The difference in keyboard layout is enough that I'm not expecting keys to be in the same location.



回答3:

I simply use standard qwerty for commands and dvorak for insert mode

Here is how to set it up



回答4:

A little late, but I use the following:

" dvorak remap
noremap h h
noremap t j
noremap n k
noremap s l
noremap l n
noremap L N

" easy access to beginning and end of line
noremap - $
noremap _ ^

This basically does the following:

  • left-down-up-right are all under the default finger positions on the home row (i.e. not moved over by one as in the default QWERTY Vim mappings)
  • l/L is used for next/previous search result
  • use -/_ to reach the end/beginning of a line

This seems to work for me...



回答5:

My rebindings:

noremap h h
noremap t j
noremap n k
noremap s l
noremap j t
noremap l n
noremap k s
noremap J T
noremap L N
noremap K S
noremap T J
noremap N L
noremap S K

Notes:

  • In qwert, vi has to use 'h', because vi doesn't want to use ';' a non-letter. But in dvroak, we have 's', so why not take this advantage?
  • vi uses Caps for relative actions. This is a good design philosophy. So I try to conform this.

Meanings:

n (Next) -> l (Left) -- "What's left?" resembles "What's next?"
s (Substitute) -> k (Kill then insert)
t (jump Till) -> j (Jump till)
N, S, T are similar.

J (Join lines) -> T (make lines Together)
K (Keyword) -> S (Subject)
L[count] (Line count) -> N (line Number)

B.T.W. L itself goes to the last line, and N is the last letter of fin. (Thanks for tenzu to point out this.)

P.S. I have used these rebindings for a while. Now I does not use it in vim. I just use the default ones.



回答6:

Vim ships with an extensive Dvorak script, but unfortunately it’s not directly source-able, since the file includes a few lines of instructions and another script that undoes its effects. To read it, issue the following command:

:e $VIMRUNTIME/macros/dvorak


回答7:

You can use this to have Vim use Dvorak only in insert mode:

:set keymap=dvorak

This way all of the commands are still in QWERTY, but everything you type will be in Dvorak.

Caveats: Well, almost everything. Insert mode, search mode, and replace mode will all be dvorak, but ex commands will not. This means that you don't have to relearn :wq, but you will need type :%s/foo/bar/gc in QWERTY.

This won't help if you only want to move certain commands, but I found that in my head, "move forward one word" was bound to "move left ring finger up," rather than "ask the typing department where the letter 'w' is and then press it," which made this method much easier for me.