From 68ac156256d13035879f0d022ad02417e07c8f09 Mon Sep 17 00:00:00 2001 From: Bailey Ling Date: Fri, 26 Jul 2013 17:21:43 +0000 Subject: [PATCH] make ctrlp themeable (#97). --- README.md | 22 ++++++++++----------- autoload/airline/extensions/ctrlp.vim | 28 +++++++++++++++++---------- plugin/airline.vim | 4 ++-- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index 272a309..739faa0 100644 --- a/README.md +++ b/README.md @@ -8,18 +8,18 @@ Lean & mean statusline for vim that's light as air. There's already [powerline][b], why yet another statusline? -* it's 100% vimscript; no python needed. -* it's small. i want the core plugin to be *less than 200 lines* as a rule (specifically adhering to the [open/closed principle][h]). -* despite the small size, it is fully featured and already integrates with: [vim-bufferline][f], [fugitive][d], [unite][i], [ctrlp][j], [minibufexpl][o], [gundo][p], [undotree][q], [nerdtree][r], [tagbar][s], [syntastic][e] and [lawrencium][u]. -* it looks good with regular fonts, and provides configuration points so you can use unicode or powerline symbols. -* it's fast to load, taking roughly 1ms. by comparison, powerline needs 60ms on the same machine. -* it's fully customizable; if you know a little `statusline` syntax you can tweak it to your needs. -* it's trivial to write colorschemes; for a minimal theme you need to edit 9 lines of colors. (please send pull requests if you create new themes!) +* 100% vimscript; no python needed. +* small. i want the core plugin to be *less than 200 lines* as a rule (specifically adhering to the [open/closed principle][h]). +* integrates with a variety of plugins: [vim-bufferline][f], [fugitive][d], [unite][i], [ctrlp][j], [minibufexpl][o], [gundo][p], [undotree][q], [nerdtree][r], [tagbar][s], [syntastic][e] and [lawrencium][u]. +* looks good with regular fonts and provides configuration points so you can use unicode or powerline symbols. +* fast to load, taking roughly 1ms. by comparison, powerline needs 60ms on the same machine. +* fully customizable; if you know a little `statusline` syntax you can tweak it to your needs. +* trivial to write colorschemes; for a minimal theme you need to edit 9 lines of colors (please send pull requests). What about [old powerline][a]? -* the old version still works well, but since it's deprecated new features won't get added -* it uses different font codes, which makes it incompatible with other powerline bindings in the same terminal (e.g. bash, zsh, tmux, etc.) +* the old version still works well, but since it's deprecated new features won't get added. +* it uses different font codes, which makes it incompatible with other powerline bindings in the same terminal (e.g. bash, zsh, tmux, etc.). # Where did the name come from? @@ -54,7 +54,7 @@ Finally, enable them in vim-airline by adding `let g:airline_powerline_fonts = 1 Solutions to common problems can be found in the [Wiki](https://github.com/bling/vim-airline/wiki/FAQ). -# Screenshots +# Themes/Screenshots A full list of screenshots can be found in the [Wiki][n]. @@ -64,7 +64,7 @@ Tracking down bugs can take a very long time due to different configurations, ve * reproduce it with this [minivimrc][g] repository to rule out any configuration conflicts. * include your version of vim, including patches, and operating system (`:version` will contain this information). -* a link to your vimrc or a gist which shows how you configured the plugin(s) +* a link to your vimrc or a gist which shows how you configured the plugin(s). # Contributions diff --git a/autoload/airline/extensions/ctrlp.vim b/autoload/airline/extensions/ctrlp.vim index 899d9b0..c910586 100644 --- a/autoload/airline/extensions/ctrlp.vim +++ b/autoload/airline/extensions/ctrlp.vim @@ -1,14 +1,22 @@ -" TODO: support loading color palette from g:airline_theme - function! airline#extensions#ctrlp#load_ctrlp_hi() - hi! CtrlPdark ctermfg=189 ctermbg=55 guifg=#d7d7ff guibg=#5f00af - hi! CtrlPlight ctermfg=231 ctermbg=98 guifg=#ffffff guibg=#875fd7 - hi! CtrlPwhite ctermfg=55 ctermbg=231 term=bold guifg=#5f00af guibg=#ffffff gui=bold - hi! CtrlParrow1 ctermfg=98 ctermbg=231 guifg=#875fd7 guibg=#ffffff - hi! CtrlParrow2 ctermfg=231 ctermbg=98 guifg=#ffffff guibg=#875fd7 - hi! CtrlParrow3 ctermfg=98 ctermbg=55 guifg=#875fd7 guibg=#5f00af - hi! CtrlParrow4 ctermfg=231 ctermbg=55 guifg=#ffffff guibg=#5f00af - hi! CtrlParrow5 ctermfg=98 ctermbg=231 guifg=#875fd7 guibg=#ffffff + let load_theme = g:airline#themes#{g:airline_theme}#normal + if exists('g:airline#themes#{g:airline_theme}#ctrlp') + let theme = g:airline#themes#{g:airline_theme}#ctrlp + else + let theme = { + \ 'CtrlPdark' : [ '#d7d7ff' , '#5f00af' , 189 , 55 , '' ] , + \ 'CtrlPlight' : [ '#ffffff' , '#875fd7' , 231 , 98 , '' ] , + \ 'CtrlPwhite' : [ '#5f00af' , '#ffffff' , 55 , 231 , 'bold' ] , + \ 'CtrlParrow1' : [ '#875fd7' , '#ffffff' , 98 , 231 , '' ] , + \ 'CtrlParrow2' : [ '#ffffff' , '#875fd7' , 231 , 98 , '' ] , + \ 'CtrlParrow3' : [ '#875fd7' , '#5f00af' , 98 , 55 , '' ] , + \ 'CtrlParrow4' : [ '#ffffff' , '#5f00af' , 231 , 55 , '' ] , + \ 'CtrlParrow5' : [ '#875fd7' , '#ffffff' , 98 , 231 , '' ] , + \ } + endif + for key in keys(theme) + call airline#exec_highlight(key, theme[key]) + endfor endfunction " Recreate Ctrl-P status line with some slight modifications diff --git a/plugin/airline.vim b/plugin/airline.vim index 762a12a..865cbe2 100644 --- a/plugin/airline.vim +++ b/plugin/airline.vim @@ -32,11 +32,11 @@ call s:check_defined('g:airline_exclude_funcrefs', []) call s:check_defined('g:airline_mode_map', { \ 'n' : 'NORMAL', \ 'i' : 'INSERT', - \ 'R' : 'RPLACE', + \ 'R' : 'REPLACE', \ 'v' : 'VISUAL', \ 'V' : 'V-LINE', \ 'c' : 'CMD ', - \ '' : 'V-BLCK', + \ '' : 'V-BLOCK', \ }) let s:airline_initialized = 0