忽略 ctrlp.vim 中的 .git 目录

Ignore .git directory in ctrlp.vim

在我的 .vimrc 中,我有一些 ctrlp.vim 的自定义元素。有几个我想忽略的以点开头的目录:.git 就是一个很好的例子。通过在忽略中包含 .git,我也忽略了像 git.sh 这样的单个文件。我只想忽略 .git。我做错了什么?

let g:ctrlp_custom_ignore = 'node_modules\|DS_Store\|bower_components\|.sass-cache\|.git\|build'

您需要指定 .git 是专门的目录忽略。 来自文档的示例:https://github.com/kien/ctrlp.vim

let g:ctrlp_custom_ignore = {
  \ 'dir':  '\v[\/]\.(git|hg|svn)$',
  \ 'file': '\v\.(exe|so|dll)$',
  \ 'link': 'some_bad_symbolic_links',
  \ }