From 7a1d7a01b26b4854d6789905b5dc924c2140816d Mon Sep 17 00:00:00 2001 From: Evgeni Kolev Date: Tue, 20 Aug 2013 23:30:46 +0300 Subject: [PATCH] allow ctrlp to use mode colors other than insert's colors add global variable g:airline#extensions#ctrlp#color_template which can hold modes normal|insert|visual|replace as string. ctrlp will use the given mode's colors if the active theme doesn't define any. --- autoload/airline/extensions/ctrlp.vim | 9 ++++++--- doc/airline.txt | 10 ++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/autoload/airline/extensions/ctrlp.vim b/autoload/airline/extensions/ctrlp.vim index dbe6691..3744548 100644 --- a/autoload/airline/extensions/ctrlp.vim +++ b/autoload/airline/extensions/ctrlp.vim @@ -1,6 +1,8 @@ " MIT license. Copyright (c) 2013 Bailey Ling. " vim: ts=2 sts=2 sw=2 fdm=indent +let s:color_template = get(g:, 'airline#extensions#ctrlp#color_template', 'insert') + function! airline#extensions#ctrlp#generate_color_map(dark, light, white) return { \ 'CtrlPdark' : a:dark, @@ -16,10 +18,11 @@ function! airline#extensions#ctrlp#load_theme() if exists('g:airline#themes#{g:airline_theme}#palette.ctrlp') let theme = g:airline#themes#{g:airline_theme}#palette.ctrlp else + let s:color_template = has_key(g:airline#themes#{g:airline_theme}#palette, s:color_template) ? s:color_template : 'insert' let theme = airline#extensions#ctrlp#generate_color_map( - \ g:airline#themes#{g:airline_theme}#palette.insert['airline_c'], - \ g:airline#themes#{g:airline_theme}#palette.insert['airline_b'], - \ g:airline#themes#{g:airline_theme}#palette.insert['airline_a']) + \ g:airline#themes#{g:airline_theme}#palette[s:color_template]['airline_c'], + \ g:airline#themes#{g:airline_theme}#palette[s:color_template]['airline_b'], + \ g:airline#themes#{g:airline_theme}#palette[s:color_template]['airline_a']) endif for key in keys(theme) call airline#highlighter#exec(key, theme[key]) diff --git a/doc/airline.txt b/doc/airline.txt index 11319fb..5f9edb8 100644 --- a/doc/airline.txt +++ b/doc/airline.txt @@ -227,6 +227,16 @@ vim-signify * configure whether a message should be displayed. > let g:airline#extensions#whitespace#show_message = 1 < + *airline-ctrlp* +ctrlp + +* configure which mode colors should ctrlp window use (takes effect + only if the active airline theme doesn't define ctrlp colors) > + let g:airline#extensions#ctrlp#color_template = 'insert' (default) + let g:airline#extensions#ctrlp#color_template = 'normal' + let g:airline#extensions#ctrlp#color_template = 'visual' + let g:airline#extensions#ctrlp#color_template = 'replace' +< ============================================================================== FUNCREFS *airline-funcrefs*