Skip to main content
replaced http://vi.stackexchange.com/ with https://vi.stackexchange.com/
Source Link

I knew this site would teach me more about my beloved vim :-) In posting a question/answer on how to delete large blocks without having to count lineshow to delete large blocks without having to count lines, one of the answers taught me something I didn't know, that being relative line numbers along the lines of:

 2 This is line 1 1 This is line 2 3 This is line 3, the current line. 1 This is line 4. 2 Line 5. 3 Line 6. 

Now, if you wanted to delete lines 3, 4 and 5, you can simply add one to the relative line number (2) and use that to set the count, the command being 3dd.

However, adding one seems a bit obscure so I was wondering if you could configure the line numbers in relative mode to be more like this:

 2 This is line 1 1 This is line 2 3 1 This is line 3, the current line. 2 This is line 4. 3 Line 5. 4 Line 6. 

That way you could simply transcribe the number into the command without having to think about it.

I knew this site would teach me more about my beloved vim :-) In posting a question/answer on how to delete large blocks without having to count lines, one of the answers taught me something I didn't know, that being relative line numbers along the lines of:

 2 This is line 1 1 This is line 2 3 This is line 3, the current line. 1 This is line 4. 2 Line 5. 3 Line 6. 

Now, if you wanted to delete lines 3, 4 and 5, you can simply add one to the relative line number (2) and use that to set the count, the command being 3dd.

However, adding one seems a bit obscure so I was wondering if you could configure the line numbers in relative mode to be more like this:

 2 This is line 1 1 This is line 2 3 1 This is line 3, the current line. 2 This is line 4. 3 Line 5. 4 Line 6. 

That way you could simply transcribe the number into the command without having to think about it.

I knew this site would teach me more about my beloved vim :-) In posting a question/answer on how to delete large blocks without having to count lines, one of the answers taught me something I didn't know, that being relative line numbers along the lines of:

 2 This is line 1 1 This is line 2 3 This is line 3, the current line. 1 This is line 4. 2 Line 5. 3 Line 6. 

Now, if you wanted to delete lines 3, 4 and 5, you can simply add one to the relative line number (2) and use that to set the count, the command being 3dd.

However, adding one seems a bit obscure so I was wondering if you could configure the line numbers in relative mode to be more like this:

 2 This is line 1 1 This is line 2 3 1 This is line 3, the current line. 2 This is line 4. 3 Line 5. 4 Line 6. 

That way you could simply transcribe the number into the command without having to think about it.

Source Link
user579
user579

Can relative number be changed so that current line is 1?

I knew this site would teach me more about my beloved vim :-) In posting a question/answer on how to delete large blocks without having to count lines, one of the answers taught me something I didn't know, that being relative line numbers along the lines of:

 2 This is line 1 1 This is line 2 3 This is line 3, the current line. 1 This is line 4. 2 Line 5. 3 Line 6. 

Now, if you wanted to delete lines 3, 4 and 5, you can simply add one to the relative line number (2) and use that to set the count, the command being 3dd.

However, adding one seems a bit obscure so I was wondering if you could configure the line numbers in relative mode to be more like this:

 2 This is line 1 1 This is line 2 3 1 This is line 3, the current line. 2 This is line 4. 3 Line 5. 4 Line 6. 

That way you could simply transcribe the number into the command without having to think about it.