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