1

では~/.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 の質問:

4

0 に答える 0