Code Self Study Forum

A way to learn Vim

I was just cleaning out some old directories and found the photo below from when I was learning Vim. If anyone is trying to learn Vim (or another editor with a lot of commands like Emacs) and has a fixed desk, this technique might be useful.

I printed some Vim cheatsheets and taped them to the wall next to my desk at work. Whenever I would get stuck in Vim, I would look over at the wall and learn an efficient command for that task. (no arrow keys allowed)


If you want to force yourself to not use arrow keys, paste this in your .vimrc file – it will cause the arrow keys to resize splits rather than move the cursor:

" Arrow keys resize splits
nnoremap <Up>    :resize +2<CR>
nnoremap <Down>  :resize -2<CR>
nnoremap <Left>  :vertical resize +2<CR>
nnoremap <Right> :vertical resize -2<CR>

The cheat sheets are great, but I also think it’s important to learn Vim’s grammar. The grammar helped me make sense of the keystrokes and also helped me come up with them on the fly based on a few commands I am familiar with.

1 Like