When i toggle minibufexplorer, how to stop resizing window when nerdtree is open
Asked Answered
C

1

7

my .vimrc setting:

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

first it looks like:

--------------------------
| minibufexplorer   |    |
---------------------    |
|                   |    |
| top               |    |
|                   |    |
---------------------NERD|
|                   |    |
| btm               |    |
|                   |    | 
--------------------------

next when i press F2, minibufexplorer was toggled:

--------------------------
|                   |    |                  
|                   |    |
| top               |    |
|                   |    |
---------------------NERD|
|                   |    |
| btm               |    |
|                   |    | 
--------------------------

right now it seen like everything is ok, but when i press F2 again and minibufexplorer show up then the top window was resized:

--------------------------
| minibufexplorer   |    |
---------------------    |
| top               |    |
---------------------NERD|
|                   |    |
|                   |    |
|                   |    |
| btm               |    |
|                   |    | 
--------------------------

If there is no nerdtree window at the right, it will not resize. So how to stop resizing window when nerdtree is open? (btw: sorry, I can't upload pics cuz i only have 8 reputation.)

Caldera answered 10/7, 2012 at 8:46 Comment(2)
That is very bizarre that it only happens when a NERDTree window is open; what versions of vim and those plugins are you using?Hollyanne
vim = 7.3 NERD_tree_version = 4.2.0 minibufexpl > 6.4.4Caldera
H
6

The problem is on line 450 of minibufexpl.vim: in the function StartExplorer, you will find set noequalalways. From :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).

This is part of MiniBufExplorer and if you want it to behave differently you will either have to change it yourself or submit an issue to the author.

Hollyanne answered 16/4, 2013 at 13:50 Comment(3)
I tried to :set noequalalways and :set qualalways, but got the same result.Caldera
That is correct. MiniBufExplorer does :set noequalalways when you start/open it. Resetting it will not help you, because it's just going to happen again the next time you open it. As I said in the answer, if you want it to behave differently, you will either have to change the plugin yourself or submit an issue for the plugin to be changed.Hollyanne
Thanks, guy. I think i will try your suggestion, both:)Caldera

© 2022 - 2024 — McMap. All rights reserved.