Show Menu
Cheatography

vim 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
:e file
edit file
:tabnew file
edit file in a new tab
:split file
edit 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
/{s­tr­i­ng}
search matching string
n|N
go to next|p­revious matching string

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/{pa­tte­rn}­/{s­tri­ng}/gc
replace new with old in all matches(g) and confirm(c)
:.[cmd]
apply command to current line
:n,m[cmd]
apply command between lines n,m
:%[cmd]
apply command to all lines
:g/{pa­­tt­e­r­n}­­/[cmd]
apply command to all lines that contain pattern
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 NERDTree Cheat Sheet
          Helix Keyboard Shortcuts

          More Cheat Sheets by xcyberunicorn

          configurations Cheat Sheet