From e7560025d1488cb6766b5498ae61c258b597b276 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Sat, 30 Jan 2016 14:03:01 +0100 Subject: [PATCH] Fix break for non-existing g:airline_theme fixes #969 --- doc/airline.txt | 6 +++++- plugin/airline.vim | 9 ++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/airline.txt b/doc/airline.txt index 0466874..59c81bd 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -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' diff --git a/plugin/airline.vim b/plugin/airline.vim index 7711e42..d183357 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -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