0

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?

Kartik Podugu
  • 144
  • 1
  • 5

1 Answers1

0

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.

Parker Tailor
  • 1,290
  • 13
  • 12
  • Thanks for response. But, i don't find the files mentioned anywhere. – Kartik Podugu Oct 05 '22 at 16:31
  • @KartikPodugu You will have to create them. The `~/.vim` directory is your home directory where you can place custom configuration and initialisation options. Try `:help VIMINIT` for more info – Parker Tailor Oct 06 '22 at 03:25