commit e67324fdea7a192c7ce1b4c6b3c3b9f82f11eee7
parent 07612557ebb4118ef4a337faa7033d0270773c71
Author: Phil Runninger <PhilRunninger@users.noreply.github.com>
Date: Thu, 20 Feb 2020 09:10:19 -0500
Merge pull request #1090 from bouk/open-on-find-unsaved-file
Open the parent directory when revealing a non-existent file
Diffstat:
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -4,6 +4,8 @@
version in an unordered list. The format is:
- **.PATCH**: Pull Request Title (PR Author) [PR Number](Link to PR)
-->
+#### 6.7
+- **.0**: Open the parent directory when revealing a non-existent file with :NERDTreeFind (bouk) [#1090](https://github.com/preservim/nerdtree/pull/1090)
#### 6.6
- **.1**: [add] How to install using dein.vim (kazukazuinaina) [#1087](https://github.com/preservim/nerdtree/pull/1087)
- **.0**: Add the ability to turn off directory arrows (PhilRunninger) [#1085](https://github.com/preservim/nerdtree/pull/1085)
diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim
@@ -284,6 +284,7 @@ endfunction
" FUNCTION: s:findAndRevealPath(pathStr) {{{1
function! s:findAndRevealPath(pathStr) abort
let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p')
+ let l:revealOpts = {}
if empty(l:pathStr)
call nerdtree#echoWarning('no file for the current buffer')
@@ -292,6 +293,7 @@ function! s:findAndRevealPath(pathStr) abort
if !filereadable(l:pathStr)
let l:pathStr = fnamemodify(l:pathStr, ':h')
+ let l:revealOpts['open'] = 1
endif
try
@@ -327,7 +329,7 @@ function! s:findAndRevealPath(pathStr) abort
call b:NERDTree.ui.setShowHidden(1)
endif
- let l:node = b:NERDTree.root.reveal(l:pathObj)
+ let l:node = b:NERDTree.root.reveal(l:pathObj, l:revealOpts)
call b:NERDTree.render()
call l:node.putCursorHere(1, 0)
endfunction