Cheatsheet Pages / Vim Cheatsheet

How to delete, copy and paste lines in Vim — dd, yy, p with counts

Whole-line surgery: delete, yank and paste, with counts to do several lines in one stroke.

Almost every entry was run headless in Vim 9.1 and the resulting file checked; the few entries a tiny build cannot run (system clipboard, persistent undo, the sudo save) were verified against Vim's own documentation instead.

x           " delete the character under the cursor
dd          " delete the whole line        yy  yank (copy) the whole line
p           " paste after / below          P   paste before / above
3dd         " delete 3 lines               2yy  yank 2 lines — counts work everywhere
Vim Cheatsheet one-page card — commands that actually work
The full one-page card — Vim Cheatsheet. Get the complete cheatsheet on GitHub