How to automatically enable line numbers in gvim netrw

204 views Asked by At

In my .vimrc file located in my home directory, I have already added set nu and every time I open a file in gvim, I get line numbers displayed at the extreme left.

But whenever I open a folder in gvim using :Vex (vertical split and open explorer) or :Te(open a new tab with explorer) commands or for that matter open a directory using gvim, I don't see line numbers, in spite of having set nu in my .vimrc and I have to again do :set nu manually.

I am using cent os 7 and netrw 149 and vim 7.4

How to get line numbers always whenever I open explorer using netrw in gvim?

1

There are 1 answers

2
Parker Tailor On

Assuming your vim directory is ~/.vim, You could try adding

set nu

in ~/.vim/after/ftplugin/netrw.vim

ftplugin files are loaded every time a buffer is opened with the corresponding filetype. In this case the filetype is netrw so the file is called netrw.vim. You can check the file type of any buffer with :echo &filetype.