0

: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

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

4

1 回答 1

0

采购 .vimrc 文件是不够的;我必须运行CtrlPClearCachor CtrlPClearAllCaches,并且alias ag='ag -U --skip-vcs-ignores --path-to-ignore ~/.ignore'.bash_prifile将只使用该.ignore文件。

于 2019-08-21T10:13:17.197 回答