Show Menu
Cheatography

Vim Cheat Sheet (DRAFT) by

This is my first cheat sheet. Mainly for beginners.

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Vim Modes

v
Visual
i or a
Insert
:
Command
Esc
Normal
.

Moving around the Document

h or
Left 1 charactor
j or
Down
k or
Up
l or
Right
w
Next word
b
previous word
}
next block of text
{
previous Block of text
G
Last line in file
gg
First Line in file
14G
Go to line 14
%
Matching braket
Ctrl + F
Move forward 1 screen

netrw (explore filesy­stem)

:e. or :E
open filebr­owser
:tabe |:e.
open filebr­owser in a new tab

TABS

:tabe file
open file in new tab
:tabc
close current tab
:tabo
keep current tab open, close all others
:tabn or gt
next tab
:tabp or gT
previous tab
 

Undo, Redo and Delete, Repeat

u
Undo
Ctrl + r
Redo
dd
delete line
5dd
Delete 5 lines from curser
d2w
Delete 2 words from curser
.
Repeat last change
These commands are done in command mode.

Open,C­losing and Saving

vim
Start Vim
Vim file.txt
Open Vim with file.txt
:q
Close Vim, without saving
:wq
Write file, then close
:wqa
Write and close all open files
:w
Write file
:w file.txt
Write file as file.txt (Save As)

Search, Replace

/
search forward
?
search backward
/hello
find
hello
in document
/chello
ignore case
/Chelloe
case sensitive
n
next instance
N
previous instance
:s/hel­lo/­bye/g
replace hello with bye on the current line
:s%/he­llo­/bye/g
replace hello with bye in the document
 

Spell Checking

:set spell
Turn on spell check
:set nospell
Turn off spell check
:set spell spelll­ang­=en_au
Sets specific spelling.
z=
select number for correct spelling
]s
next misspelt word
[s
Previous mispelt word
zg
add word to dictionary
Must be done in Visual mode

Shortcuts

\tm
Toggle table plugin
%
jump to matching braket
gx
Open URL under curser
za
Toggle fold
zc
close fold
zo
open fold
yyp
Yank line and paste below
\d
insert date
Need the below line in .vimrc for insert date to work.
nnoremap <Le­ade­r>d :r! date "+\%a \%d \%b \%Y"­<CR>