Vim 7.3 introduced a very nice feature – relative line numbers. In vim we normally use count(n) with any operator(o) to repeat the operation o, n number of times. For example – if one wants to delete next 7 lines including the current line one could issue command ’7dd’. ‘dd’ deletes the current line and ’7dd’ would delete next 7 lines including the current line. But I was rarely able to use this feature till Vim 7.2. It’s difficult to count the number of lines on screen and its time taking. So I would better use the operator ’0′, ‘n’ number of times or use some other alternative. Now in Vim 7.3 there is a very nice feature relative line numbers – The line on which you are present is numbered as 0 and numbers increase downwards and upwards. Here’s a screenshot to illustrate -
In the screenshot above you can notice that line number 0 is the one on which the cursor is located. Line number increases upwards and downwards. Now it is easy to count number of lines both upwards and downwards. So now I can easily find how many lines I have to delete or copy from the present line. I have started using count with operators.
To switch on this feature enter the command “:set rnu” and to switch off this feature enter the command “:set nornu”.