Vim Cheat Sheet - incl. Vimium & NERDTree

This Vim commands cheat sheet also includes commands and shortcuts for Vimium & Nerdtree.

VIM

Cursor movement

CommandExplanation
hleft
jdown
kup
lright
wjump by start of words (punctuation considered words)
Wjump by words (spaces separate words)
ejump to end of words (punctuation considered words)
Ejump to end of words (no punctuation)
bjump backward by words (punctuation considered words)
Bjump backward by words (no punctuation)
gejump backward to end of words
0(zero) start of line
^first non-blank character of line
$end of line
-line upwards, on the first non blank character
+line downwards, on the first non blank character
<enter>line downwards, on the first non blank character
gggo to first line
Ggo to last line
nGgo to line n
:ngo to line n
)forward to the next sentence.
(backward by a sentence.
{a paragraph backwards
}a paragraph forwards
]]a section forwards or to the next {
[[a section backwards or the previous {
Hto the top of the screen.
Mto the middle of the screen.
Lto the bottom of the screen.
fxsearch line forward for 'x'
Fxsearch line backward for 'x'
txsearch line forward before 'x'
Txsearch line backward before 'x'

Bookmarks

CommandExplanation
:markslist all the current marks
mamake a bookmark named a at the current cursor position
`ago to position of bookmark a
'ago to the line with bookmark a
`.go to the line that you last edited

Insert mode

CommandExplanation
istart insert mode at cursor
Iinsert at the beginning of the line
aappend after the cursor
Aappend at the end of the line
oopen (append) blank line below current line
Oopen blank line above current line
<Esc>exit insert mode

Editing

CommandExplanation
rreplace a single character (does not use insert mode)
Rreplace characters rather than inserting
Jjoin line below to the current one
ccchange (replace) an entire line
cwchange (replace) to the end of word
c$change (replace) to the end of line
sdelete character at cursor and substitute text
Sdelete line at cursor and substitute text (same as cc)
xptranspose two letters (delete and paste, technically)
uundo
CTRL-rredo
.repeat last command
~switch case
g~iwswitch case of current word
gUiwmake current word uppercase
guiwmake current word lowercase
gU$make uppercase until end of line
gu$make lowercase until end of line
:%retabfix spaces / tabs issues in whole file
:r [name]insert the file [name] below the cursor.
:r !{cmd}execute cmd & insert its standard output below cursor.
CommandExplanation
CTRL-fforward by a screen of text
CTRL-bbackward by a screen of text
CTRL-uup by half a screen
CTRL-ddown by half a screen

References

  1. #