vimctrlp

Vim ctrlp only works with a git repo


The vim plugin ctrl p only works for me into git repo.

Why does it need a .git file?

Be work i mean it is searching my entire machine when no .git file is found.

my settings

let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_match_window = 'top,order:ttb,min:1,max:30,results:30'
let g:ctrlp_custom_ignore = 'node_modules\|vendor/|DS_Store\|git'
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.idea/*,*/.DS_Store,*/vendor

Also tried:

let g:ctrlp_working_path_mode = 'r'
let g:ctrlp_working_path_mode = 'c'

Solution

  • I'm not entirely sure what you are after, it sounds like you want ctrlp to pick up all files system wide and not just the "project" root directory.

    The g:ctrlp_working_path_mode flags you set would either tell ctrlp c - only show me files from current loaded buffers directory including subdirectories, or r the first project root directory as identified with some sort of hidden repository directory like .git. Neither of which suggests what I think you are asking for...

    So I'll go out of a limb and suggest that you can probably update the global variable:

    let g:ctrlp_cmd = 'CtrlP /'
    

    To look for all files, on a linux system. As detailed in the reader:

    Run :CtrlP or :CtrlP [starting-directory] to invoke CtrlP in find file mode.
    

    Or test the above with CtrlP / in command mode first.

    Again, I've guessed what you wanted here...