Skip to content

Commit 3785988

Browse files
author
marty
committed
correct the window the cursor jumps to on :NERDTree(Close|Toggle)
1 parent 88aaba2 commit 3785988

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

plugin/NERD_tree.vim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2820,9 +2820,17 @@ function! s:closeTree()
28202820
endif
28212821

28222822
if winnr("$") != 1
2823+
if winnr() == s:getTreeWinNum()
2824+
wincmd p
2825+
let bufnr = bufnr("")
2826+
wincmd p
2827+
else
2828+
let bufnr = bufnr("")
2829+
endif
2830+
28232831
call s:exec(s:getTreeWinNum() . " wincmd w")
28242832
close
2825-
call s:exec("wincmd p")
2833+
call s:exec(bufwinnr(bufnr) . " wincmd w")
28262834
else
28272835
close
28282836
endif

0 commit comments

Comments
 (0)