vimline-numbers

vim: display relative linenumbers starting with 1


In vim, I like using relative linenumbers to see how many lines I need to yank, delete, whatever.

However, when using relative linenumbers, the current line is 0, which means, if I want to yank until the line with number 3, I have to type 4yy, which is sort of counterintuitive and is slowing me down.

Is there a way to display relative linenumbers starting with 1 instead of 0?


Solution

  • I'd say, work with the system. Instead of using a 'repeat' you could modify to use the motion as intended:

    y3j instead of 4yy

    You'll notice that the yank command takes a motion. yy is only there as a shorcut should you not want a motion (by definition it takes the current line).

    In a sense, doing 4yy is a little bit akward ('4times' take this whole line; You are relying on the fact that the implict motion is effectively multiplied by the repeat, it isn't natural since the motion was implicit).

    On the plus side, you could even combine it: 4d3j (delete 3linesdown 4 times in a row, not a very useful example)