Show Menu
Cheatography

Vi Editor Cheat Sheet

file

:q
quit
:w
write changes
:q!
quit without write changes
:wq
write changes and quit
:w file
write changes to new file
:tabnew file
open file in a new tab
:split file
open file in new horizontal split

navigation

h|j|k|l
left|d­own­|up­|right
w|b
start of next|p­revious word
0|$
beginn­ing|end of line
gg|G
first|last line of file
:n
go to line number n
gt|gT
go to next|p­revious tab
ctrl+w w
cycle through splits
/pattern
search for pattern
n|N
go to next|p­revious match

edit

i
insert
x
delete character under cursor
daw
delete word under cursor
dd
delete entire line
d0|$|gg|G
delete from cursor
y
copy character under cursor
yaw
copy word under cursor
yy
copy entire line
y0|$|gg|G
copy from cursor
p
paste after cursor
~
toggle case of character under cursor
:s/old­/new/g
replace all(g) occurr­ences of old with new on current line
:%s/ol­d/new/g
replace all(g) occurr­ences of old with new in entire file
:n,m<c­omm­and>
apply command between lines n,m
u
undo
ctrl+r
redo
 

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
          Vim Cheat Sheet