开发者

How to stop Vim from opening a new window when opening file in readonly window?

开发者 https://www.devze.com 2023-01-08 13:45 出处:网络
I\'m using the MiniBufExplorer plugin to display a list of open buffers at the top of my Vim window. I\'m also using the FuzzyFinder plugin to open files, in case that matters.

I'm using the MiniBufExplorer plugin to display a list of open buffers at the top of my Vim window. I'm also using the FuzzyFinder plugin to open files, in case that matters.

The problem is that, if I have the -MiniBufExplorer- window focused, and I open a file, the window will split:

MMMMMM     MMMMMM
AAAAAA     AAAAAA    M = -MiniBufExplorer-
AAAAAA --> AAAAAA    A = some open file
AAAAAA     BBBBBB    B = the file I just opened
AAAAAA     BBBBBB

My guess is that Vim determines that the -MiniBufExplorer- window should not be used to open a file in, and decides to create a new window to hold the new buffer.

Instead, I want file B simply to be opened in the window previously occupied by A. If A's window has focus, this happens the way I want it to; it's just when -MiniBufExplorer-开发者_运维百科 is focused that I get the unwanted split.

I'm not proficient at Vim scripting, and not very familiar with the windowing/buffers model, so I don't know how difficult it is to accomplish this. Any ideas?


I don't think MiniBufExplorer plugin is good to use.

I find some bugs of this plugin. I delete this plugin now, try others.

PS: I don't use such plugins, just ctrl+o, ctrl+i :)

when open many files, this plugin is useless.


You can make an abbreviation for command-line mode like this:

cabbrev ne new +only

what this does is to make an alias, then when you type ne vim executes new +only. new +only creates a new document and executes only on it which results in a full window new document.

You'd better put that on your .vimrc and to prevent a remap you use cnoreabbrev

cnoreabbrev ne new +only

0

精彩评论

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