Staying on the touch-typing base line (a, s, d, f, ..) is strongly promoted by the Vim movement keys - but
escape and more tend to distract my hand position. Here are some of the steps I took to deal with this:
Control-mto save all
jjto Escape in insert mode
map , to Leader
Most people remap the leader key, so I’ll not lose many words on this:
map Space to ^
Space is a big key (actually, two keys because both thumbs can use it) and it’s obvious that it should be mapped to something useful/often-used.
There’s a lot of possibilities, some interesting ones to get you started:
- repeat last macro
My current favorite is “jump to indent-start”:
I’m still evaluating binding it to page-down or to
:, although I’m pretty happy about getting rid of the
Here are two extensive discussion threads on this (via reddit):
- Space is a big key, what do you map it to?
- What have you mapped space bar to do when you’re not in insert mode?
map Control-m to save-all
I almost never selectively save single buffers since all my files are version controlled and there’s an undo queue. This binding will eliminate a very common use of the
: key, which is straining both pinkies.
Many people map
Escape. Other people map it to
Control. Both mappings substitute the use of a
difficult to reach key.
You can get the best of both worlds by mapping a tap to
Escape and a hold to
since the control key is only used as a modifier and the Escape key is never used as a modifier.
I’m doing this mapping outside of Vim. Here’s how it’s done in Ubuntu 14.04:
mapping Caps Lock to Control
First, you’ll have to map
Caps Lock to
Control. I did this via dconf-editor.
Note that there are multiple ways to do this, but dconf or gnome-tweak-tool worked best for me.
Now navigate to:
org -> gnome -> desktop -> input-sources
and set the entry:
There is a tool named xcape which does this: “xcape: Linux utility to configure modifier keys to act as other keys when pressed and released on their own.”
It is available on github: https://github.com/alols/xcape
The install instructions provided there worked well for me:
1 2 3 4 5 6
I added the
sudo make install line to have it available system-wide.
Now let’s use it:
The zero timeout value is important since else it would sometimes interpret leaving insert mode and pressing another key as a Ctrl-? combination if you’re too quick.
This command is not persistent, so if you have tested it out and like the way it works, append the above line to your
map jj to Escape in insert mode
This is really cute and it’s been sitting in my .vimrc for quite some time now. But I have to admit that I’ve never used it - I probably should, though, since this will greatly reduce the strain on my left pinky.
remap window focus movement
Moving between windows is awkward with most configurations.
I was using \<Leader>-W as my window command initiator, but this is still a lot of keypresses just for jumping with your cursor.
Using Control+Movement keys to jump intuitively between window splits seems to be a nice idea, but for me this only became viable once I moved the Ctrl key to CapsLock (as described above).
1 2 3 4
map Escape-Escape to nohlsearch
This is a pretty new addition to my .vimrc but I started to really like it, since
While one of the most important features of Vim is interruption free touchtyping, some hard to reach keys are a part of many of it’s workflows.
While on the one hand this is not as bad as constantly reaching for the cursor keys while coding, reaching for medium-distance or awkwardly placed keys can put a substantial strain on your hand.
Most of the settings above are fairly trivial, but some of them had a huge impact on my vim workflow.