mirror of
https://github.com/preservim/nerdtree.git
synced 2025-03-03 23:48:58 +08:00
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
This commit is contained in:
parent
495e906169
commit
6e9a5d4cea
@ -2074,6 +2074,8 @@ function! s:initNerdTreeInPlace(dir)
|
|||||||
return
|
return
|
||||||
endtry
|
endtry
|
||||||
|
|
||||||
|
"we want the directory buffer to disappear when we do the :edit below
|
||||||
|
setlocal bufhidden=wipe
|
||||||
|
|
||||||
let previousBuf = expand("#")
|
let previousBuf = expand("#")
|
||||||
|
|
||||||
@ -2081,9 +2083,7 @@ function! s:initNerdTreeInPlace(dir)
|
|||||||
"all independent
|
"all independent
|
||||||
exec "silent edit " . s:nextBufferName()
|
exec "silent edit " . s:nextBufferName()
|
||||||
|
|
||||||
if previousBuf !~ s:NERDTreeBufName . '.*'
|
let b:NERDTreePreviousBuf = bufnr(previousBuf)
|
||||||
let b:NERDTreePreviousBuf = previousBuf
|
|
||||||
endif
|
|
||||||
|
|
||||||
let b:NERDTreeRoot = s:TreeDirNode.New(path)
|
let b:NERDTreeRoot = s:TreeDirNode.New(path)
|
||||||
call b:NERDTreeRoot.open()
|
call b:NERDTreeRoot.open()
|
||||||
@ -2091,7 +2091,7 @@ function! s:initNerdTreeInPlace(dir)
|
|||||||
"throwaway buffer options
|
"throwaway buffer options
|
||||||
setlocal noswapfile
|
setlocal noswapfile
|
||||||
setlocal buftype=nofile
|
setlocal buftype=nofile
|
||||||
setlocal bufhidden=delete
|
setlocal bufhidden=hide
|
||||||
setlocal nowrap
|
setlocal nowrap
|
||||||
setlocal foldcolumn=0
|
setlocal foldcolumn=0
|
||||||
setlocal nobuflisted
|
setlocal nobuflisted
|
||||||
@ -3185,7 +3185,7 @@ endfunction
|
|||||||
" FUNCTION: s:closeTreeWindow() {{{2
|
" FUNCTION: s:closeTreeWindow() {{{2
|
||||||
" close the tree window
|
" close the tree window
|
||||||
function! s:closeTreeWindow()
|
function! s:closeTreeWindow()
|
||||||
if b:NERDTreeType == "secondary" && exists("b:NERDTreePreviousBuf")
|
if b:NERDTreeType == "secondary" && b:NERDTreePreviousBuf != -1
|
||||||
exec "buffer " . b:NERDTreePreviousBuf
|
exec "buffer " . b:NERDTreePreviousBuf
|
||||||
else
|
else
|
||||||
if winnr("$") > 1
|
if winnr("$") > 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user