Colemak key mappings for Vim. Trimmed and modified version of jooize,s configuration, which is a trimmed and modified version of Shai Coleman's configuration.
My version is decently minimized to change as few keys as possible. It has word navigtion on h and j, which is a quirk of my keyboard layout, so no one else will probably ever use this.
-
Use vim-plug.
-
Add to
.vimrc
:Plug 'spiderforrest/vim-colemak'
-
Run
vim +PlugInstall
-
You probably want to load vim-colemak last. Reload the plugin at the bottom of your Vim configuration.
" Reload vim-colemak to remap any overridden keys silent! source "$HOME/.vim/bundle/vim-colemak/plugin/colemak.vim"
with neovim:
silent! source "$HOME/.config/nvim/bundle/vim-colemak/plugin/colemak.vim"
Note: You might be using
~/.vim/plugged
. -
See issues for conflicts with other plugins.
`12345 67890` Move around: | (instead of) `12345 67890-=
zwfp, .luy;- i | k qwert yuiop[]\
arstg[ ]kneio' n o | h l asdfg HJKL;'
qxcdb mhjv/= e | j zxcvb nm,./
( novx) n = h (Left) e = l (Right) i = k (Up) o = j (Down)
( n x) v = v (Visual) V = V (Visual line)
( n ) r = r (Replace) R = R (Replace)
( novx) k = i (Insert) K = I (Insert before first non-blank of line)
( n ) a = a (Append) A = A (Append at end of line)
( n ) c = c (Change) C = C (Change to end of line)
( n ) w = n (for navigating search)
( o ) r = i (Example: dip -> drp (Delete inner paragraph))
( novx) h = b (back word)
( novx) b = w (word end)
( novx) j = e (forward word)
( n x) zn = zj (Next fold)
( n x) ze = zk (Previous fold)
( n ) l = o (open)
( n x) <C-W>n = <C-W>h (Window left)
( n x) <C-W>e = <C-W>j (Window down)
( n x) <C-W>i = <C-W>k (Window up)
( n x) <C-W>o = <C-W>l (Window right)
Lost:
( n ) Z (Quit)
( n x) <C-W>n (Window down) [Use <C-W><C-N> = <C-W><C-N>]
( n x) <C-W>i (Window down) [Use <C-W><C-I> = <C-W><C-I>]
Legend:
<C-X> Ctrl-X
(c ) Command-line mode
( i ) Insert mode
( n ) Normal mode
( o ) Operator pending
( v ) Visual+Select mode
( x) Visual mode
tpope/vim-fugitive keymap collision
" Fix for colemak.vim keymap collision. tpope/vim-fugitive's maps y<C-G>
" and colemak.vim maps 'y' to 'w' (word). In combination this stalls 'y'
" because Vim must wait to see if the user wants to press <C-G> as well.
augroup RemoveFugitiveMappingForColemak
autocmd!
autocmd BufEnter * silent! execute "nunmap <buffer> <silent> y<C-G>"
augroup END
Rewrote the plugin, minimizing changes. Past ergonomics, I think preserving the letter of a command is better than the position of it-it's personally easier for me to remember the letters, and is signifigantly less complex for overall configuration.
- Restore wrapped line behavior to Vim default (e.g. n = gj is now n = j)
- Remove turbo navigation (HNEI are now unmapped)
- Add missing mapping for reselecting last visual selection (ga = gv)
Add the following to your .vimrc
:
" Turbo navigation (Colemak) {{{
" Works with counts, see ":help complex-repeat"
nnoremap <silent> H @='5h'<CR>|xnoremap <silent> H @='5h'<CR>|onoremap <silent> H @='5h'<CR>|
nnoremap <silent> N @='5gj'<CR>|xnoremap <silent> N @='5gj'<CR>|onoremap <silent> N @='5gj'<CR>|
nnoremap <silent> E @='5gk'<CR>|xnoremap <silent> E @='5gk'<CR>|onoremap <silent> E @='5gk'<CR>|
nnoremap <silent> I @='5l'<CR>|xnoremap <silent> I @='5l'<CR>|onoremap <silent> I @='5l'<CR>|
" }}}
I removed turbo navigation since I felt it doesn't suit as default Vim mappings, which also frees up the keys for custom uses. I'm considering making it an option. Discuss!