Live data from Hacker News

Numbers.vim - A vim plugin for better line numbers

github.com

11–20 of 21 posts

Re: Numbers.vim - A vim plugin for better line numbers

#11
post #4

Why is it better? And better than what?

There are two types of line numbering in vim, relative and absolute. The former counts the lines starting from the vertical position of the cursor, backwards and forwards. The latter starts at the top of the file to the bottom of the file.

Vim has several ways to move and edit a file. For example, to go to a specific line, you would use gg and you would jump to that line. This is useful for navigation as well as selection.

There are likewise commands that are relative from the cursor's position. dd and yy come immediately to mind, as well as the h-j-k-l commands. Knowing how many lines you need is augmented from the relative line numbering.

The key here is Vim doesn't have an easy way to switch from one to the other, except through manually typing commands like `set relativenumber` and `set number`. The plugin switches the number count based on what mode you are in.

Re: Numbers.vim - A vim plugin for better line numbers

#13
post #7

Can anybody tell me what relative numbers are useful for other than navigation? I find Easymotion the state-of-the-art plugin for navigation.

Yeah, easymotion does make counting words/lines seem rather redundant. I'm just hoping that they'll extend easymotion so I don't even need to think about what I'm jumping to i.e. I hit leader leader and every non-white character is indexed to jump to.

Re: Numbers.vim - A vim plugin for better line numbers

#19
post #18

You shouldn't ever have to count lines in vim. The five line deletion example could have been done as: 10dG Which would delete from the cursor to the tenth line.

d5j delete five from where you are- inclusive

This still means you would be counting 5 lines whereas I'm just specifying what line to delete to.
Post reply on HN