vim-nerdtree-tabs
vim-nerdtree-tabs copied to clipboard
Evenly divide up remaining vertical split space
I'm not sure this plugin is the right place to implement something like this, but it would be great to have some kind of addon plugin that works well with vim-nerdtree-tabs. We can pretty easily do something like:
set winwidth=80
autocmd WinResize * wincmd =
autocmd WinEnter * wincmd =
This has the excellent effect of keeping your current vertical split at at least 80 chars, while evenly dividing up the remaining space among the other vertical splits.
Unfortunately, vim-nerdtree-tabs makes this very difficult. However, doing something like this from within the plugin (or via some hooks) would be much easier. I do not think any type of wincmd = will work in our case because the NERDTree sidebar shouldn't receive equal treatment - it should receive the width that was recorded in the plugin on WinLeave. However, it can't be that hard to loop through every window, and evenly distribute (totalScreenSpace - nerdWidth) among the remaining vertical window splits.
NERDTree window is supposed to have a fixed width, only windows with modifiable buffer have equal width makes sense, I do not think this should be part of NERDTree's functionality.
The width of NERDTree window would not change if you press wincmd = inside a window with modifable buffer, so I do not see a problem here. As for you autocmd, you can add a condition check to avoid the NERDTree window.
Your second comment makes sense, but I was not seeing that behavior in some situations. I'll reconfirm. As for the first comment, I wasn't suggesting that NERDTree have its space altered - only the remaining windows.
Now I recall why wincmd = is not sufficient. If I have set winwidth=80, then the nerdtree becomes resized upon that wincmd! I can't explain why though.