From 52df970d21dcc1976b3842179afe17fbc9344bcf Mon Sep 17 00:00:00 2001 From: Jongwook Choi Date: Sun, 23 Oct 2022 22:02:44 -0400 Subject: [PATCH] Avoid unknown function errors SemshiBufWipeout 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. --- plugin/semshi.vim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugin/semshi.vim b/plugin/semshi.vim index 17bf58a..ef8ee37 100644 --- a/plugin/semshi.vim +++ b/plugin/semshi.vim @@ -98,6 +98,14 @@ function! semshi#buffer_detach() augroup END endfunction +function! semshi#buffer_wipeout() + try + call SemshiBufWipeout(+expand('')) + 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() @@ -107,7 +115,7 @@ function! semshi#init() endif autocmd FileType * call s:filetype_changed() - autocmd BufWipeout * call SemshiBufWipeout(+expand('')) + autocmd BufWipeout * call semshi#buffer_wipeout() endfunction call semshi#init()