account for empty vimrc with no colorscheme set.

This commit is contained in:
Bailey Ling 2013-08-18 04:56:38 +00:00
parent 88b910d959
commit bcba04e20c
1 changed files with 14 additions and 12 deletions

View File

@ -21,18 +21,20 @@ function! airline#switch_theme(name)
endfunction endfunction
function! airline#switch_matching_theme() function! airline#switch_matching_theme()
let v:errmsg = '' if exists('g:colors_name')
silent! let palette = g:airline#themes#{g:colors_name}#palette let v:errmsg = ''
if empty(v:errmsg) silent! let palette = g:airline#themes#{g:colors_name}#palette
call airline#switch_theme(g:colors_name) if empty(v:errmsg)
return 1 call airline#switch_theme(g:colors_name)
else return 1
for map in items(g:airline_theme_map) else
if match(g:colors_name, map[0]) > -1 for map in items(g:airline_theme_map)
call airline#switch_theme(map[1]) if match(g:colors_name, map[0]) > -1
return 1 call airline#switch_theme(map[1])
endif return 1
endfor endif
endfor
endif
endif endif
return 0 return 0
endfunction endfunction