在~/.vimrc
中,我设置了:
" Configure CtrlP
" Ctrl-O opens CtrlP for the current word.
map <C-o> <C-P><C-\>w
" Ensure we aren't using a custom command.
if exists("g:ctrl_user_command")
unlet g:ctrlp_user_command
endif
" Specify the cache directory.
let g:ctrlp_cache_dir = $HOME . '/.cache/ctrlp'
" Ignore certain files and directories.
let g:ctrlp_custom_ignore = {
\ 'dir': '\v(\.git|\.hg|\.svn\|vendor|tmp)$',
\ 'file': '\v\.(swp|swo)$',
\ 'link': '',
\ }
" Disable opening files in a new buffer ("e").
" Default to opening files in a new tab ("t").
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': [],
\ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ }
但是,CtrlP 继续索引文件vendor/
:
$ grep -c '^vendor/' ~/.cache/ctrlp/%Users%nick%src%todo.txt
11759
如果我删除g:ctrlp_custom_ignore
并添加这个:
set wildignore+=*/tmp/*,*.so,*.swp,*.swo,*/vendor/*,*/\.git/*
CtrlP 不索引vendor/
. 为什么 CtrlP 不使用g:ctrlp_custom_ignore
?
相关的SO问题: