开发者

Prevent opening files inside NERDTree or MiniBuffExplorer windows in 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 .开发者_JAVA百科vimrc file to prevent this from happening?


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.


It's possibly related to the setting of mousefocus. From :help mousefocus

The window that the mouse pointer is on is automatically activated. When changing the window layout or window focus in another way, the mouse pointer is moved to the window with keyboard focus. Off is the default because it makes using the pull down menus a little goofy, as a pointer transit may activate a window unintentionally.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