I have recently set the option
:set relativenumber
in my .vimrc
, and now when I open Taglist or NERDTree windows, the lines in those buffers are also numbered.
Is there a way to disable line numbers in the Taglist and NERDTree buffers (but keep them in all other buffers)?
Both NERDTree and TagList buffers have specific file types that help in distinguishing them from all the others. It is especially useful in auto-commands, since one can execute a command whenever the file type of a buffer is set to a specific value.
In this case, we need to switch off the relativenumber
option
whenever the file type of a buffer is nerdtree
or taglist
:
:autocmd FileType nerdtree set norelativenumber
:autocmd FileType taglist set norelativenumber
(Note that the relativenumber
option is local to a buffer and,
therefore, is switched off only in the current buffer.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With