commit 2d7cb043d475ffe7620a8d2d2cd5de7a1f0c6aa7
parent f767dd34a0bda0a6db8efa43257c90981947f0ab
Author: Phil Runninger <PhilRunninger@users.noreply.github.com>
Date: Mon, 13 Apr 2020 17:05:27 -0400
Prevent unneeded tree creation in :NERDTreeToggle[VCS] <path> (#1101)
* Don't recreate the NERDTree if its root is the same as being requested.
* Use single quotes per Vint's style recommendation.
* Update version number in changelog.
* Use a simpler method of getting the NERDTree root path.
* Remove variable. Just compare agains the function call's result.
Diffstat:
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -5,6 +5,7 @@
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
-->
#### 6.7
+- **.5**: Prevent unneeded tree creation in :NERDTreeToggle[VCS] <path> (PhilRunninger) [#1101](https://github.com/preservim/nerdtree/pull/1101)
- **.4**: Add missing calls to the `shellescape()` function (lifecrisis) [#1099](https://github.com/preservim/nerdtree/pull/1099)
- **.3**: Fix vsplit to not open empty buffers when opening previously closed file (AwkwardKore) [#1098](https://github.com/preservim/nerdtree/pull/1098)
- **.2**: Fix infinity loop (on winvim) in FindParentVCSRoot (Eugenij-W) [#1095](https://github.com/preservim/nerdtree/pull/1095)
diff --git a/lib/nerdtree/creator.vim b/lib/nerdtree/creator.vim
@@ -366,7 +366,7 @@ function! s:Creator.toggleTabTree(dir)
if g:NERDTree.ExistsForTab()
if !g:NERDTree.IsOpen()
call self._createTreeWin()
- if !empty(a:dir)
+ if !empty(a:dir) && a:dir !=# b:NERDTree.root.path.str()
call self.createTabTree(a:dir)
elseif !&hidden
call b:NERDTree.render()