resize the tree window when it was the only one

if the nerd tree window is the only window open when the user opens a
file, the file will be opened in a new split. Previously that meant the
two windows would take up half the screen each.
This commit is contained in:
Martin Grenfell 2008-06-24 19:32:52 +12:00
parent e6d2f12bf6
commit 87382097df

View File

@ -2207,6 +2207,14 @@ function! s:OpenNodeSplit(treenode)
"do nothing "do nothing
endtry endtry
"resize the tree window if no other window was open before
if onlyOneWin
let size = exists("t:NERDTreeOldWindowSize") ? t:NERDTreeOldWindowSize : g:NERDTreeWinSize
exec(there)
exec("silent ". splitMode ." resize ". size)
wincmd p
endif
" Restore splitmode settings " Restore splitmode settings
let &splitbelow=savesplitbelow let &splitbelow=savesplitbelow
let &splitright=savesplitright let &splitright=savesplitright