Fix break for non-existing g:airline_theme

fixes #969
This commit is contained in:
Christian Brabandt 2016-01-30 14:03:01 +01:00
parent d7fd8ca649
commit e7560025d1
2 changed files with 11 additions and 4 deletions

View File

@ -82,8 +82,12 @@ values):
<
* themes are automatically selected based on the matching colorscheme. this
can be overridden by defining a value. >
let g:airline_theme=
let g:airline_theme='dark'
<
Note: Only the dark theme is distributed with vim-airline. For more themes,
checkout the vim-airline-themes repository
(github.com/vim-airline/vim-airline-themes)
* if you want to patch the airline theme before it gets applied, you can
supply the name of a function where you can modify the palette. >
let g:airline_theme_patch_func = 'AirlineThemePatch'

View File

@ -7,8 +7,8 @@ endif
let g:loaded_airline = 1
let s:airline_initialized = 0
let s:airline_theme_defined = 0
function! s:init()
let s:airline_theme_defined = exists('g:airline_theme')
if s:airline_initialized
return
endif
@ -17,8 +17,11 @@ function! s:init()
call airline#extensions#load()
call airline#init#sections()
let s:airline_theme_defined = exists('g:airline_theme')
if s:airline_theme_defined || !airline#switch_matching_theme()
if !s:airline_theme_defined
let g:airline_theme = 'dark'
let s:airline_theme_defined = 1
endif
if !airline#switch_matching_theme()
try
let palette = g:airline#themes#{g:airline_theme}#palette
catch