diff --git a/doc/NERD_tree.txt b/doc/NERD_tree.txt index d8f0baa..e21aaef 100644 --- a/doc/NERD_tree.txt +++ b/doc/NERD_tree.txt @@ -889,6 +889,9 @@ fridge for later ;) ============================================================================== 7. Changelog *NERDTreeChangelog* +2.x.x + - fix a bug where the o mapping would cause the tree window to be + incorrectly sized when reopened. 2.13.0 - make NERDTreeChDir option default to 0 (i.e. never change vims current working dir by default) diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim index 9d36183..fcabf08 100644 --- a/plugin/NERD_tree.vim +++ b/plugin/NERD_tree.vim @@ -146,7 +146,7 @@ command! -n=1 -complete=customlist,s:CompleteBookmarks NERDTreeFromBookmark call " SECTION: Auto commands {{{1 "============================================================ "Save the cursor position whenever we close the nerd tree -exec "autocmd BufWinLeave *". s:NERDTreeWinName ."* :call SaveScreenState()" +exec "autocmd BufWinLeave *". s:NERDTreeWinName ." call SaveScreenState()" "cache bookmarks when vim loads autocmd VimEnter * call s:oBookmark.CacheBookmarks(0) @@ -2621,12 +2621,13 @@ endfunction "FUNCTION: s:SaveScreenState() {{{2 "Saves the current cursor position in the current buffer and the window "scroll position -" -"Assumes the cursor is in the NERDTree window function! s:SaveScreenState() + let win = winnr() + call s:PutCursorInTreeWin() let t:NERDTreeOldPos = getpos(".") let t:NERDTreeOldTopLine = line("w0") let t:NERDTreeOldWindowSize = s:ShouldSplitVertically() ? winwidth("") : winheight("") + exec win . "wincmd w" endfunction "FUNCTION: s:SetupSyntaxHighlighting() {{{2