Skip to content

Commit 8150fdd

Browse files
authored
Merge pull request #599 from ydzhou/master
Update doc related to wildignore
2 parents 3f1ba86 + 2580134 commit 8150fdd

2 files changed

Lines changed: 10 additions & 36 deletions

File tree

doc/ctrlp.cnx

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -241,22 +241,8 @@ OPTIONS *ctrlp-options*
241241
<
242242
注意: 当命令使用 |g:ctrlp_user_command| 定义时该选项无效。
243243

244-
*'ctrlp-wildignore'*
245-
你可以使用Vim的 |'wildignore'| 来从结果集中排序文件或目录。
246-
例子: >
247-
" 排除版本控制文件
248-
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
249-
set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash')
250-
<
251-
注意 #1: 每个目录设置前的字符 `*/` 是必须的。
252-
253-
注意 #2: |wildignore| 影响 |expand()||globpath()||glob()| 的结果,这些函数被很
254-
多插件用来在系统中执行查找。(例如和版本控制系统有关的插件在查找.git/、.hg/等,
255-
一些其他插件用来在Windows上查找外部的*.exe工具),所以要修改 |wildignore| 时请先
256-
考虑清楚。
257-
258244
*'g:ctrlp_custom_ignore'*
259-
作为对 |'wildignore'||g:ctrlp_show_hidden| 的补充,用来设置你只是想在CtrlP中隐藏的文件和目录。使用正
245+
除了 |g:ctrlp_show_hidden|,你可以用这个选项设置你想在CtrlP中隐藏的文件和目录。使用正
260246
则表达式来指定匹配模式: >
261247
let g:ctrlp_custom_ignore = ''
262248
<
@@ -274,9 +260,7 @@ OPTIONS *ctrlp-options*
274260
\ 'func': 'some#custom#match_function'
275261
\ }
276262
<
277-
注意 #1: 默认情况下, |wildignore||g:ctrlp_custom_ignore| 只在 |globpath()| 被用
278-
来扫描文件的情况下使用,这样这些选项在那些使用 |g:ctrlp_user_command| 定义的命
279-
令中不会生效。
263+
注意 #1: |g:ctrlp_custom_ignore| 在已经使用 |g:ctrlp_user_command| 的时候不会生效。
280264

281265
注意 #2: 当改变选项的变量类型时,记得先 |:unlet| ,或者重启Vim来避免这个错误:
282266
"E706: Variable type mismatch" 。
@@ -285,6 +269,9 @@ OPTIONS *ctrlp-options*
285269
自动加载的函数。函数必须接受两个参数,要匹配的条目和接受的类型,类型可以是目
286270
录、文件和链接。如果条目被忽略,函数需要返回1,反之,返回0。
287271

272+
注意 #4: 如果设置 |g:ctrlp_use_readdir| 为0,你可以使用 Vim 的 |'wildignore'|
273+
来将文件和目录排除出搜索结果。
274+
288275
*'g:ctrlp_max_files'*
289276
扫描文件的最大数量,设置为0时不进行限制: >
290277
let g:ctrlp_max_files = 10000

doc/ctrlp.txt

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -240,23 +240,8 @@ Set this to 1 if you want CtrlP to scan for dotfiles and dotdirs: >
240240
Note: does not apply when a command defined with |g:ctrlp_user_command| is
241241
being used.
242242

243-
*'ctrlp-wildignore'*
244-
You can use Vim's |'wildignore'| to exclude files and directories from the
245-
results.
246-
Examples: >
247-
" Excluding version control directories
248-
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
249-
set wildignore+=*\\.git\\*,*\\.hg\\*,*\\.svn\\* " Windows ('noshellslash')
250-
<
251-
Note #1: the `*/` in front of each directory glob is required.
252-
253-
Note #2: |wildignore| influences the result of |expand()|, |globpath()| and
254-
|glob()| which many plugins use to find stuff on the system (e.g. VCS related
255-
plugins look for .git/, .hg/,... some other plugins look for external *.exe
256-
tools on Windows). So be a little mindful of what you put in your |wildignore|.
257-
258243
*'g:ctrlp_custom_ignore'*
259-
In addition to |'wildignore'| and |g:ctrlp_show_hidden|, use this for files
244+
In addition to |g:ctrlp_show_hidden|, use this for files
260245
and directories you want only CtrlP to not show. Use regexp to specify the
261246
patterns: >
262247
let g:ctrlp_custom_ignore = ''
@@ -275,8 +260,7 @@ Examples: >
275260
\ 'func': 'some#custom#match_function'
276261
\ }
277262
<
278-
Note #1: by default, |wildignore| and |g:ctrlp_custom_ignore| only apply when
279-
|globpath()| is used to scan for files, thus these options do not apply when a
263+
Note #1: |g:ctrlp_custom_ignore| does not apply when a
280264
command defined with |g:ctrlp_user_command| is being used.
281265

282266
Note #2: when changing the option's variable type, remember to |:unlet| it
@@ -288,6 +272,9 @@ recommended here. The function must take 2 parameters, the item to match and
288272
its type. The type will be "dir", "file", or "link". The function must return
289273
1 if the item should be ignored, 0 otherwise.
290274

275+
Note #4: when |g:ctrlp_use_readdir| is set to 0, you can also use Vim's |'wildignore'|
276+
to exclude files and directories.
277+
291278
*'g:ctrlp_max_files'*
292279
The maximum number of files to scan, set to 0 for no limit: >
293280
let g:ctrlp_max_files = 10000

0 commit comments

Comments
 (0)