mirror of
https://github.com/preservim/nerdtree.git
synced 2025-11-08 11:23:48 -05:00
Add style improvements
Function-local variables, instead of script-local variables, should be used here. In addition, "empty()" is a better choice for testing for the absence of an argument. Finally, the use of "else" is removed. The docstring is also updated to include the new argument.
This commit is contained in:
@@ -261,16 +261,16 @@ function! s:displayHelp()
|
|||||||
call b:NERDTree.ui.centerView()
|
call b:NERDTree.ui.centerView()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: s:findAndRevealPath() {{{1
|
" FUNCTION: s:findAndRevealPath(path) {{{1
|
||||||
function! s:findAndRevealPath(userPath)
|
function! s:findAndRevealPath(path)
|
||||||
if len(a:userPath) == 0
|
let l:path = a:path
|
||||||
let s:userPath = expand("%:p")
|
|
||||||
else
|
if empty(l:path)
|
||||||
let s:userPath = a:userPath
|
let l:path = expand('%:p')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
try
|
try
|
||||||
let p = g:NERDTreePath.New(s:userPath)
|
let p = g:NERDTreePath.New(l:path)
|
||||||
catch /^NERDTree.InvalidArgumentsError/
|
catch /^NERDTree.InvalidArgumentsError/
|
||||||
call nerdtree#echo("no file for the current buffer")
|
call nerdtree#echo("no file for the current buffer")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user