In Vim I am using relative line numbering and in my .vimrc have highlight CursorLineNr ctermfg=LightGray
to make the current line number stand out a bit more.
I was wondering if it's possible to also change the alignment of the current line number? By default it's aligned to the left, but I would like to have it align to the right like the other numbers.
The combination of number
and rnu
option will change the display of line numbers. If you have nonu
and rnu
, then the current line number will be aligned with other (relative) line numbers, however, the current line number shows always 0
.
If you enable both nu
and rnu
, you got the display style as your screenshot. This cannot be changed.
For detail, pls check
:h number_relativenumber
Related info:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With