nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit d15818bafa9e39061abef9f2c4ec80b46e3f5cff
parent f74ec0661dfab8a68bc44adac359a170298f9d32
Author: Martin Grenfell <martin_grenfell@msn.com>
Date:   Sun, 22 Jun 2008 13:53:13 +1200

save and restore the size of the window

store the old nerd tree window size as a tabpage local variable and
restore it when reloading the tree window

Diffstat:
Mplugin/NERD_tree.vim | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -2351,9 +2351,10 @@ endfunction
 "
 "Assumes the cursor is in the NERDTree window
 function! s:RestoreScreenState()
-    if !exists("t:NERDTreeOldTopLine") || !exists("t:NERDTreeOldPos")
+    if !exists("t:NERDTreeOldTopLine") || !exists("t:NERDTreeOldPos") || !exists("t:NERDTreeOldWindowSize")
         return
     endif
+    exec("silent ". (g:NERDTreeSplitVertical ? "vertical" : "") ." resize ".t:NERDTreeOldWindowSize)
 
     call cursor(t:NERDTreeOldTopLine, 0)
     normal! zt
@@ -2368,6 +2369,7 @@ endfunction
 function! s:SaveScreenState()
     let t:NERDTreeOldPos = getpos(".")
     let t:NERDTreeOldTopLine = line("w0")
+    let t:NERDTreeOldWindowSize = g:NERDTreeSplitVertical ? winwidth("") : winheight("")
 endfunction
 
 "FUNCTION: s:SetupSyntaxHighlighting() {{{2