ctrlp 只搜索文件中 ag.1.md 行?



:CtrlPBuffer<CR><c-d>:CtrlPMRU<CR><c-d>正常工作,但是当我使用:CtrlP<CR><c-d>时,列表始终为空,如果我在提示符内键入--,它与以下行匹配:

>      --ackmate            Print results in AckMate-parseable format
>      --ignore PATTERN     Ignore files/directories matching PATTERN
>      --one-device         Don't follow links to other devices.
>      --[no]group          Same as --[no]break --[no]heading
>      --column             Print column numbers in results
>      --search-binary      Search binary files for matches
>      --stats-only         Print stats and nothing else.
> ag: unrecognized option `--hiden'
>   ag --list-file-types
>   ag --html needle

似乎在 the_silver_searcher/doc/ag.1.md 中。我发现了--hiden错别字 在let g:ctrlp_user_command = 'ag %s -l --nocolor --hiden -g ""'并修复了它,所以现在:echo g:ctrlp_user_command打印ag %s -l --nocolor --hidden -g "",但它仍然给出相同的结果:CtrlPBuffer<CR><c-d>

在我的.vimrc

Plugin 'ctrlpvim/ctrlp.vim', {'on': ['CtrlP', 'CtrlPMixed', 'CtrlPMRU']}
Plugin 'FelikZ/ctrlp-py-matcher'
...
let g:ctrlp_mruf_max = 20
nnoremap <silent> <Space>f :CtrlP<CR><c-d>
nnoremap <silent> <Space>F :CtrlP<CR>
nnoremap <silent> <Space>b :CtrlPBuffer<CR><c-d>
nnoremap <silent> <Space>r :CtrlPMRU<CR><c-d>
let g:ctrlp_working_path_mode = 'c'
...
let g:ctrlp_prompt_mappings = {
 'CreateNewFile()':      ['<c-n>'],
 }
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
let g:ctrlp_lazy_update = 350
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_max_files = 0
" If ag is available use it as filename list generator instead of 'find'
if executable("ag")
set grepprg=ag --nogroup --nocolor
let g:ctrlp_user_command = 'ag %s -l --nocolor --hidden -g ""'
endif

在我的.bash_profile

alias ag='ag --path-to-ignore ~/.ignore'

我的全球.ignore

pyc
__pycache__/
git
tmp
swp
swo

我的.gitignore_global

*~
.DS_Store
.pyc
__pycache__/

我的.hgignore_global

syntax: glob
*~
.DS_Store

如何解决此问题? 我的忽略文件有问题吗?

获取.vimrc文件是不够的;我必须运行CtrlPClearCachCtrlPClearAllCaches,并且.bash_prifile中的alias ag='ag -U --skip-vcs-ignores --path-to-ignore ~/.ignore'将仅使用.ignore文件。

最新更新