Back to Cheatsheet Grid
Vim 13 Shortcuts

Vim Editor Cheatsheet

Terminal editor shortcuts: Normal/Insert/Visual modes, buffers, text objects, and custom macros.

File Operations & Modes

:wq

Write changes to file and quit editor.

:wq
:q!

Quit editor discarding all unsaved changes.

:q!
i / Esc

Switch between Insert mode (editing) and Normal mode.

Press "i" to type, "Esc" to exit insert mode
y / p

Yank (copy) selected text and paste it after the cursor.

Press "y" to copy, "p" to paste
dd / dw

Delete (cut) whole lines (dd) or current words (dw).

Press "dd" to cut line, "dw" to cut word

Navigation & Search

h / j / k / l

Move cursor left (h), down (j), up (k), or right (l).

Use arrow equivalents: h, j, k, l keys
0 / $

Move cursor directly to the start (0) or end ($) of the line.

Press "0" for start, "$" for end
gg / G

Jump to first line of file (gg) or last line (G).

Press "gg" to go to line 1, "G" to go to bottom
/[pattern]

Search file for matching pattern. Use "n" / "N" for next/prev.

/config.set

Advanced Editing

:%s/old/new/g

Search and replace all matches of "old" with "new" in file.

:%s/localhost/127.0.0.1/g
:%s/old/new/gc

Search and replace with confirmation prompts for each match.

:%s/foo/bar/gc
:vsplit [file]

Open a vertical window split containing the specified file.

:vsplit index.php
u / Ctrl+r

Undo (u) the last action or redo (Ctrl+r) the undone action.

Press "u" to undo, "Ctrl+r" to redo