From 43902a31d86d36cd07f2809cd0614d9d27373990 Mon Sep 17 00:00:00 2001 From: jdhao Date: Mon, 19 Oct 2020 01:29:06 +0800 Subject: [PATCH] check for invalid colorscheme --- ui.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ui.vim b/ui.vim index 9d257af..691184d 100644 --- a/ui.vim +++ b/ui.vim @@ -113,6 +113,13 @@ function! s:my_theme_dict.neodark() dict abort colorscheme neodark endfunction -execute printf('call s:my_theme_dict.%s()', s:theme) +let s:colorscheme_func = printf('s:my_theme_dict.%s()', s:theme) +if has_key(s:my_theme_dict, s:theme) + execute 'call ' . s:colorscheme_func +else + echohl WarningMsg + echomsg 'Invalid colorscheme function: ' s:colorscheme_func ', using default instead.' + echohl None +endif "}} "}