- C-g as many times as needed, to get out of a prompt
- How to open and save files using Emacs - remember that arrow keys and Page Up/Page Down work fine as well.
- C-c p a a to locate projects under the given directory
- C-c p a s to switch Emacs to a local asdf-managed version of node.js or other development program
- C-c p c to start a compilation at the top of the current project
- C-c p f to find a file within the current project
- C-c p g g to start a Claude AI interaction buffer
- C-c p g p to bring up a gptel menu for taking different AI actions
- C-c p k to close all files in the current project
- C-c p p to visit a known project in Magit, which is a git status browser and git shell
- C-c p t to switch to a different open buffer within the project
- C-c p s r to search content within a project non-interactively
- C-c p s s to search content within a project interactively
- C-c p w p to copy the part of the file path relative to the project root
- C-c p w w to copy the file path of the current buffer
- C-c p ! to run a shell command at the top of the current project
- C-c V s to visit Magit Status Mode from any file within a git project
- C-c V l to visit Magit Log mode and see a list of git revisions made to the project, which can be opened
- C-c V b to visit Magit Branch mode and see a list of git branches to checkout
- C-c V a to open
git blame
on the current file - use q to exit when done
- C-c p s s to search an entire project for a phrase as you type, using
ripgrep
- RET to visit a result, or
- C-c C-o to move the results into a separate buffer. r within that buffer will allow you to start making changes to any text in that buffer, and C-c C-c applies the changes.
- C-c p s r to search an entire project and put the results in a buffer with links that can be visited
- g to refresh the buffer, which is useful for refactoring, if you've changed any files
- C-c p r to search and replace a phrase throughout an entire project, asking you what to do with each match
When you're visiting a source code file, you can use these commands to navigate to the definition of the function that the cursor is at.
- C-c . a a to add the current function as context for a later AI query
- C-c . a f to add the current file as context for a later AI query
- C-c . c to complete the code at point using Claude AI; if you have a comment near the end, that will better inform the completion
- C-c . k to fully clear the AI context
- C-c . l to switch from Claude to a local AI server or vice versa
- C-c . q to bring up a Claude AI query on the side with the current function or region added to the AI context
- C-c . r to rewrite the current function or region using Claude AI
- C-c . v to pop up a menu that allows viewing and pruning the AI context; hit q when done to apply the changes
- C-c . . to visit the definition
- C-c . , to return to the original point
- C-c . / to find references
- C-c p D to open the root of the project in Dired Mode, which looks like
ls
output but you can manipulate it - C-c p d to open a different project directory in Dired
- RET when in Dired, will visit the file at point
- r when in Dired, will allow you to make changes to the names of any files
- C-c C-c applies the changes
- C-c ESC removes the changes and takes you back to Dired
- C when in Dired, will copy the file
- R when in Dired, will rename the file or move it to a different directory
The following shortcuts are added to ~/emacs-shared/bin
which can be added to your $PATH
:
en
: Open the provided file in the existing Emacs window, and return right awayet
: Open the provided file in terminal Emacs, and wait until done editingew
: Open the provided file in a new Emacs window, and wait until done editing