Custom Commands in Crush
Crush supports custom commands (sometimes called saved prompts) that can be created by users to quickly send predefined prompts to the AI assistant.
Creating Custom Commands
Custom commands are predefined prompts stored as Markdown files in one of three locations:
-
User Commands:
# Unix-like systems (Linux, macOS, FreeBSD, etc.) $XDG_CONFIG_HOME/crush/commands/ # Windows %USERPROFILE%\AppData\Local\crush\commands\ -
Project Commands:
<PROJECT DIR>/.crush/commands/
Each Markdown file in these directories becomes a custom command. The file name (without the extension) becomes the name of the command.
For example, creating a file at ~/.config/crush/commands/carrot-cake.md with
the following content:
RUN git ls-files
READ README.md
...creates a command called user:carrot-cake.
Command Arguments
Crush supports named arguments in custom commands using placeholders in the
format $NAME (where NAME consists of uppercase letters, numbers, and
underscores, and must start with a letter).
For example:
# Fetch Context for Issue $ISSUE_NUMBER
RUN gh issue view $ISSUE_NUMBER --json title,body,comments
RUN git grep --author="$AUTHOR_NAME" -n .
RUN grep -R "$SEARCH_PATTERN" $DIRECTORY
When you run a command with arguments, crush will prompt you to enter values for each unique placeholder.
Organizing Commands
Commands can be organized into sub-directories:
~/.config/crush/commands/git/commit.md
This creates a command with ID user:git:commit.
Using Custom Commands
- Press Ctrl+p to open the command dialog
- Press Tab to switch to User Commands
- Select your custom command
Part of Charm.
Charm็ญ็ฑๅผๆบ โข Charm loves open source
