plugin: handle sandbox mode gracefully

When the sandbox is active (e.g. while debugging something), certains
commands and expressions are not allowed (see :h sandbox) and may cause
nasty exceptions to be thrown.

So try to catch E48 and handle it gracefully
This commit is contained in:
Christian Brabandt
2022-09-07 09:43:51 +02:00
parent 90c6746311
commit 2cea8346cf
2 changed files with 18 additions and 3 deletions

View File

@@ -180,7 +180,12 @@ function! airline#util#doautocmd(event)
" airline disabled
return
endif
exe printf("silent doautocmd %s User %s", s:nomodeline, a:event)
try
exe printf("silent doautocmd %s User %s", s:nomodeline, a:event)
catch /^Vim\%((\a\+)\)\=:E48:/
" Catch: Sandbox mode
" no-op
endtry
endfunction
function! airline#util#themes(match)