简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM