From 2027ae03dbaff8fd31832915ae216c0b0d6c24d6 Mon Sep 17 00:00:00 2001 From: Martin Grenfell Date: Wed, 19 Oct 2016 13:28:44 +0100 Subject: [PATCH] remove NERDTree.previousBuf() and related code We were using this when closing a wintree - to go to the previous buffer. Not sure why we weren't just using `:bprev` ... --- autoload/nerdtree/ui_glue.vim | 15 ++++++++------- lib/nerdtree/creator.vim | 3 --- lib/nerdtree/nerdtree.vim | 5 ----- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim index 2aa3bec..592d220 100644 --- a/autoload/nerdtree/ui_glue.vim +++ b/autoload/nerdtree/ui_glue.vim @@ -207,14 +207,15 @@ endfunction " FUNCTION: s:closeTreeWindow() {{{1 " close the tree window function! s:closeTreeWindow() - if b:NERDTree.isWinTree() && b:NERDTree.previousBuf() != -1 - exec "buffer " . b:NERDTree.previousBuf() + if b:NERDTree.isWinTree() + bp + return + endif + + if winnr("$") > 1 + call g:NERDTree.Close() else - if winnr("$") > 1 - call g:NERDTree.Close() - else - call nerdtree#echo("Cannot close last window") - endif + call nerdtree#echo("Cannot close last window") endif endfunction diff --git a/lib/nerdtree/creator.vim b/lib/nerdtree/creator.vim index 952811c..20bd32a 100644 --- a/lib/nerdtree/creator.vim +++ b/lib/nerdtree/creator.vim @@ -92,14 +92,11 @@ function! s:Creator.createWindowTree(dir) "we want the directory buffer to disappear when we do the :edit below setlocal bufhidden=wipe - let previousBuf = expand("#") - "we need a unique name for each window tree buffer to ensure they are "all independent exec g:NERDTreeCreatePrefix . " edit " . self._nextBufferName() call self._createNERDTree(path, "window") - let b:NERDTree._previousBuf = bufnr(previousBuf) call self._setCommonBufOptions() call b:NERDTree.render() diff --git a/lib/nerdtree/nerdtree.vim b/lib/nerdtree/nerdtree.vim index 73a30f7..3289705 100644 --- a/lib/nerdtree/nerdtree.vim +++ b/lib/nerdtree/nerdtree.vim @@ -181,11 +181,6 @@ function! s:NERDTree.PathFilters() return s:NERDTree._PathFilters endfunction -"FUNCTION: s:NERDTree.previousBuf() {{{1 -function! s:NERDTree.previousBuf() - return self._previousBuf -endfunction - "FUNCTION: s:NERDTree.render() {{{1 "A convenience function - since this is called often function! s:NERDTree.render()