On line 1, jump to the # with f#, then press D to delete from the cursor to the end of the line.
total = price * quantity # TODO delete this trailing comment tax = total * 0.2
Canonical solution: f# D · par: 3 keystrokes (vimgolf rules — every keypress counts).
D is shorthand for d$ — delete to end of line. Its cousin C changes to end of line. Pair them with f/t jumps for precise strikes.
| Keys | What it does |
|---|---|
| D | delete to end of line |
| C | same, then enter insert mode |
| d0 | delete to the beginning of the line |
| f# D | jump to the # character, delete from there |
Reading about keystrokes doesn't build keystrokes. Try this in a real vim buffer right now — the “Kill the comment” mission takes about a minute.
Practice free — no signup →