vim Cheat Sheet

A Software › Vim cheat sheet in English by xcyberunicorn

vim editor cheat sheet

4,303 views 435 downloads 28 Apr 2025 History

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.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.