Hacker News new | ask | show | jobs
by justinvh 4725 days ago
I was at one point very interested in the same idea. I wanted relative line numbers and absolute line numbers integrated together. So, I created a patch, called it `dnu` for "dual line numbering", and sent the suggestion to Bram Moolenaar.

Here's what it looked like: http://i.imgur.com/NTwwB.jpg

Here was the patch. I wrote it back in 2011: https://code.google.com/r/justinvh-vim/source/detail?r=c2479...

Ultimately Bram Moolenaar sent me a reply:

"""

Justin,

I think the audience for this would be too small.

- Bram

"""

However, in 7.3.787 (Jan 2013) a patch was introduced which showed the current line number in :rnu instead of 0. That's definitely in the direction that this patch was going in.

So, I didn't get a patch in, but on the plus side, I did learn a bunch about vim's source code.

3 comments

This looks quite useful to me.

Feature request: allow the user to select separate colors for the relative and absolute line numbers, and for the slash. So three separate colors in total. That would make it easier to read.

Another idea is to have relative line numbers on the left side of the screen, and absolute line numbers on the right (or vice-versa).

I would love to take feature requests, but it's honestly not maintained. Don't get me wrong, it wouldn't be hard to reintegrate it with the current release, but I believe the idea should be at least approximated with vimscripts rather than making someone build a custom vim release to support this feature alone. Plus, now :rnu sort-of mimics this functionality by showing the current line number on the 0th row, instead of '0'.

On a side note, to your second request of left-side/right-side splits for line numbers: my first experimentation was to do just that. Left side was rnu and right side was nu, but the way vim's buffers work out, it wasn't very practical. It also caused headaches for rtl text and so on if I remember correctly.

I just wrote to the mailing list about that patch... it slows vim down so much, it makes the feature entirely unusable :( I wish the old way was back.
In my vim doesn't show the 0 instead it shows the line number you're currently on. Seems somewhat what you suggested.
Indeed it does! However, that didn't come around until vim 7.3.787 was introduced. That was on 30-Jan-2013. I wrote this patch back in 2011.