mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
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
This commit is contained in:
@@ -2351,9 +2351,10 @@ endfunction
|
|||||||
"
|
"
|
||||||
"Assumes the cursor is in the NERDTree window
|
"Assumes the cursor is in the NERDTree window
|
||||||
function! s:RestoreScreenState()
|
function! s:RestoreScreenState()
|
||||||
if !exists("t:NERDTreeOldTopLine") || !exists("t:NERDTreeOldPos")
|
if !exists("t:NERDTreeOldTopLine") || !exists("t:NERDTreeOldPos") || !exists("t:NERDTreeOldWindowSize")
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
exec("silent ". (g:NERDTreeSplitVertical ? "vertical" : "") ." resize ".t:NERDTreeOldWindowSize)
|
||||||
|
|
||||||
call cursor(t:NERDTreeOldTopLine, 0)
|
call cursor(t:NERDTreeOldTopLine, 0)
|
||||||
normal! zt
|
normal! zt
|
||||||
@@ -2368,6 +2369,7 @@ endfunction
|
|||||||
function! s:SaveScreenState()
|
function! s:SaveScreenState()
|
||||||
let t:NERDTreeOldPos = getpos(".")
|
let t:NERDTreeOldPos = getpos(".")
|
||||||
let t:NERDTreeOldTopLine = line("w0")
|
let t:NERDTreeOldTopLine = line("w0")
|
||||||
|
let t:NERDTreeOldWindowSize = g:NERDTreeSplitVertical ? winwidth("") : winheight("")
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
"FUNCTION: s:SetupSyntaxHighlighting() {{{2
|
"FUNCTION: s:SetupSyntaxHighlighting() {{{2
|
||||||
|
|||||||
Reference in New Issue
Block a user