0% found this document useful (0 votes)
343 views2 pages

Vim Cheat Sheet - English

Vim provides commands for efficient cursor movement, editing, cutting/pasting, searching/replacing text, working with multiple files across tabs and buffers, and more. Common commands include hjkl to move the cursor, i/a to insert text, dd to delete lines, / to search, :wq to save and exit, and :tabnew to open files in new tabs.

Uploaded by

tuxaanand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
343 views2 pages

Vim Cheat Sheet - English

Vim provides commands for efficient cursor movement, editing, cutting/pasting, searching/replacing text, working with multiple files across tabs and buffers, and more. Common commands include hjkl to move the cursor, i/a to insert text, dd to delete lines, / to search, :wq to save and exit, and :tabnew to open files in new tabs.

Uploaded by

tuxaanand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

VimCheatSheet

Cursormovement

hmovecursorleft
jmovecursordown
kmovecursorup
lmovecursorright
wjumpforwardstothe
startofaword

Wjumpforwardstothe

Editing

rreplaceasingle
character

Jjoinlinebelowtothe
currentone

Cutandpaste

yyyank(copy)aline
2yyyank(copy)2lines
ywyank(copy)word

previousbuffer

cwchange(replace)tothe

pput(paste)theclipboard

:bddeleteabuffer(close

aftercursor

afile)

gtor:tabnextor
:tabnmovetothenext

Pput(paste)beforecursor

:spfilenameopenafile

endoftheword

substitutetext

Ejumpforwardstotheend

Sdeletelineandsubstitute dwdelete(cut)word

0jumptothestartofthe
line

^jumptothefirstnon

blankcharacteroftheline

$jumptotheendofthe
line

Ggotothelastlineofthe
document

5Ggotoline5
fxjumptonext

occurrenceofcharacterx

txjumptobeforenext

occurrenceofcharacterx

}Jumptonextparagraph
(orfunction/block,when
editingcode)

{Jumptoprevious

paragraph(or
function/block,when
editingcode)
Insertmode
inserting/appendingtext

iinsertbeforethecursor
Iinsertatthebeginningof

endoftheline

text(sameascc)

xptransposetwoletters
(deleteandpaste)

uundo
Ctrl+rredo
.repeatlastcommand
Markingtext(visualmode)

vstartvisualmode,mark

dddelete(cut)aline

inanewbufferandsplit
window

2dddelete(cut)2lines

:vspfilenameopenafile

Ddelete(cut)totheendof
theline

d$delete(cut)totheend
oftheline

xdelete(cut)character
Exiting

:wwrite(save)thefile,but
don'texit

lines,thendoacommand
(likeyyank)

:wqor:xorZZwrite

Vstartlinewisevisual

:qquit(failsifthereare

mode

omovetootherendof
markedarea

(save)andquit

unsavedchanges)

:q!orZQquitandthrow
awayunsavedchanges

Ctrl+vstartvisualblock Searchandreplace
mode
/patternsearchfor
Omovetoothercornerof
pattern
block

awmarkaword
abablockwith()

?patternsearch

backwardforpattern

\vpattern'verymagic'

ibinnerblockwith()

pattern:nonalphanumeric
charactersareinterpretedas
specialregexsymbols(no
escapingneeded)

iBinnerblockwith{}

nrepeatsearchinsame

aBablockwith{}

Escexitvisualmode
Visualcommands

>shifttextright

direction

Nrepeatsearchinopposite
direction

:%s/old/new/g

theline

<shifttextleft

replacealloldwithnew
throughoutfile

ainsert(append)afterthe

yyank(copy)markedtext

:%s/old/new/gc

cursor

Ainsert(append)atthe
endoftheline

oappend(open)anew

linebelowthecurrentline

Oappend(open)anew

lineabovethecurrentline

eainsert(append)atthe
endoftheword

Escexitinsertmode

Ctrl+wTmovethe

line

ofaword

startofaword(wordscan
containpunctuation)

nextbuffer

fileinanewtab

line

sdeletecharacterand

Bjumpbackwardstothe

:bnextor:bngotothe

currentsplitwindowintoits
owntab

ejumpforwardstotheend

startofaword

:efilenameeditafileina :tabnewfilenameor
newbuffer
:tabnfilenameopena

:bprevor:bpgotothe

c$change(replace)tothe

bjumpbackwardstothe

Tabs

ccchange(replace)entire y$yank(copy)toendof

startofaword(wordscan
containpunctuation)

ofaword(wordscancontain
punctuation)

Workingwithmultiplefiles

ddeletemarkedtext
~switchcase

replacealloldwithnew
throughoutfilewith
confirmations

inanewbufferand
verticallysplitwindow

Ctrl+wssplitwindow
Ctrl+wwswitch
windows

Ctrl+wqquitawindow
Ctrl+wvsplitwindow
vertically

tab

gTor:tabprevor
:tabpmovetothe
previoustab

#gtmovetotabnumber
#

:tabmove#move

currenttabtothe#th
position(indexedfrom0)

:tabcloseor:tabc

closethecurrenttabandall
itswindows

:tabonlyor:tabo

closealltabsexceptforthe

Ctrl+whmovecursorto currentone
theleftwindow(vertical
split)

Ctrl+wlmovecursorto
therightwindow(vertical
split)

Ctrl+wjmovecursorto
thewindowbelow
(horizontalsplit)

Ctrl+wkmovecursorto
thewindowabove
(horizontalsplit)

You might also like