How do I configure .vimrc so that line numbers display in netrw in Vim?
Asked Answered
R

1

26

I'm using netrw to read directory listings in Vim, and I would like to display line numbers in my netrw tabs (so I can use :24 to navigate through directory listings faster). I'm using "set number" in my vimrc to enable line numbers when editing files, but this does not display line numbers in netrw.

When in netrw, if I type the command ":set number", the line numbers display, but as soon as I change directories the line numbers go away.

Is there a configuration option I can put in .vimrc that will make line numbers show up in netrw windows?

Roderic answered 4/1, 2012 at 16:57 Comment(0)
G
40

From autoload/netrw.vim in the runtime:

call s:NetrwInit("g:netrw_bufsettings" , "noma nomod nonu nobl nowrap ro")

s:NetrwInit overrides a variable only if it is not defined.

Therefore put let g:netrw_bufsettings = 'noma nomod nu nobl nowrap ro' into your vimrc and it should be ok.

Gouge answered 4/1, 2012 at 17:26 Comment(1)
You have a typo in your vimrc, missing the underscore in "g:netrw_bufsettings", but thanks - that's exactly what I needed.Roderic

© 2022 - 2024 — McMap. All rights reserved.