From d1d9548b8e15d4dc80d9ae0ceb3721e547977bab Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 17 Apr 2019 08:25:55 +0200 Subject: [PATCH] themes: correctly catch not-found in init function plugin/airline.vim was calling airline#switch_theme() without actually catching the 'not-found' exception. Therefore, in case of errors, explicitly switch to a dark theme. closes #1903 --- plugin/airline.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/airline.vim b/plugin/airline.vim index 59431e79..b1f4a0b0 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -29,7 +29,13 @@ function! s:init() call airline#util#warning(printf('Could not resolve airline theme "%s". Themes have been migrated to github.com/vim-airline/vim-airline-themes.', g:airline_theme)) let g:airline_theme = 'dark' endtry - silent call airline#switch_theme(g:airline_theme) + try + silent call airline#switch_theme(g:airline_theme) + catch + call airline#util#warning(printf('Could not find airline theme "%s".', g:airline_theme)) + let g:airline_theme = 'dark' + silent call airline#switch_theme(g:airline_theme) + endtry else let g:airline_theme = 'dark' silent call s:on_colorscheme_changed()