Add new value to NERDTreeQuitOnOpen to close bookmark table (#955)

* Update documentation for new NERDTreeQuitOnOpen values.

* Modify use of NERDTreeQuitOnOpen, keeping current behavior.

* If applicable, close the bookmarks table before opening the target.
This commit is contained in:
Phil Runninger
2019-02-21 07:47:15 -05:00
committed by GitHub
parent 2e0b101d57
commit 9eda9ce6a1
4 changed files with 19 additions and 6 deletions

View File

@@ -256,6 +256,10 @@ endfunction
function! s:Bookmark.open(nerdtree, ...)
let opts = a:0 ? a:1 : {}
if and(g:NERDTreeQuitOnOpen,2)
call a:nerdtree.ui.toggleShowBookmarks()
endif
if self.path.isDirectory && !has_key(opts, 'where')
call self.toRoot(a:nerdtree)
else

View File

@@ -66,7 +66,7 @@ endfunction
"FUNCTION: s:NERDTree.CloseIfQuitOnOpen() {{{1
"Closes the NERD tree window if the close on open option is set
function! s:NERDTree.CloseIfQuitOnOpen()
if g:NERDTreeQuitOnOpen && s:NERDTree.IsOpen()
if and(g:NERDTreeQuitOnOpen,1) && s:NERDTree.IsOpen()
call s:NERDTree.Close()
endif
endfunction

View File

@@ -243,7 +243,7 @@ endfunction
" FUNCTION: Opener._openFile() {{{1
function! s:Opener._openFile()
if !self._stay && !g:NERDTreeQuitOnOpen && exists("b:NERDTreeZoomed") && b:NERDTreeZoomed
if !self._stay && !and(g:NERDTreeQuitOnOpen,1) && exists("b:NERDTreeZoomed") && b:NERDTreeZoomed
call b:NERDTree.ui.toggleZoom()
endif