Vim Cheatsheet

This is a cheatsheet based on my personal usage, so your mileage may vary. I hope this is useful to others as well. I keep on updating it from time to time.

Please note, I am using the carlhuda/janus: Vim distribution which means some of the key shortcut combinations are based on the base customization that’s happening in that specific distribution. For example, gw swaps the current word with the following word. You can check more customizations in this distribution to make sure you are not surprised.

If you need a basic more general cheatsheet this is a great one: Vim Cheat Sheet.

Set color column

:set colorcolumn=80 # Shows a vertical line at column 80


C+F # page down
C+B # page up
H   # go to viewport top
M   # go to viewport middle
L   # go to viewport bottom
14j # go 14 lines down from where you are
14k # go 14 lines up from where you are
10g # go to line 10
gg  # go to the beginning of the file
G   # go to the end of the file


zf14j # create fold that encloses the next 14 lines
za    # toggle
zd    # delete fold
zj    # jump to the previous fold
zk    # jump to the next fold


In the shell to refresh the index:

ctags -R .

In vim:

C+]  # navigate to the definition of the method under cursor
g+]  # show a list of definitions to choose from
C+t  # navigate back to where you were before
\+rt # toggle tagbar



Item 1
Item 2
Item 3

The following sequence:


Produces the following:

<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>


:noh              # to turn off highlighting until the next search
:Ack <cword> app/ # Find all word under cursor instances in app


:setlocal spell spelllang=en_us # turn spell check on
:set nospell                    # turn it off
]s                              # move to the next misspelled word
[s                              # move to the previous misspelled word
z=                              # get a list of alternatives
zg                              # mark a word as correct
zw                              # mark a word as incorrect

Optionally to sync your “correct” word list across computers add this to your .vimrc:

set spelllang=en_us
set spellfile=$HOME/Dropbox/vim/spell/en_us.utf-8.add

What are you up to Petros?

Head of Support at GitBook. Building Supportress, a simple helpdesk for calm teams based on my 9 years working at GitHub Support. Writing 2D retro games. Check what I am doing now.