Fix matching of themes to color names

theme usually use '_' instead of '-', so replace that first before
trying to match.

Second, make the patterns easier to match.

Third, make sure, match for Tomorrow happens with matching case

fixes #1056
This commit is contained in:
Christian Brabandt 2016-02-25 08:07:51 +01:00
parent 5ab8b754d8
commit 78e1a2c8db
2 changed files with 6 additions and 7 deletions

View File

@ -71,7 +71,7 @@ endfunction
function! airline#switch_matching_theme()
if exists('g:colors_name')
let existing = g:airline_theme
let existing = substitute(g:airline_theme, '-', '_', 'g')
try
let palette = g:airline#themes#{g:colors_name}#palette
call airline#switch_theme(g:colors_name)

View File

@ -47,13 +47,12 @@ function! airline#init#bootstrap()
call s:check_defined('g:airline_theme_map', {})
call extend(g:airline_theme_map, {
\ 'Tomorrow.*': 'tomorrow',
\ 'base16.*': 'base16',
\ 'bubblegum': 'bubblegum',
\ '\CTomorrow': 'tomorrow',
\ 'base16': 'base16',
\ 'mo[l|n]okai': 'molokai',
\ 'wombat.*': 'wombat',
\ '.*zenburn.*': 'zenburn',
\ '.*solarized.*': 'solarized',
\ 'wombat': 'wombat',
\ 'zenburn': 'zenburn',
\ 'solarized': 'solarized',
\ }, 'keep')
call s:check_defined('g:airline_symbols', {})