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?
To show line numbers in Vim, use the :set number command for absolute line numbers, :set relativenumber for relative line numbers. If both absolute and relative line numbers are enabled Vim switches to the hybrid line numbering mode.
Vim can display line numbers in the left margin: Press ESC key. At the : prompt type the following command to run on line numbers: set number. To turn off line numbering, type the following command at the : prompt set nonumber.
Relative line numbers The current line is marked 0, the ones above and below it are marked 1, and so on. " turn relative line numbers on :set relativenumber :set rnu " turn relative line numbers off :set norelativenumber :set nornu " toggle relative line numbers :set relativenumber! :set rnu!
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With