sillypenguin
sillypenguin

Reputation: 129

how to disable some features in some specific window in vim?

here is my problem:
i'm using taglist and nerdtree.and set quickfix window displayed no matter if it has context. and in my vimrc, i set them toggled in a fixed order, so i can get a layout i want.
but when i use C-o, C-i, C-], it will jump to a file, and if i want the features of taglist and nerdtree i should quit it and open it again.
but it will break the layout i want. so i have to quit all and open the file again.

so, is it possible to desable some features in some specific window?

thanks for any help.:)

Upvotes: 1

Views: 165

Answers (1)

Ingo Karkat
Ingo Karkat

Reputation: 172698

You can disable certain commands for buffers via :map <buffer>; for sidebar windows like from NERDTree, that's good enough, as they always display the same (scratch) buffer. For example, to disable <C-O> in NERDTree:

:autocmd FileType nerdtree nnoremap <buffer> <C-o> <Nop>

I don't fully understand your question, but another approach (as it is hard to fully control where Vim places new buffer contents) would be to extend your "build your window layout" function from your .vimrc to first clean up any existing NERDTree / TagBar windows, so that you can call it later on (e.g. via a mapping) to "fix up" your layout again.

Upvotes: 1

Related Questions