vim - 当我切换 minibufexplorer 时,如何在 nerdtree 打开时停止调整窗口大小

标签 vim nerdtree minibufexplorer

我的 .vimrc 设置:

nmap <silent><F1> :NERDTreeToggle<CR>
nmap <silent><F2> :TMiniBufExplorer<CR>
let g:miniBufExplMapWindowNavVim = 1
let g:NERDTreeWinPos = "right"

首先它看起来像:
--------------------------
| minibufexplorer   |    |
---------------------    |
|                   |    |
| top               |    |
|                   |    |
---------------------NERD|
|                   |    |
| btm               |    |
|                   |    | 
--------------------------

接下来当我按 F2 时,minibufexplorer 被切换:
--------------------------
|                   |    |                  
|                   |    |
| top               |    |
|                   |    |
---------------------NERD|
|                   |    |
| btm               |    |
|                   |    | 
--------------------------

现在看起来一切正常,
但是当我再次按 F2 并且 minibufexplorer 出现时
然后调整顶部窗口的大小:
--------------------------
| minibufexplorer   |    |
---------------------    |
| top               |    |
---------------------NERD|
|                   |    |
|                   |    |
|                   |    |
| btm               |    |
|                   |    | 
--------------------------

如果右侧没有 nerdtree 窗口,则不会调整大小。
那么如何在 nerdtree 打开时停止调整窗口大小?
(顺便说一句:抱歉,我无法上传图片,因为我只有 8 个声望。)

最佳答案

问题出在 minibufexpl.vim 的第 450 行: 在函数中 StartExplorer , 你会发现 set noequalalways .来自 :help equalalways :

When on, all the windows are automatically made the same size after splitting or closing a window. This also happens the moment the option is switched on. When off, splitting a window will reduce the size of the current window and leave the other windows the same. When closing a window the extra lines are given to the window next to it (depending on 'splitbelow' and 'splitright'). When mixing vertically and horizontally split windows, a minimal size is computed and some windows may be larger if there is room. The 'eadirection' option tells in which direction the size is affected. Changing the height and width of a window can be avoided by setting 'winfixheight' and 'winfixwidth', respectively. If a window size is specified when creating a new window sizes are currently not equalized (it's complicated, but may be implemented in the future).



这是 MiniBufExplorer 的一部分如果您希望它的行为有所不同,您将不得不 change it yourselfsubmit an issue给作者。

关于vim - 当我切换 minibufexplorer 时,如何在 nerdtree 打开时停止调整窗口大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11409671/

相关文章:

vim - 可以在 vimscript 中访问 NERDTree 缓冲区吗?

Vim 编辑不同文件时混合缩进样式

vim/NERDtree/folding - 它能记住折叠的状态吗?

vim - minibufexplorer(vim)的替代品?

vim - vim 中行 strip 数据的有效排序宏是什么?

vim - 在 Vim 中快速从垂直分割切换到水平分割

vim - 如何一遍又一遍地跳下 X 行

vim - ESC 在 cygwin vim 中不起作用