commit 0257d64248e43f3ff70e9a1fce3b2aa10ba57bb9
parent 2d7cb043d475ffe7620a8d2d2cd5de7a1f0c6aa7
Author: Phil Runninger <PhilRunninger@users.noreply.github.com>
Date: Wed, 15 Apr 2020 00:55:13 -0400
If a file's already open in the window, don't edit it again. (#1103)
* If a file's already open in the window, don't edit it again.
* Update version number in change log.
* Make only one call to self.str().
Diffstat:
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -5,7 +5,8 @@
- **.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)
+- **.6**: If a file's already open in the window, don't edit it again. (PhilRunninger) [#1103](https://github.com/preservim/nerdtree/pull/1103)
+- **.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/path.vim b/lib/nerdtree/path.vim
@@ -295,7 +295,10 @@ endfunction
" FUNCTION: Path.edit() {{{1
function! s:Path.edit()
- exec 'edit ' . self.str({'format': 'Edit'})
+ let l:bufname = self.str({'format': 'Edit'})
+ if bufname() !=# l:bufname
+ exec 'edit ' . l:bufname
+ endif
endfunction
" FUNCTION: Path.extractDriveLetter(fullpath) {{{1