diff --git a/CHANGELOG.md b/CHANGELOG.md index dbcdfc8..bcb99c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +#### 6.1... +- **.0**: If file path doesn't exist, :NERDTreeFind its parent directory instead. (PhilRunninger) [#1043](https://github.com/scrooloose/nerdtree/pull/1043) #### 6.0... - **.1**: Reintroduce necessary variable mistakenly removed. (PhilRunninger) [#1040](https://github.com/scrooloose/nerdtree/pull/1040) - **.0**: Make the behavior of window splits consistent (dragonxlwang, PhilRunninger) [#1035](https://github.com/scrooloose/nerdtree/pull/1035) diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim index b82e791..4ba5b05 100644 --- a/autoload/nerdtree/ui_glue.vim +++ b/autoload/nerdtree/ui_glue.vim @@ -284,6 +284,9 @@ endfunction " FUNCTION: s:findAndRevealPath(pathStr) {{{1 function! s:findAndRevealPath(pathStr) let l:pathStr = !empty(a:pathStr) ? a:pathStr : expand('%:p') + if !filereadable(l:pathStr) + let l:pathStr = fnamemodify(l:pathStr, ':h') + endif if empty(l:pathStr) call nerdtree#echoWarning('no file for the current buffer')