Closed benyaminl closed 2 years ago
fallback
is basically used when the root marker was NOT found.
I'm assuming that your project is a Git repository, so the fallback is not used in this case. That's why files and directories that is configured in .gitignore
are not listed by ctrlp.
Although I haven't found the best way yet, like this configuration meet your needs?
let g:ctrlp_user_command = ['.git', 'cd %s && (git ls-files . -co --exclude-standard; find -path ./node_modules/* -print -type f)', 'find %s -type f']
I think I get it. So when It's git then it's using git only file finder. For now I'll stick with only find %s -type f, but the problem is why the filter or ignore not working? Does it only work with globalpath only? Thanks
On Wed, 13 Nov 2019 19:12:01 -0800 Takahiro Yoshihara notifications@github.com wrote:
fallback
is basically used when the root marker was NOT found. I'm assuming that your project is a Git repository, so the fallback is not used in this case. That's why files and directories that is configured in.gitignore
are not listed by ctrlp. Although I haven't found the best way yet, like this configuration meet your needs?vim let g:ctrlp_user_command = ['.git', 'cd %s && (git ls-files . -co --exclude-standard; find -path ./node_modules/* -print -type f)', 'find %s -type f']
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/ctrlpvim/ctrlp.vim/issues/529#issuecomment-553704384
-- Benyamin Limanto
sent from ThinkPad X240 with Claws Mail
'filter' and 'ignore' for what? you mean ctrlp settings?
'filter' and 'ignore' for what? you mean ctrlp settings?
Yeah, I ignore .git folder but the folder still shown anyway
I'm guessing is that you are configuring like let g:ctrlp_user_command = 'find %s -type f'
.
In that case any filter / ignore mechanism which CtrlP provides don't work as documented.
There are some ways to achieve your needs:
rg
, ag
, etc. instead of find
to list files
I use let g:ctrlp_user_command = 'rg %s -i --files --no-heading --max-depth 10'
find
command
E.g. find %s -type f ! -path '*/.git/*'
unlet g:ctrlp_user_command
unlet g:ctrlp_custom_ignore
let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
A caveat here is that CtrlP built-in approach should be slow.
I'm guessing is that you are configuring like
let g:ctrlp_user_command = 'find %s -type f'
. In that case any filter / ignore mechanism which CtrlP provides don't work as documented.There are some ways to achieve your needs:
- Using better grep alternatives like
rg
,ag
, etc. instead offind
to list files I uselet g:ctrlp_user_command = 'rg %s -i --files --no-heading --max-depth 10'
- Adding filters to
find
command E.g.find %s -type f ! -path '*/.git/*'
- Using CtrlP built-in file listing command and ignore mechanism
unlet g:ctrlp_user_command unlet g:ctrlp_custom_ignore let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
A caveat here is that CtrlP built-in approach should be slow.
I think it should be documented on the documentation page, or maybe I'm missing something there? Thanks. My guess it right. Thanks!
I use let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f'] but I want still able to search on node_modules and vendor folder but seems it only follow the git ls-files but not find -type f, is it a problem or maybe I'm wrong? Thanks
https://ctrlpvim.github.io/ctrlp.vim/
even the fallback one { \ 'types': { \ 1: ['.git', 'cd %s && git ls-files'], \ 2: ['.hg', 'hg --cwd %s locate -I .'], \ }, \ 'fallback': 'find %s -type f' \ }