Vim / Neovim Cheatsheet
Vim modes, navigation, editing, buffers, search/replace, and window management.
Vim is a highly configurable text editor built around modal editing. The core idea: different modes for inserting text (insert mode) versus manipulating text (normal mode). Once the modal paradigm clicks, it becomes the fastest way to edit code.
This cheatsheet covers the essentials to be productive: navigation, editing, searching, buffers, splits, and tabs. Start in normal mode and build muscle memory gradually.
Modes & Basics
iEsc:w:q:wq or ZZ:e <file>Navigation
h j k lw / b0 / $gg / G%Editing & Clipboard
xddyyp / Pu / Ctrl+r.Search & Replace
/pattern?pattern:s/old/new/g:%s/old/new/g:%s/old/new/gcBuffers, Windows & Tabs
:sp <file>Ctrl+w w:bn / :bpVisual Mode
v / V / Ctrl+v> / <Vim / Neovim Cheatsheet
Vim modes, navigation, editing, buffers, search/replace, and window management.
Vim is a highly configurable text editor built around modal editing. The core idea: different modes for inserting text (insert mode) versus manipulating text (normal mode). Once the modal paradigm clicks, it becomes the fastest way to edit code.
This cheatsheet covers the essentials to be productive: navigation, editing, searching, buffers, splits, and tabs. Start in normal mode and build muscle memory gradually.
Modes & Basics
i — Enter insert mode before the cursor. Start typing immediately.Esc — Return to normal mode from any other mode.:w — Save (write) the current file.:q — Close the current window. Use :q! to force quit without saving.:wq or ZZ — Save and quit.:e <file> — Open a file for editing.Navigation
h j k l — Move cursor: left, down, up, right. No arrow keys needed.w / b — Move forward/backward by word (w = next word start, b = previous word start).0 / $ — 0 — jump to start of line. $ — jump to end of line.gg / G — gg — jump to first line. G — jump to last line. :42 — jump to line 42.% — Jump to matching bracket/paren/brace. Great for code navigation.Editing & Clipboard
x — Delete character under cursor. Like delete key.dd — Delete (cut) the current line. Saves to clipboard.yy — Yank (copy) the current line.p / P — Paste after / before the cursor.u / Ctrl+r — Undo / Redo.. — Repeat the last change. Extremely powerful for repetitive edits.Search & Replace
/pattern — Search forward for a pattern. n for next, N for previous.?pattern — Search backward for a pattern.:s/old/new/g — Replace all occurrences of old with new on the current line.:%s/old/new/g — Replace all occurrences in the entire file.:%s/old/new/gc — Replace globally with confirmation for each match.Buffers, Windows & Tabs
:sp <file> — Split window horizontally and optionally open a file.Ctrl+w w — Cycle focus between split windows.:bn / :bp — Switch to the next/previous buffer (open file).Visual Mode
v / V / Ctrl+v — Visual mode: v=character, V=line, Ctrl+v=block.> / < — Indent / dedent the selected lines in visual mode.