Skip to content

Commit

Permalink
prevent empty split when calling NERDTreeExplorer with invalid arg fr…
Browse files Browse the repository at this point in the history
…om modified buffer
  • Loading branch information
msibal6 committed Dec 12, 2023
1 parent f71695c commit 54059b6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/nerdtree/creator.vim
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ endfunction

" FUNCTION: s:Creator.CreateExplorerTree(dir) {{{1
function! s:Creator.CreateExplorerTree(dir)
try
let path = g:NERDTreePath.New(a:dir)
catch /^NERDTree.InvalidArgumentsError/
call nerdtree#echo('Invalid directory name:' . a:dir)
return
endtry

let creator = s:Creator.New()
if getbufinfo('%')[0].changed
let l:splitLocation = g:NERDTreeWinPos ==# 'left' || g:NERDTreeWinPos ==# 'top' ? 'topleft ' : 'botright '
Expand Down

0 comments on commit 54059b6

Please sign in to comment.