This post is part of the Colemak necessities series.

A more actionable follow up to my personal recollections relating to my switch to Colemak.


I have, in the past written about how I made the switch to Colemak. However, until recently, I was still trying to mimic the VIM keybindings from QWERTY. This is a post where I discuss the changes I made to ensure that I never have to stretch my fingers in odd ways again. The main idea is expressed well by vim-colemak.

1Colemak layout:                  |                 QWERTY layout:
2`12345 67890-=     Move around:  |  (instead of)   `12345 67890-=
3 qwfpg jluy;[]\         e        |       k          qwert yuiop[]\
4 arstd HNEIo'         h   i      |     h   l        asdfg HJKL;'
5 zxcvb km,./            n        |       j          zxcvb nm,./


It is important to note that the sudo command does not automatically pick up on your keyboard layout. It is best to set this explicitly. Use visudo and un-comment Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET", or:

2echo 'Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"' >> /etc/sudoers


Though I have mentioned publicly, that I was using the regular QWERTY motion keys, I realized I had actually started to use the mouse more often, simply because it was a pain to navigate. Thankfully, emacs has evil-colemak-basics, which is fabulous. For reference, these make it really easy for QWERTY users to make the switch if they’re previously used to VIM bindings.

ColemakQwertyActionStatesAt Qwerty position?Remarks
h, n, e, ih, j, k, lnavigatemnvoyes
k, Kn, Nsearch next/previousmnvoyes
u, Ui, Iinsert_nv_yes
NJjoin lines_nv_yes
uiinner text object keymap___oyes
f, Fe, Ejump to end of wordmnvoyeswith t-f-j rotation
t, Tf, fjump to charactermnvoyeswith t-f-j rotation
j, Jt, Tjump until charactermnvonowith t-f-j rotation
j, Je, Ejump to end of wordmnvonowithout t-f-j rotation

Where the table above is from the fantastic readme.

I still had some issues, mostly relating to searching in buffers, so I ended using swiper-isearch more which is a bonus too.

Visual Lines

