diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 4425a9e..b85d908 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -12,6 +12,7 @@ fu! s:opts() let [pref, opts] = ['g:ctrlp_', { \ 'arg_map': ['s:argmap', 0], \ 'by_filename': ['s:byfname', 0], + \ 'buffer_func': ['s:buffunc', {}], \ 'clear_cache_on_exit': ['s:clrex', 1], \ 'custom_ignore': ['s:usrign', ''], \ 'default_input': ['s:deftxt', 0], @@ -175,6 +176,7 @@ fu! s:Open() cal s:getenv() cal s:execextvar('enter') sil! exe 'noa keepa' ( s:mwbottom ? 'bo' : 'to' ) '1new ControlP' + cal s:buffunc(1) let [s:bufnr, s:prompt, s:winw] = [bufnr('%'), ['', '', ''], winwidth(0)] abc if !exists('s:hstry') @@ -191,6 +193,7 @@ fu! s:Open() endf fu! s:Close() + cal s:buffunc(0) try | noa bun! cat | noa clo! | endt cal s:unmarksigns() @@ -1492,6 +1495,14 @@ fu! s:log(m) en | en endf +fu! s:buffunc(e) + if a:e && has_key(s:buffunc, 'enter') + cal call(s:buffunc['enter'], []) + elsei !a:e && has_key(s:buffunc, 'exit') + cal call(s:buffunc['exit'], []) + en +endf + fu! s:openfile(cmd, fid, tail, ...) let cmd = a:cmd =~ '^[eb]$' && &modified ? 'hid '.a:cmd : a:cmd let cmd = cmd =~ '^tab' ? tabpagenr('$').cmd : cmd diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index e5c1510..25aff63 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -374,6 +374,9 @@ works in regexp mode. To split the pattern, separate words with space: > let g:ctrlp_use_migemo = 0 < +------------------------------------------------------------------------------- +ADVANCED OPTIONS *ctrlp-advanced-options* + *'g:ctrlp_status_func'* Use this to customize the statuslines for the CtrlP window: > let g:ctrlp_status_func = {} @@ -417,6 +420,18 @@ Structure of the functions: > < See https://gist.github.com/1610859 for a working example. + *'g:ctrlp_buffer_func'* +Specify the functions that will be called after entering and before exiting the +CtrlP buffer: > + let g:ctrlp_buffer_func = {} +< +Example: > + let g:ctrlp_buffer_func = { + \ 'enter': 'Function_Name_1', + \ 'exit': 'Function_Name_2', + \ } +< + *'g:ctrlp_match_func'* Set an external fuzzy matching function for CtrlP to use: > let g:ctrlp_match_func = {} @@ -904,14 +919,15 @@ Special thanks:~ =============================================================================== CHANGELOG *ctrlp-changelog* + + New option: |g:ctrlp_buffer_func|, callback functions for CtrlP buffer. + Remove: g:ctrlp_mruf_last_entered, make it a default for MRU mode. + New commands: |:CtrlPLastMode|, open CtrlP in the last mode used. |:CtrlPMixed|, search in files, buffers and MRU files. Before 2012/03/31~ - + New option: |g:ctrlp_default_input|, default input when entering CtrlP. - |g:ctrlp_match_func|, allow using a custom fuzzy matcher. + + New options: |g:ctrlp_default_input|, default input when entering CtrlP. + |g:ctrlp_match_func|, allow using a custom fuzzy matcher. + Rename: *ClearCtrlPCache* -> |CtrlPClearCache| *ClearAllCtrlPCaches* -> |CtrlPClearAllCaches|