Learn Vim / Fence off the block — vim

Fence off the block — vim

The answerCanonical keystrokes: j ma 3j d'a.

Try it on a real buffer

Delete the whole marked block. Move to the first CUT line (j) and set mark a (ma). Drop to the last CUT line (3j), then delete everything from here back to the mark with d'a.

keep the header
CUT this line
CUT this one too
CUT and this one
CUT the last of them
keep the footer

Canonical solution: j ma 3j d'a · par: 8 keystrokes (vimgolf rules — every keypress counts).

Why it works

'a (single quote) is the LINE of mark a; `a (backtick) is the exact position. Operators take marks as motions: d'a deletes linewise from the cursor to the mark — a surgical “delete from here to there”.

Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Fence off the block” mission takes about a minute.

Practice free — no signup →

Keep going