Relative number in vim

vim

Solution

It's the expected behavior. From `:help number_relativenumber`

The 'relativenumber' option changes the displayed number to be
relative to the cursor.  Together with 'number' there are these
four combinations (cursor in line 3):

        'nonu'          'nu'            'nonu'          'nu'
        'nornu'         'nornu'         'rnu'           'rnu'

    |apple          |  1 apple      |  2 apple      |  2 apple
    |pear           |  2 pear       |  1 pear       |  1 pear
    |nobody         |  3 nobody     |  0 nobody     |3   nobody
    |there          |  4 there      |  1 there      |  1 there

Problem

I noticed a strange behavior in vim regarding the relative numbers: :set nu ``` 1 2 3 _ 4 5 6 ~ ``` :set relativenumber ``` 2 1 3 _ 1 2 3 ~ ``` :set nonu ``` 2 1 0 _ 1 2 3 ~ ``` I was asking myself why sometime I see the absolute current line number and sometime I see 0 which is pretty useless. Is this behavior normal and how to correctly `number` and `relativenumber`?

Original source