Using Vim with Colemak

Posted by Xudong Zheng on December 28, 2017

Colemak is one of the most popular alternatives to the standard QWERTY keyboard layout due to its (arguably) superior ergonomics. Using it with Vim, a highly customizable modal text editor, allows me to maximize productivity when either programming or writing. Vim users who are considering the switch from QWERTY to Colemak are confronted with the dilemma as to whether it is worthwhile to remap lim's default binding to maintain the key positioning under Colemak. Both options have various benefits and challenges.

Keeping the default Vim bindings can be very beneficial for users who frequently work on remote machines with only the standard Vim configuration, allowing them to use Vim with the same muscle memory. This is perhaps the simplest solution, although a major drawback is that a single finger (the right index finger) is responsible for all 4 hjkl keys. While I do not rely on hjkl to navigate within Vim, I use them often enough that using Vim's default bindings is inconvenient.

My preferred solution is using noremap to map Colemak keys to the corresponding QWERTY keys. This works well for me because I am able to deploy me personal .vimrc to remote servers that I administer. You can take a look at my complete .vimrc file to see what exactly I've done (along with my other customizations).

noremap d g
noremap e k
noremap f e
noremap g t
noremap S D
noremap T F
noremap U I
noremap Y O

You would for example use n instead of j to go to the next line since n in Colemak uses the j QWERTY key. Keep in mind these mappings change verbs and modifiers but not text objects. Deleting within parenthesis is logically sub instead of the QWERTY dib. However, deleting a sentence is sas and not sar (which you may expect since r in Colemak uses the s QWERTY key). This is because a sentence (or a paragraph, among many other things) is a text object and noremap does not modify the mappings for text objects.