Show Menu

Vim Cheat Sheet by

Vim Keys
vi     editor     vim     text

Navigation - Basic

h
move left
l
move right
j
move down
k
move up

Navigation - Word

e
end of current word
b
previous word
w
next word
Can use caps to use \S instead of \w as boundary

Number Power!

[numbe­r][­mov­ement]
Same as pressing [movement] [number] times
[numbe­r]i­[text] <ES­C>
Insert [text] [number] times

Navigation - Screen

ctrl + d
move down a half screen
ctrl + u
move up a half screen
gg
move to top of file
G
move to bottom of file
NG
move to Nth line

Navigation - Search

/[pattern]
next occurrence of [pattern]
?[pattern]
previous occurrence of [pattern]
*
next occurrence of word under cursor
#
previous occurrence of word under cursor

Navigation - Special

t{char}
move before {char}
f{char}
move onto {char}
%
move to matching parent­heses
0
move to start of line
$
move to end of line

Visual Modes

v
select from cursor begin to end by character
V
select from cursor begin to end by line
<CT­RL>v
select from cursor begin to end by column, character
 

Commands - Regex

:%s/pa­tte­rn/txt/
replace first pattern of each line with 'txt
:%s/pa­tte­rn/­txt/g
replace each pattern of each line with 'txt'
:%s/pa­tte­rn/­txt/gc
confirm replace of each pattern of each line with 'txt'
'/' used above is only a sample, and can be any character (:s@fo­o@bar@)

Commands - Basic

:w
save
:q
quit
:wq
save and quit

Commands - Inserting Text

a
append text after cursor
A
append text at end of line
i
insert text before cursor
I
insert text at beginning of line
o
begin new line below cursor
O
begin new line above cursor

Commands - Changing Text

r
replace character under cursor
R
enter insert mode and replace characters
c{navi­gation}
change until {navig­ation}

Commands - Deleting Text

x
delete character after cursor
X
delete character before cursor
dd
delete line
D
delete to end of line

Commands - Copying Text

y{motion}
yank {motion} text
yy
yank line
p
put text after cursor
P
put text before cursor

Download the Vim Cheat Sheet

1 Page
//media.cheatography.com/storage/thumb/nuggles_vim.750.jpg

PDF (recommended)

Alternative Downloads

Share This Cheat Sheet!

 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          VI Editor Cheat Sheet
          Intermediate Vim Cheat Sheet

          More Cheat Sheets by Nuggles

          Shortcuts Cheat Sheet
          Vimium Shortcuts Cheat Sheet
          UltiSnips Cheat Sheet