Cheat Sheets

Vim Cheat Sheet

Quick reference for Vim commands — from basic motions and insert mode to search, replace, macros, and managing multiple files.

Move. Edit. Repeat.

Motions (Horizontal)
h j k lStart of lineFirst non-blankEnd of linePrevious wordNext wordEnd of wordFind characterFind back
Motions (Vertical)
Half page up/downFull page up/downFirst lineLast lineGo to line nNext empty linePrevious empty lineScreen top/mid/botCenter current line
Insert Mode
Insert before cursorInsert after cursorInsert start of lineInsert end of lineNew line belowNew line aboveDelete char & insertDelete line & insertChange to end of lineLast insert pointExit insert mode
Save & Exit
SaveQuitSave and quitForce quitSave and quit allClose allForce quit allSave to fileSave asWrite readonly file
Editing (Normal Mode)
Replace characterReplace modeUndoUndo lineRedoJoin linesRepeat last command
Cut, Copy & Paste
Delete characterDelete wordDelete lineDelete to endYank (copy) linePaste afterPaste beforeSwap charactersSwap linesYank to clipboardPaste from clipboard
Visual Mode
Visual modeVisual line modeVisual block modeSelect allIndent selectionOutdent selectionDelete selectionYank selection
Operators
d — deletey — yankc — change= — formatgU — uppercasegu — lowercaseCount prefix
Text Objects
Inner wordAround wordInner quotesAround quotesInner bracketsAround bracketsInner paragraphInner tagChange inner wordChange inner quotesDelete inner wordDelete in quotes
Search
Search forwardSearch backwardNext matchPrevious matchSearch current wordSearch word backCase insensitiveRegex searchClear highlights
Search & Replace
Replace first (line)Replace all (line)Replace with confirmReplace first (file)Replace all (file)Replace (confirm)Replace (ignore case)Replace in range
Macros
Record macroStop recordingRun macroRun macro n timesRepeat last macro
Buffers
Edit fileNext bufferPrevious bufferDelete bufferList buffersGo to bufferSplit openVertical split open
Windows
Split horizontalSplit verticalSwitch windowClose windowMove left/rightMove up/downEqual sizeSwap windows
Tabs
New tabClose tabClose other tabsList tabsNext tabPrevious tabGo to tab n
Marks
Set markJump to markJump to mark lineLast insert positionLast changeList marksDelete mark
Folds
Open foldClose foldToggle foldOpen all foldsClose all folds
Miscellaneous
Toggle caseUppercase wordLowercase wordIncrease numberDecrease numberGo back (jump)Go forward (jump)Go to fileHelpReload fileOpen terminalSort linesShell commandInsert command outputDelete lines matchingDelete blank lines