wiki
  • About
  • All posts
  • cv
  • portfolio

Vim_Cheatsheet - Mon, Jun 16, 2025

A very informative Vim cheat sheet.

Comprehensive Vim / Neovim Cheatsheet


1. Modes

ModeDescriptionHow to Enter
NormalCommand mode (default)Esc or start Vim
InsertInsert texti, a, I, A, o, O
VisualSelect textv (char), V (line), Ctrl+v (block)
Command-lineEnter commands (:):
ReplaceReplace modeR
SelectSelect mode (like Visual)gh

2. Basic Movement

CommandDescription
hLeft
jDown
kUp
lRight
0Beginning of line
^First non-blank character
$End of line
wNext word start
eEnd of word
bPrevious word start
ggGo to first line
GGo to last line
Ctrl + dScroll down half page
Ctrl + uScroll up half page
Ctrl + fScroll down full page
Ctrl + bScroll up full page
%Jump to matching bracket

3. Advanced Movement

CommandDescription
HTop of screen
MMiddle of screen
LBottom of screen
:nGo to line number n
fxFind next occurrence of x
FxFind previous occurrence of x
txMove before next x
TxMove before previous x
Ctrl + oJump to older position (jump back)
Ctrl + iJump to newer position (jump forward)

4. Editing Text

CommandDescription
iInsert before cursor
IInsert at beginning of line
aAppend after cursor
AAppend at end of line
oOpen new line below and insert
OOpen new line above and insert
r<char>Replace one character
REnter Replace mode
cwChange word
c$Change to end of line
ccChange (replace) entire line
sSubstitute character and enter insert mode
SSubstitute entire line and enter insert mode

5. Deleting Text

CommandDescription
xDelete character under cursor
XDelete character before cursor
dwDelete word
d$Delete to end of line
ddDelete entire line
d^Delete to beginning of line
DDelete to end of line
dGDelete from current line to end of file
dggDelete from current line to beginning of file

6. Copying & Pasting

CommandDescription
yy or YYank (copy) current line
ywYank word
y$Yank to end of line
pPaste after cursor
PPaste before cursor
"+yYank to system clipboard
"+pPaste from system clipboard

7. Visual Mode Commands

CommandDescription
vEnter visual (char) mode
VEnter visual line mode
Ctrl + vEnter visual block mode
yYank selected text
dDelete selected text
cChange selected text
>Indent selection
<Unindent selection
~Toggle case of selection

8. Undo / Redo

CommandDescription
uUndo last change
UUndo all changes on current line
Ctrl + rRedo undone change

9. Searching & Replacing

CommandDescription
/patternSearch forward for pattern
?patternSearch backward for pattern
nRepeat search forward
NRepeat search backward
*Search for word under cursor (forward)
#Search for word under cursor (backward)
:%s/old/new/gReplace all occurrences of ‘old’ with ’new’ in file
:%s/old/new/gcSame with confirmation
:nohRemove highlighting of search

10. Registers

CommandDescription
"ayyYank line into register a
"apPaste from register a
""Default register
"_Black hole register (discard)

11. Macros

CommandDescription
qaStart recording macro in register a
qStop recording
@aPlay macro in register a
@@Repeat last macro

12. Buffers & Files

CommandDescription
:e filenameEdit/open a file
:wSave current file
:waSave all open files
:qQuit current window
:q!Quit without saving
:wq or :xSave and quit
:bnext or :bnGo to next buffer
:bprev or :bpGo to previous buffer
:bdDelete (close) buffer

13. Windows (Splits)

CommandDescription
:split or :spHorizontal split
:vsplit or :vspVertical split
Ctrl + w sHorizontal split
Ctrl + w vVertical split
Ctrl + w wSwitch to next window
Ctrl + w h/j/k/lMove cursor between splits
Ctrl + w qClose current split
Ctrl + w =Make splits equal size

14. Tabs

CommandDescription
:tabnewOpen new tab
:tabcloseClose current tab
:tabnext or :tabnGo to next tab
:tabprev or :tabpGo to previous tab
gtGo to next tab
gTGo to previous tab

15. Marks & Jumps

CommandDescription
maSet mark a at cursor
`aJump to mark a (exact pos)
'aJump to mark a (start of line)
`Jump back to last jump position
Ctrl + oJump to older cursor position
Ctrl + iJump to newer cursor position

16. Ex Commands (colon commands)

CommandDescription
:wSave file
:qQuit
:wqSave and quit
:q!Quit without saving
:e filenameOpen file
:ls or :buffersList buffers
:set optionSet an option
:set nooptionDisable an option
:syntax onEnable syntax highlighting
:syntax offDisable syntax highlighting
:help keywordOpen help for keyword

17. Settings (common :set options)

OptionDescription
:set numberShow line numbers
:set relativenumberShow relative line numbers
:set nowrapDisable line wrapping
:set wrapEnable line wrapping
:set ignorecaseCase-insensitive search
:set smartcaseCase-sensitive if uppercase used
:set cursorlineHighlight current line
:set listShow invisible chars (tabs, eol)
:set tabstop=4Set tab width
:set shiftwidth=4Indentation width
:set expandtabConvert tabs to spaces
:set autoindentAuto-indent new lines
:set clipboard=unnamedplusUse system clipboard

18. Miscellaneous

CommandDescription
.Repeat last command
Ctrl + gShow file info
:!commandRun external shell command
:r filenameRead file content into current buffer
:diffsplit fileOpen file in diff mode

This cheatsheet covers a comprehensive range of Vim/Neovim commands and workflows to help you master the editor.


Back to Home


hugo.386 theme by Max le Fou | © stuffbymax|Martin Petik 2025 | MIT License

GitHub | YouTube | Source code | itch.io