Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent opening files inside NERDTree or MiniBuffExplorer windows in Vim

Tags:

vim

I find myself opening files inside the wrong window in Vim — sometimes the NERDTree or MiniBuffExplorer — and it’s really throwing me off.

I’m sure it’s happening because my cursor is mistakenly focused inside one of these windows, but is there anything I can add to my .vimrc file to prevent this from happening?

like image 712
Jon Avatar asked Aug 18 '10 16:08

Jon


1 Answers

I finally found the solution to this annoyance in the MiniBufExplorer source comments. It looks like this feature has been available since version 6.2.8 (release 2004-06-07):

If you use other explorers like TagList you can (As of 6.2.8) put:

let g:miniBufExplModSelTarget = 1

into your .vimrc in order to force MBE to try to place selected buffers into a window that does not have a nonmodifiable buffer. The upshot of this should be that if you go into MBE and select a buffer, the buffer should not show up in a window that is hosting an explorer.

like image 84
Johann Avatar answered Nov 14 '22 22:11

Johann