Improving Projectile with extra commands11 Apr 2016, by Artur Malabarba.
Admittedly, I’m a very late passenger in this boat — only after 4 years of using Emacs did I decide to try a project manager. Nowadays I can’t even remember my daily workflow without Projectile. This package mostly stays out of your way, and provides a series of useful commands for dealing with a project (which are aware of a lot of languages out-of-the-box). As usual, you can find details in the readme, and we’ll jump straight into useful configurations.
This places all Projectile keybinds under C-x p and requires no explanation.
Mnemonic keymaps are the best. Most used
commands are C-x p f to find a file, and C-x p p to
bring up the commander menu (see below)
C-x p t creates test files for me.
By default, Projectile brings up the file-finder when you switch project with
C-x p p. That’s a reasonable default, but I find a lot of times I’m also looking for
magit-status or a shell buffer. Using
projectile-commander means I have to
hit an extra key, but it always gets me where I want.
Furthermore, the menu of alternatives presented by
very customizable, so we can add anything we want in there.
The first of those brings up a shell buffer in the project root and the second
compile. Both are super duper convenient for quickly running builds
or custom commands, and which one you use is entirely up to situational
The s key would normally be bound to project-switching. Since we’ve changed that above, it’s useful to make Backspace take that role. This makes sense to me. It’s like I’m “backing out” of the commander menu.
By default d would be bound to
projectile-find-dir, but that’s something I
projectile-dired takes you to the root directory instead, which I
find more useful.
These two are more situational, but I’ve found I use them a lot. Whenever I sit down to work, there’s a good chance I’m either going to start a REPL (j) or fetch git remotes (F).
And last but not nearly least.
Used Projectile’s built-in