Add some highlight groups

* Add a few ctrlp specific highlight groups to make customization easier.
* Document the highlight groups ctrlp uses.

Close #127
This commit is contained in:
Kien N 2012-02-04 18:41:27 +07:00
parent 167ad5341a
commit 2e5e5041ec
2 changed files with 38 additions and 9 deletions

View File

@ -18,7 +18,7 @@ fu! s:opts()
\ 'g:ctrlp_dotfiles': ['s:dotfiles', 1], \ 'g:ctrlp_dotfiles': ['s:dotfiles', 1],
\ 'g:ctrlp_extensions': ['s:extensions', []], \ 'g:ctrlp_extensions': ['s:extensions', []],
\ 'g:ctrlp_follow_symlinks': ['s:folsym', 0], \ 'g:ctrlp_follow_symlinks': ['s:folsym', 0],
\ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'Identifier']], \ 'g:ctrlp_highlight_match': ['s:mathi', [1, 'CtrlPMatch']],
\ 'g:ctrlp_jump_to_buffer': ['s:jmptobuf', 2], \ 'g:ctrlp_jump_to_buffer': ['s:jmptobuf', 2],
\ 'g:ctrlp_lazy_update': ['s:lazy', 0], \ 'g:ctrlp_lazy_update': ['s:lazy', 0],
\ 'g:ctrlp_match_window_bottom': ['s:mwbottom', 1], \ 'g:ctrlp_match_window_bottom': ['s:mwbottom', 1],
@ -195,8 +195,8 @@ fu! ctrlp#clra(...)
cal ctrlp#clr() cal ctrlp#clr()
endf endf
fu! ctrlp#reset() fu! ctrlp#reset(...)
if ( has('dialog_gui') || has('dialog_con') ) && if !exists('a:1') && ( has('dialog_gui') || has('dialog_con') ) &&
\ confirm("Reset and apply new options?", "&OK\n&Cancel") != 1 | retu | en \ confirm("Reset and apply new options?", "&OK\n&Cancel") != 1 | retu | en
cal s:opts() cal s:opts()
cal ctrlp#utils#opts() cal ctrlp#utils#opts()
@ -965,12 +965,12 @@ fu! ctrlp#statusline()
let args = [focus, byfname, s:regexp, prv, item, nxt, marked] let args = [focus, byfname, s:regexp, prv, item, nxt, marked]
let &l:stl = call(s:status['main'], args) let &l:stl = call(s:status['main'], args)
el el
let item = '%#Character# '.item.' %*' let item = '%#CtrlPMode1# '.item.' %*'
let focus = '%#LineNr# '.focus.' %*' let focus = '%#CtrlPMode2# '.focus.' %*'
let byfname = '%#Character# '.byfname.' %*' let byfname = '%#CtrlPMode1# '.byfname.' %*'
let regex = s:regexp ? '%#LineNr# regex %*' : '' let regex = s:regexp ? '%#CtrlPMode2# regex %*' : ''
let slider = ' <'.prv.'>={'.item.'}=<'.nxt.'>' let slider = ' <'.prv.'>={'.item.'}=<'.nxt.'>'
let dir = ' %=%<%#LineNr# '.getcwd().' %*' let dir = ' %=%<%#CtrlPMode2# '.getcwd().' %*'
let &l:stl = focus.byfname.regex.slider.marked.dir let &l:stl = focus.byfname.regex.slider.marked.dir
en en
endf endf
@ -983,7 +983,7 @@ endf
fu! ctrlp#progress(enum) fu! ctrlp#progress(enum)
if has('macunix') || has('mac') | sl 1m | en if has('macunix') || has('mac') | sl 1m | en
let &l:stl = has_key(s:status, 'prog') ? call(s:status['prog'], [a:enum]) let &l:stl = has_key(s:status, 'prog') ? call(s:status['prog'], [a:enum])
\ : '%#Function# '.a:enum.' %* %=%<%#LineNr# '.getcwd().' %*' \ : '%#CtrlPStats# '.a:enum.' %* %=%<%#CtrlPMode2# '.getcwd().' %*'
redr redr
endf endf
" Paths {{{2 " Paths {{{2
@ -1117,7 +1117,12 @@ fu! s:syntax()
sy match CtrlPNoEntries '^ == NO ENTRIES ==$' sy match CtrlPNoEntries '^ == NO ENTRIES ==$'
sy match CtrlPLinePre '^>' sy match CtrlPLinePre '^>'
hi link CtrlPNoEntries Error hi link CtrlPNoEntries Error
hi link CtrlPMode1 Character
hi link CtrlPMode2 LineNr
hi link CtrlPStats Function
hi link CtrlPMatch Identifier
if hlexists('Normal') if hlexists('Normal')
" Hide the prefix
sil! exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg' sil! exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg'
en en
endf endf

View File

@ -693,6 +693,30 @@ Examples: >
\ } \ }
< <
===============================================================================
CUSTOMIZATION *ctrlp-customization*
Highlighting:~
* For the buffer:
CtrlPNoEntries (links to |hl-Error|)
CtrlPMatch (links to |hl-Identifier|)
CtrlPLinePre (links to |hl-Normal|s |guibg| and |ctermbg|)
* In extensions:
CtrlPTabExtra (links to |hl-Comment|)
CtrlPqfLineCol (links to |hl-Search|)
CtrlPUndoT (links to |hl-Directory|)
CtrlPUndoBr (links to |hl-Comment|)
CtrlPUndoNr (links to |hl-String|)
Statuslines:~
* Highlight groups:
CtrlPMode1 (links to |hl-Character|)
CtrlPMode2 (links to |hl-LineNr|)
CtrlPStats (links to |hl-Function|)
For rebuilding the statuslines, see |g:ctrlp_status_func|.
=============================================================================== ===============================================================================
CREDITS *ctrlp-credits* CREDITS *ctrlp-credits*