mirror of
https://github.com/vim-airline/vim-airline.git
synced 2026-05-25 01:38:34 +08:00
guard against attempting to load invalid themes.
This commit is contained in:
+12
-2
@@ -31,8 +31,18 @@ function! airline#load_theme()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! airline#switch_theme(name)
|
function! airline#switch_theme(name)
|
||||||
let g:airline_theme = a:name
|
try
|
||||||
let palette = g:airline#themes#{g:airline_theme}#palette "also lazy loads the theme
|
let palette = g:airline#themes#{a:name}#palette "also lazy loads the theme
|
||||||
|
let g:airline_theme = a:name
|
||||||
|
catch
|
||||||
|
echohl WarningMsg | echo 'The specified theme cannot be found.' | echohl NONE
|
||||||
|
if exists('g:airline_theme')
|
||||||
|
return
|
||||||
|
else
|
||||||
|
let g:airline_theme = 'dark'
|
||||||
|
let palette = g:airline#themes#dark#palette
|
||||||
|
endif
|
||||||
|
endtry
|
||||||
call airline#themes#patch(palette)
|
call airline#themes#patch(palette)
|
||||||
|
|
||||||
if exists('g:airline_theme_patch_func')
|
if exists('g:airline_theme_patch_func')
|
||||||
|
|||||||
Reference in New Issue
Block a user