Skip to content

Commit

Permalink
Avoid unknown function errors SemshiBufWipeout
Browse files Browse the repository at this point in the history
When rplugin has not been registered, semshi will throw an error
upon BufWipeout events; it especially happens when installing vim
plugins and running UpdateRemotePlugins for the first time.

We can simply ignore the error when the function is not there yet.
  • Loading branch information
wookayin committed Oct 24, 2022
1 parent e377638 commit 52df970
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugin/semshi.vim
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ function! semshi#buffer_detach()
augroup END
endfunction

function! semshi#buffer_wipeout()
try
call SemshiBufWipeout(+expand('<abuf>'))
catch /:E117:/
" UpdateRemotePlugins probably not done yet, ignore
endtry
endfunction

function! semshi#init()
if g:semshi#no_default_builtin_highlight
call s:disable_builtin_highlights()
Expand All @@ -107,7 +115,7 @@ function! semshi#init()
endif

autocmd FileType * call s:filetype_changed()
autocmd BufWipeout * call SemshiBufWipeout(+expand('<abuf>'))
autocmd BufWipeout * call semshi#buffer_wipeout()
endfunction

call semshi#init()

0 comments on commit 52df970

Please sign in to comment.