skeept
skeept

Reputation: 12413

How to disable line numbering in taglist window in Vim?

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)?

Upvotes: 8

Views: 1518

Answers (1)

ib.
ib.

Reputation: 28944

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.)

Upvotes: 9

Related Questions