commit 461ea6d2d854100f7954c21453bb3b926ad930e6
parent c20ac9c27f7a4ebcdd484f2cc97ea7085fb4d7a4
Author: Phil Runninger <PhilRunninger@users.noreply.github.com>
Date: Mon, 11 Dec 2017 13:27:14 -0500
Merge pull request #778 from zhenyangze/master
change NERDTreeFind with args
Diffstat:
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/autoload/nerdtree/ui_glue.vim b/autoload/nerdtree/ui_glue.vim
@@ -261,10 +261,16 @@ function! s:displayHelp()
call b:NERDTree.ui.centerView()
endfunction
-" FUNCTION: s:findAndRevealPath() {{{1
-function! s:findAndRevealPath()
+" FUNCTION: s:findAndRevealPath(path) {{{1
+function! s:findAndRevealPath(path)
+ let l:path = a:path
+
+ if empty(l:path)
+ let l:path = expand('%:p')
+ endif
+
try
- let p = g:NERDTreePath.New(expand("%:p"))
+ let p = g:NERDTreePath.New(l:path)
catch /^NERDTree.InvalidArgumentsError/
call nerdtree#echo("no file for the current buffer")
return
@@ -587,7 +593,7 @@ function! nerdtree#ui_glue#setupCommands()
command! -n=0 -bar NERDTreeClose :call g:NERDTree.Close()
command! -n=1 -complete=customlist,nerdtree#completeBookmarks -bar NERDTreeFromBookmark call g:NERDTreeCreator.CreateTabTree('<args>')
command! -n=0 -bar NERDTreeMirror call g:NERDTreeCreator.CreateMirror()
- command! -n=0 -bar NERDTreeFind call s:findAndRevealPath()
+ command! -n=? -complete=dir -bar NERDTreeFind call s:findAndRevealPath('<args>')
command! -n=0 -bar NERDTreeFocus call NERDTreeFocus()
command! -n=0 -bar NERDTreeCWD call NERDTreeCWD()
endfunction