Since I tend to keep visual-line-mode all the time, it makes sense to actually swap working with lines and visual lines. To work this through this needs evil-better-visual-line.

 1(use-package! evil-better-visual-line
 2  :after evil-colemak-basics
 3  :config
 4  (evil-better-visual-line-on)
 5  (map! :map evil-colemak-basics-keymap
 6        (:nvm "n" 'evil-better-visual-line-next-line
 7         :nvm "e" 'evil-better-visual-line-previous-line
 8         :nvm "g n" 'evil-next-line
 9         :nvm "g e" 'evil-previous-line))


For my doom-emacs configuration, I also set the following map:

 1(after! pdf-view
 2  (add-hook! 'pdf-view-mode-hook (evil-colemak-basics-mode -1))
 3 (map!
 4   :map pdf-view-mode-map
 5   :n "g g"          #'pdf-view-first-page
 6   :n "G"            #'pdf-view-last-page
 7   :n "N"            #'pdf-view-next-page-command
 8   :n "E"            #'pdf-view-previous-page-command
 9   :n "e"            #'evil-collection-pdf-view-previous-line-or-previous-page
10   :n "n"            #'evil-collection-pdf-view-next-line-or-next-page
11 )

Where the most important thing is the hook which removes the evil-colemak-basics binding. Since it is a single mode and hook, after-hook! is the same as after-hook1.

Window Management

Somehow these are not part of the evil-colemak defaults.

 1(after! evil
 2  (map! :map evil-window-map
 3        (:leader
 4         (:prefix ("w" . "Select Window")
 5          :n :desc "Left"  "h" 'evil-window-left
 6          :n :desc "Up"    "e" 'evil-window-up
 7          :n :desc "Down"  "n" 'evil-window-down
 8          :n :desc "Right" "i" 'evil-window-right
 9          ))
10        ))

Harmonizing with Vimium.

1(after! evil (map! :map evil-motion-state-map
2                   (:n :desc "Previous match" "K" 'evil-ex-search-previous
3                    :n :desc "Next match" "k" 'evil-ex-search-next
4                    :n :desc "Forward search" "/" 'evil-search-forward
5                    )
6                   ))

Page Movement

Though this is more of a personal preference, I find it more natural to bind N and E to page-wise movement instead of join lines and lookup, since I almost never use those commands, and the movement keys echo what I expect elsewhere.

1(after! evil
2  (map! :map evil-colemak-basics-keymap
3      :nv "N" 'evil-scroll-page-up
4      :nv "E" 'evil-scroll-page-down)
5  )

Evil Org

Annoyingly, evil-org-mode had a map which kept overriding all my other settings. Thankfully it has a helper variable to set movement. I also do not need this anyway, at-least not by default.

1(after! org
2  (remove-hook 'org-mode-hook 'evil-org-mode)
3  (setq evil-org-movement-bindings
4        '((up . "e") (down . "n")
5          (left . "h") (right . "i"))
6        )


I use the excellent vimium to make Chrome be a little less annoying. Luckily the Wiki seems to have a reasonable suggestion for colemak. The basic idea is to migrate the underlying keys directly to ensure very few manual changes are required.

 1mapkey n j
 2mapkey N J
 3mapkey e k
 4mapkey E K
 5mapkey i l
 6mapkey I L
 7mapkey k n
 8mapkey K N
 9mapkey l i
10mapkey L I
11mapkey j e
12mapkey J E


I still use the fantastic tridactyl for Firefox when I can. However, the bindings are slightly more involved, since there is no equivalent for the mapkey which Vimium has.

 1" Rebinds for colemak
 2" hjkl --> hnei
 3bind h scrollpx -50
 4bind n scrollline 10
 5bind e scrollline -10
 6bind i scrollpx 50
 7" HJKL --> HNEI
 8bind H back
 9bind N tabprev
10bind E tabnext
11bind I forward


For a lot of terminal edits, vim is still my editor of choice, and vim-colemak works without any trouble in my configuration.


To ensure uniform bindings, I used to use bindkey -v but will need some minor changes to that set up. I based this part of my configuration off the bindings of bunnyfly.

 1bindkey -v
 2# Colemak.
 3  bindkey -M vicmd "h" backward-char
 4  bindkey -M vicmd "n" down-line-or-history
 5  bindkey -M vicmd "e" up-line-or-history
 6  bindkey -M vicmd "i" forward-char
 7  bindkey -M vicmd "s" vi-insert
 8  bindkey -M vicmd "S" vi-insert-bol
 9  bindkey -M vicmd "k" vi-repeat-search
10  bindkey -M vicmd "K" vi-rev-repeat-search
11  bindkey -M vicmd "l" beginning-of-line
12  bindkey -M vicmd "L" end-of-line
13  bindkey -M vicmd "j" vi-forward-word-end
14  bindkey -M vicmd "J" vi-forward-blank-word-end
16# Sane Undo, Redo, Backspace, Delete.
17  bindkey -M vicmd "u" undo
18  bindkey -M vicmd "U" redo
19  bindkey -M vicmd "^?" backward-delete-char
20  bindkey -M vicmd "^[[3~" delete-char
22# Keep ctrl+r searching
23  bindkey -M viins '^R' history-incremental-pattern-search-forward
24  bindkey -M viins '^r' history-incremental-pattern-search-backward


There is no better pdf viewer than zathura, and it also works for djvu and friends. As a plus point, it normally has very reasonable vim bindings, and an excellent configuration system, so we will leverage that. The best part is that we can just add to it using include zathuraColemak or whatever so as to be minimally invasive.

 1map h scroll left
 2map n scroll down
 3map e scroll up
 4map i scroll right
 6map N scroll half-down
 7map E scroll half-up
 9map k search forward
10map K search backward
12# For TOC navigation
13map [index] o toggle_index
15# hjklhnei
16map [index] n navigate_index down
17map [index] e navigate_index up
18map [index] h navigate_index collapse
19map [index] i navigate_index expand
21map [index] H navigate_index collapse-all
22map [index] I navigate_index expand-all

Zathura is a complicated beast, however, and my full configuration contains a lot more information.


I have some bindings set up in terms of $left $right $up and $down, so it was simple to re-bind them.

1set $left h
2set $down n
3set $up e
4set $right i


Sadly, one of the email clients I do use regularly of late is MailMate. It supports a rather rich set of keybindings placed, e.g. with "~/Library/Application\ Support/MailMate/Resources/KeyBindings/" configured as follows:

 2      "c"	= "newMessage:";
 3      "/"	= "searchAllMessages:";
 4      "n"	= "nextMessage:";
 5      "e"	= "previousMessage:";
 6      "h" = "collapseThread:";
 7      "i" = "expandThread:";
 8      "H" = "rootOfThread:";
 9      "I" = "lastOfThread:";
10      "N" = "nextThread:";
11      "E" = "previousThread:";
12      "o"	= "openMessages:";
13      "x" = ( "deleteMessage:", "nextMessage:" ); // Defaults to going to the previous message
14      "a"	= "archive:";
15      "s"	= "toggleFlag:";
16      "!"	= "moveToJunk:";
17      "r"	= "reply:";
18      "R"	= "replyAll:";
19      "f"	= "forwardMessage:";
20      "^s"	= "saveDocument:";
21      "u" = "toggleReadState:";


That seems to be it for now. If I think of more programs I use regularly which allow VIM bindings, or keybindings in general, I’ll probably just update this post. My full dotfiles are present here, and now include a colemak target.

  1. The hook fix was suggested by the fantastic hlissner on the super friendly doom Discord server. ↩︎

Series info

Colemak necessities series

  1. Switching to Colemak
  2. Refactoring Dotfiles For Colemak <-- You are here!
  3. Remapping Keys with XKB and KLFC
  4. Remapping Keys for ColemakVIM on MacOS