When viewing a directory (using :Explore, for example), I would like to see line numbers. I can run :set number after opening the directory, and that works, but I can't get numbering to turn on by default (using e.g. configuration in my .vimrc file).

I have tried adding variations of the following to my .vimrc file, but none seem to work:

:autocmd FileType netrw set number
:autocmd FileType * setlocal number
:autocmd BufEnter * setlocal number

Here is a reference to a similar question regarding numbering for help files. The solution to that question does not work in this case.

1 Answer 1


According to :help netrw:

 *g:netrw_bufsettings*  the settings that netrw buffers have
            (default) noma nomod nonu nowrap ro nobl

So I would try

let g:netrw_bufsettings = 'noma nomod nu nowrap ro nobl'

This can also be found at :help netrw-P19

  • This works. Thanks very much! When all else fails, read the instructions I suppose.
    – Jasha
    Commented May 5, 2019 at 3:38

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.