Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 305
Travis Avatar asked Jan 04 '12 16:01

Travis


People also ask

What would you put in your .vimrc file so that vim show line numbers by default?

Today we learned about permanent line number settings for the vim text editor. By adding the “set number” config directive in Vim configuration file named ~/. vimrc, we forced vim to show line numbers each time vim started.

How do I show numbers in vim?

Vim can display line numbers in the left margin: Press ESC key. At the : prompt type the following command to run on line numbers: set number. To turn off line numbering, type the following command at the : prompt set nonumber.


1 Answers

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.

like image 78
Benoit Avatar answered Oct 24 '22 06:10

Benoit