ctrlp still searches the ignored directory

前端 未结 5 1560
生来不讨喜
生来不讨喜 2020-12-10 01:34

I tried to put ignored setting in .vimrc

But when I used the ctrlp to search under rails app folder

It still search the vendor fold

相关标签:
5条回答
  • 2020-12-10 01:57

    If you type :help ctrlp-options and read a bit, you will find:

    Note #1: by default, wildignore and g:ctrlp_custom_ignore only apply when globpath() is used to scan for files, thus these options do not apply when a command defined with g:ctrlp_user_command is being used.

    Thus, you may need to unlet g:ctrlp_user_command (possibly set to a default command) to actually use wildignore as advised by @TomCammann. For instance, in your ~/.vimrc, add:

    if exists("g:ctrlp_user_command")
      unlet g:ctrlp_user_command
    endif
    set wildignore+=*\\vendor\\**
    

    After that, you need to refresh your ctrlp cache: in Vim, press F5 in ctrlp mode, or run :CtrlPClearAllCaches, or remove the cache directory directly in your shell:

    rm -r ~/.cache/ctrlp/      # On Linux
    
    0 讨论(0)
  • 2020-12-10 02:00

    part of my .vimrc file . perhaps it will help

      set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.idea/*,*/.DS_Store,*/vendor
    
    0 讨论(0)
  • 2020-12-10 02:08

    You can use the wildignore vim setting which CtrlP will pick up on.

    set wildignore+=*\\vendor\\**
    
    0 讨论(0)
  • 2020-12-10 02:13

    Check if you are using some specific search command, like:

    let g:ctrlp_user_command = 'find %s -type f'        " MacOSX/Linux
    let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d'  " Windows
    

    This kind of configuration ignores the g:ctrlp_custom_ignore option.

    0 讨论(0)
  • 2020-12-10 02:17

    wildignore may be used by other commands, the reason of failure for g:ctrlp_custom_ignore is g:ctrlp_user_command, for example, here is mine:

    if executable('rg')
        let g:ctrlp_user_command = 'rg %s --files --hidden --color=never --glob ""'
    endif
    

    For this case, rg has own ignore way, just put .git to .gitignore, rg will not search any files in .gitignore.

    0 讨论(0)
提交回复
热议问题