Question

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?

Was it helpful?

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)

OTHER TIPS

AFAIK no... or you can check out vim and modify it's source code.

No, it's not possible because the line numbers are relative. First line below current line is rightly numbered 1 and so is the first line above current line.

Agree that you have to do that little math when you are working with commands like yy, dd etc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top