Skip to content

Comment on Better line numbers for Vim

Comments

In the video, the author moves a block of code by: 1. going to the start of the code block 2. changing mode to visual 3. moving to the end of the block 4. deleting the block 5. moving to the insertion point 6. inserting the delete buffer

I'd like to suggest that using absolute line numbers shortens this considerably. For example

:43,48m63

removes lines 43 to 48 and inserts them after line 63 regardless of the current cursor position (no need to move cursor).

Not saying relative line numbers are bad, just, there's a quicker way, at least for the demo use case.

Actually, he was in normal mode and issued

    5dd
at the start of the block.

You are technically correct, but coming up with those magic numbers(43, 48, 63) requires the user to manually try and find them, is more error-prone, and requires a whole lot more keypresses for larger blocks that don't fit on one screen.

I would argue that the author's way is the more idiomatic usage of vim.

idiomatic shmidiomatic, give me faster always!

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.