I've been playing with the user command trying to respect any .gitignore files and came up with the following solution:
let g:ctrlp_user_command = 'git ls-files -co --exclude-standard $(git rev-parse --show-toplevel 2> /dev/null) 2> /dev/null || find . -type f'
How it works:
git rev-parse --show-toplevel 2> /dev/null finds the root of the git repo, if any.
git ls-files -co --exclude-standard $(...) 2> /dev/null lists all files from git root, excluding ignored files, relative to the current working directory.
find . -type f is a fallback solution in case any of the previous commands fails and will simply list all files in and below the current working directory.
I've been playing with the user command trying to respect any .gitignore files and came up with the following solution:
How it works:
git rev-parse --show-toplevel 2> /dev/null
finds the root of the git repo, if any.git ls-files -co --exclude-standard $(...) 2> /dev/null
lists all files from git root, excluding ignored files, relative to the current working directory.find . -type f
is a fallback solution in case any of the previous commands fails and will simply list all files in and below the current working directory.