Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable line numbering in taglist window in Vim?

Tags:

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

like image 923
skeept Avatar asked Sep 23 '10 03:09

skeept


1 Answers

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

like image 72
ib. Avatar answered Sep 26 '22 00:09

ib.