File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1526,9 +1526,17 @@ fu! ctrlp#dirnfile(entries)
15261526endf
15271527
15281528fu ! s: usrign (item, type )
1529- retu s: igntype == 1 ? a: item = ~ s: usrign
1530- \ : s: igntype == 4 && has_key (s: usrign , a: type ) && s: usrign [a: type ] != ' '
1531- \ ? a: item = ~ s: usrign [a: type ] : 0
1529+ if s: igntype == 1 | retu a: item = ~ s: usrign | end
1530+ if s: igntype == 4
1531+ if has_key (s: usrign , a: type ) && s: usrign [a: type ] != ' '
1532+ \ && a: item = ~ s: usrign [a: type ]
1533+ retu 1
1534+ elsei has_key (s: usrign , ' func' ) && s: usrign [' func' ] != ' '
1535+ \ && call (s: usrign [' func' ], [a: item , a: type ])
1536+ retur 1
1537+ end
1538+ end
1539+ retu 0
15321540endf
15331541
15341542fu ! s: samerootsyml (each, isfile, cwd)
Original file line number Diff line number Diff line change @@ -260,6 +260,9 @@ Examples: >
260260 let g:ctrlp_custom_ignore = {
261261 \ 'file': '\v(\.cpp|\.h|\.hh|\.cxx)@<!$'
262262 \ }
263+ let g:ctrlp_custom_ignore = {
264+ \ 'func': 'some#custom#match_function'
265+ \ }
263266<
264267Note #1: by default, | wildignore | and | g:ctrlp_custom_ignore | only apply when
265268| globpath() | is used to scan for files, thus these options do not apply when a
@@ -268,6 +271,12 @@ command defined with |g:ctrlp_user_command| is being used.
268271Note #2: when changing the option's variable type, remember to | :unlet | it
269272first or restart Vim to avoid the "E706: Variable type mismatch" error.
270273
274+ Note #3: when using the "func" ignore type, you must provide the full name of
275+ a function that can be called from CtrlP. An | autoload | function name is
276+ recommended here. The function must take 2 parameters, the item to match and
277+ its type. The type will be "dir", "file", or "link". The function must return
278+ 1 if the item should be ignored, 0 otherwise.
279+
271280 *'g:ctrlp_max_files'*
272281The maximum number of files to scan, set to 0 for no limit: >
273282 let g:ctrlp_max_files = 10000
You can’t perform that action at this time.
0 commit comments