= Command reference

Projectile provides a large number of interactive commands. This page is the full keybinding reference; the notation assumes the kbd:[s-p] prefix.

NOTE: Projectile doesn't have a default key prefix for its commands, but all the examples
 in the manual assume you've opted for kbd:[s-p] (`super`-p).

Here's a list of the interactive Emacs Lisp functions, provided by Projectile:

|===
| Keybinding | Description

| kbd:[s-p f]
| Display a list of all files in the project. With a prefix argument it will clear the cache first.

| kbd:[s-p F]
| Display a list of all files in all known projects.

| kbd:[s-p g]
| Display a list of all files at point in the project. With a prefix argument it will clear the cache first.

| kbd:[s-p 4 4]
| Display the buffer of the next command in another window (see the note on prefix commands below).

| kbd:[s-p 5 5]
| Display the buffer of the next command in another frame (see the note on prefix commands below).

| kbd:[s-p 4 f]
| Jump to a project's file using completion and show it in another window.

| kbd:[s-p 4 g]
| Jump to a project's file based on context at point and show it in another window.

| kbd:[s-p 5 f]
| Jump to a project's file using completion and show it in another frame.

| kbd:[s-p 5 g]
| Jump to a project's file based on context at point and show it in another frame.

| kbd:[s-p d]
| Display a list of all directories in the project. With a prefix argument it will clear the cache first.

| kbd:[s-p 4 d]
| Switch to a project directory and show it in another window.

| kbd:[s-p 5 d]
| Switch to a project directory and show it in another frame.

| kbd:[s-p T]
| Display a list of all test files (specs, features, etc.) in the project.

