3

In my .vimrc I have :set number.

This window-local setting is applied for new windows (e.g., when running :split some_new_file).

However, when I open a help window with :help, there are no line numbers shown, with nonumber set.

I am curious why this is the case.

I don't see anything in ftplugin/help.vim that sets no line numbers.

What are the rules for window-local settings that are defined in .vimrc? Which new windows will these settings be applied for?

1 Answer 1

3

It turns out many (most?) options in a help buffer are actually hardcoded in the C source code for Vim itself.

See prepare_help_buffer() and the comments in that function that explain which settings are getting tweaked.

So what you're witnessing is pretty much a special case and it's pretty well hidden since you don't even get to search the Vim scripts for filetype "help" to find that setting, or to use :verbose to see where it's coming from.

In the general case, though:

What are the rules for window-local settings that are defined in .vimrc? Which new windows will these settings be applied for?

See :help option-summary, which will tell you that:

When creating a new window the option values from the currently active window are used as a default value for the window-specific options.

Your Answer

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

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