vim-airline/autoload/airline/extensions/ctrlp.vim

60 lines
2.4 KiB
VimL
Raw Normal View History

2013-08-02 13:56:12 -04:00
" MIT license. Copyright (c) 2013 Bailey Ling.
" vim: ts=2 sts=2 sw=2 fdm=indent
function! airline#extensions#ctrlp#generate_color_map(dark, light, white)
return {
\ 'CtrlPdark' : a:dark,
\ 'CtrlPlight' : a:light,
\ 'CtrlPwhite' : a:white,
\ 'CtrlParrow1' : [ a:light[1] , a:white[1] , a:light[3] , a:white[3] , '' ] ,
\ 'CtrlParrow2' : [ a:white[1] , a:light[1] , a:white[3] , a:light[3] , '' ] ,
\ 'CtrlParrow3' : [ a:light[1] , a:dark[1] , a:light[3] , a:dark[3] , '' ] ,
\ }
endfunction
function! airline#extensions#ctrlp#load_theme()
2013-07-26 13:21:43 -04:00
if exists('g:airline#themes#{g:airline_theme}#ctrlp')
let theme = g:airline#themes#{g:airline_theme}#ctrlp
else
let theme = airline#extensions#ctrlp#generate_color_map(
2013-08-15 22:02:32 -04:00
\ g:airline#themes#{g:airline_theme}#insert['airline_c'],
\ g:airline#themes#{g:airline_theme}#insert['airline_b'],
\ g:airline#themes#{g:airline_theme}#insert['airline_a'])
2013-07-26 13:21:43 -04:00
endif
for key in keys(theme)
2013-08-17 08:50:07 -04:00
call airline#highlighter#exec(key, theme[key])
2013-07-26 13:21:43 -04:00
endfor
2013-07-06 04:20:20 -04:00
endfunction
" Arguments: focus, byfname, s:regexp, prv, item, nxt, marked
2013-07-07 08:41:36 -04:00
function! airline#extensions#ctrlp#ctrlp_airline(...)
2013-07-06 04:20:20 -04:00
let regex = a:3 ? '%#CtrlPlight# regex %*' : ''
let prv = '%#CtrlPlight# '.a:4.' %#Ctrlparrow1#'.g:airline_left_sep
let item = '%#CtrlPwhite# '.a:5.' %#CtrlParrow2#'.g:airline_left_sep
let nxt = '%#CtrlPlight# '.a:6.' %#CtrlParrow3#'.g:airline_left_sep
let marked = '%#CtrlPdark# '.a:7.' '
let focus = '%=%<%#CtrlPdark# '.a:1.' %*'
let byfname = '%#CtrlParrow3#'.g:airline_right_alt_sep.'%#CtrlPdark# '.a:2.' %*'
2013-07-06 04:20:20 -04:00
let dir = '%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*'
return regex.prv.item.nxt.marked.focus.byfname.dir
endfunction
" Argument: len
2013-07-07 08:41:36 -04:00
function! airline#extensions#ctrlp#ctrlp_airline_status(...)
let len = '%#CtrlPdark# '.a:1
let dir = '%=%<%#CtrlParrow3#'.g:airline_right_sep.'%#CtrlPlight# '.getcwd().' %*'
2013-07-06 04:20:20 -04:00
return len.dir
endfunction
function! airline#extensions#ctrlp#is_statusline_overwritten()
return match(&statusline, 'CtrlPlight') >= 0
endfunction
function! airline#extensions#ctrlp#init(ext)
let g:ctrlp_status_func = {
\ 'main': 'airline#extensions#ctrlp#ctrlp_airline',
\ 'prog': 'airline#extensions#ctrlp#ctrlp_airline_status',
\ }
call a:ext.add_cursormove_funcref(function('airline#extensions#ctrlp#is_statusline_overwritten'))
endfunction