Closed Ashe closed 3 years ago
Set ctrlp_user_command git ls-files
, or please use https://github.com/mattn/ctrlp-git
Set ctrlp_user_command
git ls-files
, or please use https://github.com/mattn/ctrlp-git
Thank you for your swift reply. I'm trying to do as you suggest, but it doesn't appear to be working. Performing git ls-files
by hand shows exactly what files I want to select from, but with this as my ctrlp
config it doesn't seem to work as expected:
" Fuzzy search
Plug 'ctrlpvim/ctrlp.vim'
" Configure CTRLP to show git files
let g:ctrlp_user_cmd = 'git ls-files'
set wildignore+=*/tmp/*,*/bin/*,*/obj/*,*.so,*.swp,*.zi
It still shows all non-hidden files :/ Did I do something wrong? I'm using neovim, if that matters?
Hi @Ashe sorry to bring up an old thread! I just saw this and wanted to mention that this little bit from the readme worked for what I think you described.
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
This lead me to the following result:
(the best pic I could get, but it doesn't have the files which are gitignored).
Also using Neovim, so hopefully this should work for you!
Hi @Ashe sorry to bring up an old thread! I just saw this and wanted to mention that this little bit from the readme worked for what I think you described.
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files -co --exclude-standard']
Also using Neovim, so hopefully this should work for you!
I really don't understand how I didn't solve this myself from the readme. I'm really sorry for writing this issue and leaving it open like this >< I swear I tried it, I spent ages looking for a solution. Perhaps my config was broken in some other way that interfered, but I like to believe I wouldn't have made this issue unless I really needed to :sweat:
Anyway, thank you so much after all this time!
No problem! Glad it worked for you.
I'm not sure if this is a feature or not, but I'm sure someone has a way of doing this.
How would I go about using CTRL-P to only search through tracked files if using a git folder as the project's root? Some of my projects have non-hidden build directories and it's very annoying having to sift through all of those build files which have the same names as their source-code counterparts.
Similarly, my entire home folder is a git project since I work on my dotfiles. The files I actually want to edit don't display because they're all in hidden directories like
.config
, and all of the files that I wouldn't want to open such as.pdf
,.mp3
etc clutter the list even though they're all ignored by default.