fix the q mapping again

since we are now ":edit"ing a new buffer for secondary nerd trees, we
have to store the previous buffer number otherwise we get into an
infinite loop because we go back to a directory buffer which causes
another secondary nerd tree to open etc
This commit is contained in:
Martin Grenfell 2009-01-09 18:11:36 +13:00
parent d76f936698
commit 2e6cedcad7

View File

@ -2074,10 +2074,17 @@ function! s:initNerdTreeInPlace(dir)
return
endtry
let previousBuf = expand("#")
"we need a unique name for each secondary tree buffer to ensure they are
"all independent
exec "silent edit " . s:nextBufferName()
if previousBuf !~ s:NERDTreeBufName . '.*'
let b:NERDTreePreviousBuf = previousBuf
endif
let b:NERDTreeRoot = s:TreeDirNode.New(path)
call b:NERDTreeRoot.open()
@ -3178,10 +3185,14 @@ endfunction
" FUNCTION: s:closeTreeWindow() {{{2
" close the tree window
function! s:closeTreeWindow()
if b:NERDTreeType == "secondary"
buffer #
if b:NERDTreeType == "secondary" && exists("b:NERDTreePreviousBuf")
exec "buffer " . b:NERDTreePreviousBuf
else
if winnr("$") > 1
wincmd c
else
call s:echo("Cannot close last window")
endif
endif
endfunction
" FUNCTION: s:copyNode() {{{2