I'm trying to find a way to show relative line numbers as well as absolute line numbers, but not the way hybrid line numbers does it.

I want to see both at all times, probably each displayed on a column. Is this possible?

  • 3
    No, it's not possible
    – 3N4N
    Apr 11, 2019 at 0:10
  • Why not? I'm new to vim, so forgive me if I'm missing something super obvious, but if plugins such as Airline and Lightline can write a whole line to the bottom of the buffer, why wouldn't another plugin be able to write a (few) column(s) on the left?
    – sleighty
    Apr 11, 2019 at 0:27
  • 2
    Airline or Lightline make clever use of the Vim option statusline (`:help 'statusline'). They don't draw the line by them self, it is drawn by Vim. There is no such option or other api for line numbers.
    – Ralf
    Apr 11, 2019 at 4:21
  • Just to remind you, there is no other editor that I know of that provides you two line number columns. Most people I know don't even use line numbers in vim, period. But that's opinion based talks. For your answers, you can add line numbers directly to your buffer and remove them prior to and re-add them after writing the buffer to disk. OR you can just enter the diff mode for the current buffer and enable :set nu in one window while enabling :set rnu in another. Then just resize the windows. But all this is really ridiculous solution to a problem which in itself is ridiculous.
    – 3N4N
    Apr 15, 2019 at 6:06
  • 1
    @klaus I use vscode and have vim emulation plugin. I have two columns, one with absolute line numbers and the other with relative line numbers. In relative line numbers column, I also have hybrid line number for the line I am currently on. Its best of 3 worlds. Only sad thing is this doesnt work in raw vim or other ide like intellij(with vim emulation plugins) May 22, 2020 at 20:25

3 Answers 3


Take a look at this answer. You can use RltvNmbr to display the relative line numbers while Vim displays the absolute ones.


There is no way to have both absolute and relative numbers being displayed by Vim.

What you can do however, is to (ab)use the sign feature and display the relative numbers there. Note, since the sign column is limited to 2 characters, it won't work on very long windows with more than 100 lines.

There are a couple of plugins that enable it. The already mentioned RltvNmbr.vim from Dr. Chip, which was used to enable relative line numbering before that feature was available in Vim natively (around Vim 7.3 I believe). An alternative is to use my plugin DynamicSigns. This allows to flexible define what kind of signs will be drawn and when. Have a look at the example from this answer

Also, the sign column needs to be updated very often, which might impose a performance penalty. My DynamicSigns plugin tries to update the sign column as often as needed, but it might still be noticeable, if you scroll a lot. There is not much that can be done against it.


As Steven Fontanella said, you could use plugins to accomplish this.

But Vim brings you more than that.

First, I think you should consider your needs.

Why both at the same time ?

  • you could use :set rnu and :set nornu to toggle the relative line number when you need. You could even write a piece of vimscript and bind to a shortcut to toggle the relative line number. So that when you need to see each of the line number, you can simplly toggle it. I guess you don't really need to see the both at the same time, because they don't related with each other numerically.
  • If what you need is for movement between the lines, you could do it with either of the relative line number or the line number, because they just act as two different ways. For instance, your cursor is at line 8, you want to go line 16, you can either by using :16+enter (which is the ed way), or by 8+j (8 lines after) . It depends on which type of line number you are using.

Most vim functions will provide possiblity to use either of the line number style. You can rely on Vim's :help for more information, research what you really need and find & read it, you will be benefited by this. Just as the author of Vim Bram Moolenaar said:

  1. Detect inefficiency
  2. Find a quicker way
  3. Make it a habit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.