How to use relative line numbering universally in

2020-08-20 08:36发布

问题:

I love the relative line numbering feature in Vim 7.3, but am having trouble making it stick universally. For many files, line numbering reverts to absolute mode, even though I have specified:

set rnu

in my .vimrc file. Any idea what could be causing this? I am using Vim 7.3 on OSX 10.6, with the Janus package of extensions.

回答1:

Try using :verbose set rnu? and :verbose set nu? to find the script that is causing the problem.



回答2:

Add this to your .vimrc.after:

set nonumber

set relativenumber

Relative line numbers should persist with these settings.



回答3:

Try putting set rnu at the very end of your .vimrc. Relative numbering is mutually exclusive with absolute numbering. I suspect Janus is trying to be smart and sets absolute numbering for some filetypes.