nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 6e9a5d4cea33be83ff2354f307f628a88254fc1d
parent 495e90616982073c210e0e989ff37e533be328c9
Author: Martin Grenfell <martin_grenfell@msn.com>
Date:   Sat, 10 Jan 2009 17:35:21 +1300

fixes to secondary nerd trees for the q mapping

make sure we always go back to the right buffer, and if there is no
buffer to go back to, close the window

Diffstat:
Mplugin/NERD_tree.vim | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/plugin/NERD_tree.vim b/plugin/NERD_tree.vim
@@ -2074,6 +2074,8 @@ function! s:initNerdTreeInPlace(dir)
         return
     endtry
 
+    "we want the directory buffer to disappear when we do the :edit below
+    setlocal bufhidden=wipe
 
     let previousBuf = expand("#")
 
@@ -2081,9 +2083,7 @@ function! s:initNerdTreeInPlace(dir)
     "all independent
     exec "silent edit " . s:nextBufferName()
 
-    if previousBuf !~ s:NERDTreeBufName . '.*'
-        let b:NERDTreePreviousBuf = previousBuf
-    endif
+    let b:NERDTreePreviousBuf = bufnr(previousBuf)
 
     let b:NERDTreeRoot = s:TreeDirNode.New(path)
     call b:NERDTreeRoot.open()
@@ -2091,7 +2091,7 @@ function! s:initNerdTreeInPlace(dir)
     "throwaway buffer options
     setlocal noswapfile
     setlocal buftype=nofile
-    setlocal bufhidden=delete
+    setlocal bufhidden=hide
     setlocal nowrap
     setlocal foldcolumn=0
     setlocal nobuflisted
@@ -3185,7 +3185,7 @@ endfunction
 " FUNCTION: s:closeTreeWindow() {{{2
 " close the tree window
 function! s:closeTreeWindow()
-    if b:NERDTreeType == "secondary" && exists("b:NERDTreePreviousBuf")
+    if b:NERDTreeType == "secondary" && b:NERDTreePreviousBuf != -1
         exec "buffer " . b:NERDTreePreviousBuf
     else
         if winnr("$") > 1