Problem
Putting a .projectile
into a directory is enough to make it a project root in spacemacs, making it easy to search the entire directory and list its files.
Listing files in a project is easily done with SPC p f
. There is a native
mode and an alien
mode, the former uses Emacs code to do the file listing, the latter uses external programs. The default is alien
and usually that’s fine and much faster. It will use git
inside a git repository, find
when there’s just a .projectile
.
See the projectile documentation for details.
However, if you have projects, like me, that have several subdirectories that contain git repositories, like so:
.
└── src
├── repo1
│ └── .git
├── repo2
│ └── .git
└── repo3
└── .git
then projectile cannot use git
to list files, as it would, if the root were a git repository. It uses find
and with that it also lists all .git
directories. Adding “.git” to .projectile
or projectile-globally-ignored-directories
doesn’t help in this case. At least I couldn’t make it work.
Solution
So I ended up just adjusting the find
command projectile uses.
(setq projectile-generic-command
"find . -type f ! -ipath '.git*' ! -ipath '*/.git*' ! -ipath '*/build/*' -print0")
That also hides files in build
subdirectories. And the file list becomes much more manageable.