| kbd:[s-p l]
| Display a list of all files in a directory (that's not necessarily a project)

| kbd:[s-p s s]
| Search the project with the configured backend (`projectile-search`, see below). With a prefix argument it performs a regexp search.

| kbd:[s-p s g]
| Run grep on the files in the project.

| kbd:[M-- s-p s g]
| Run grep on `projectile-grep-default-files` in the project.

| kbd:[s-p s r]
| Runs `rg` (`ripgrep`) on the project, performing a literal search. Requires the presence of `rg.el` or `ripgrep.el`. With a prefix argument it will perform a regex search.

| kbd:[s-p s a]
| Runs `ag` (`the_silver_searcher`) on the project, performing a literal search. Requires the presence of `ag.el`. With a prefix argument it will perform a regex search.

| kbd:[s-p s x]
| Find references to the symbol at point within the project. Uses internally the `xref` library.

| kbd:[s-p s R]
| Reviewable search: gather all matches for a literal string into a read-only results buffer you can navigate, filter and reshape (see below).

| kbd:[s-p s X]
| Reviewable search for an Emacs regexp (the regexp sibling of kbd:[s-p s R]).

| kbd:[s-p v]
| Run `vc-dir` on the root directory of the project.

| kbd:[s-p b]
| Display a list of all project buffers currently open.

| kbd:[s-p 4 b]
| Switch to a project buffer and show it in another window.

| kbd:[s-p 5 b]
| Switch to a project buffer and show it in another frame.

| kbd:[s-p 4 C-o]
| Display a project buffer in another window without selecting it.

| kbd:[s-p a]
| Switch between files with the same name but different extensions.

| kbd:[s-p 4 a]
| Switch between files with the same name but different extensions in other window.

| kbd:[s-p 5 a]
| Switch between files with the same name but different extensions in other frame.

| kbd:[s-p o]
| Runs `multi-occur` on all project buffers currently open.

| kbd:[s-p r]
| Runs interactive query-replace on all files in the project.

| kbd:[s-p R]
| Reviewable replace: gather all matches in a results buffer where you can preview and toggle them before applying (see below).

| kbd:[s-p i]
| Invalidates the project cache (if existing).

| kbd:[s-p k]
| Kills all project buffers.

| kbd:[s-p D]
| Opens the root of the project in `dired`.

| kbd:[s-p 4 D]
| Opens the root of the project in `dired` in another window.

| kbd:[s-p 5 D]
| Opens the root of the project in `dired` in another frame.

| kbd:[s-p e]
| Shows a list of recently visited project files.

| kbd:[s-p left]
| Switch to the previous project buffer.

| kbd:[s-p right]
| Switch to the next project buffer.

| kbd:[s-p E]
| Opens the root `dir-locals-file` of the project.

| kbd:[s-p !]
| Runs `shell-command` in the root directory of the project.

| kbd:[s-p &]
| Runs `async-shell-command` in the root directory of the project.

| kbd:[s-p c o]
| Runs a standard configure command for your type of project.

| kbd:[s-p c c]
| Runs a standard compilation command for your type of project.

| kbd:[s-p c t]
| Runs a standard test command for your type of project.

| kbd:[s-p c .]
| Runs the test at point (requires Emacs 29+ with tree-sitter).

| kbd:[s-p c i]
| Runs a standard install command for your type of project.

| kbd:[s-p c p]
| Runs a standard package command for your type of project.

| kbd:[s-p c r]
| Runs a standard run command for your type of project.

| kbd:[s-p c x]
| Runs one of the project's named tasks (see `projectile-tasks`). With a prefix argument the task's command can be edited first.

| kbd:[s-p c X]
| Re-runs the last task executed in the project.

| kbd:[s-p t]
| Toggle between an implementation file and its test file.

| kbd:[s-p 4 t]
| Jump to implementation or test file in other window.

| kbd:[s-p 5 t]
| Jump to implementation or test file in other frame.

| kbd:[s-p j]
| Find a project file of a chosen kind (e.g. a Rails model or controller), using the project type's `:file-kinds`.

| kbd:[s-p 4 j]
| Find a project file of a chosen kind and show it in another window.

| kbd:[s-p 5 j]
| Find a project file of a chosen kind and show it in another frame.

| kbd:[s-p J]
| Jump from the current file to a related file of another kind, cycling through them on repeated presses.

| kbd:[s-p z]
| Adds the currently visited file to the cache.

| kbd:[s-p p]
| Display a list of known projects you can switch to.

| kbd:[s-p 4 p]
| Switch to a known project and show it in another window (runs `projectile-switch-project-other-window-action`, by default find-file in the other window).

| kbd:[s-p 5 p]
| Switch to a known project and show it in another frame (runs `projectile-switch-project-other-frame-action`).

| kbd:[s-p q]
| Display a list of open projects you can switch to.

| kbd:[s-p S]
| Save all project buffers.

| kbd:[s-p m]
| Open the Projectile dispatch menu (a `transient` interface to Projectile's commands).

| kbd:[s-p x r]
| Start or visit a shell/REPL/terminal for the project, using the configured backend (`projectile-run`, see below).

| kbd:[s-p x e]
| Start or visit an `eshell` for the project.

| kbd:[s-p x i]
| Start or visit an `ielm` (Elisp REPL) for the project.

| kbd:[s-p x t]
| Start or visit an `ansi-term` for the project.

| kbd:[s-p x s]
| Start or visit a `shell` for the project.

| kbd:[s-p x g]
| Start or visit a `gdb` for the project.

| kbd:[s-p x v]
| Start or visit a `vterm` for the project.

| kbd:[s-p x x]
| Start or visit an `eat` terminal for the project.

| kbd:[s-p x G]
| Start or visit a `ghostel` terminal for the project.

| kbd:[s-p w s]
| Save the current project's session (see `projectile-session-mode`).

| kbd:[s-p w S]
| Save every open project's session.

| kbd:[s-p w r]
| Restore the current project's saved session.

| kbd:[s-p w R]
| Reopen every saved project's session, each into its own tab.

| kbd:[s-p w f]
| Forget (delete) the current project's saved session.

| kbd:[s-p w b]
| Switch to a buffer belonging to the current tab's project.

| kbd:[s-p ESC]
| Switch to the most recently selected Projectile buffer.
|===

TIP: `projectile-other-window-command` (kbd:[s-p 4 4]) and
`projectile-other-frame-command` (kbd:[s-p 5 5]) are modeled after the
built-in `other-window-prefix` (kbd:[C-x 4 4]) and `other-frame-prefix`
(kbd:[C-x 5 5]) commands: they make the *next* command display its buffer in
another window or frame, and keep the Projectile keymap active for the next
key, so you don't have to type the Projectile prefix again. For instance,
kbd:[s-p 4 4 f] opens a project file in another window, and the same works
for commands without a dedicated other-window variant, e.g. kbd:[s-p 4 4 x s]
starts a project `shell` in another window, or kbd:[s-p 5 5 v] shows the
project's version control status in another frame.

If you ever forget any of Projectile's keybindings just do a:

kbd:[s-p C-h]

