Catch error on first load where colorscheme may be missing

This commit is contained in:
ViViDboarder 2019-10-24 14:12:44 -07:00
parent c16f793fb8
commit 8d0b6c26fe

View File

@ -17,19 +17,6 @@ syntax on
set hlsearch
" Color Schemes {{
" Set theme based on $VIM_COLOR variable
try
if !empty($VIM_COLOR)
colorscheme $VIM_COLOR
else
" Prefered default colorscheme
colorscheme wombat256mod
endif
catch /^Vim\%((\a\+)\)\=:E185/
" Colorschemes not installed yet
" This happens when first installing bundles
colorscheme default
endtry
" Function and command to update colors based on light and dark mode
function! UpdateColors()
@ -65,8 +52,21 @@ function! UpdateColors()
endif
endfunction
command! UpdateColors call UpdateColors()
" au BufEnter *.* call UpdateColors()
call UpdateColors()
" Set theme based on $VIM_COLOR variable
try
if !empty($VIM_COLOR)
colorscheme $VIM_COLOR
else
" Prefered default colorscheme
colorscheme wombat256mod
endif
call UpdateColors()
catch /^Vim\%((\a\+)\)\=:E185/
" Colorschemes not installed yet
" This happens when first installing bundles
colorscheme default
endtry
" }}
" Set gui specific values {{