Snippets
The snippets library holds commands you use often. The command-prompt icon in the tab row opens it.
Using a snippet
- Click in the terminal you want to use, then open Snippets. The line under the search field names that terminal.
- Click a snippet to type it into the terminal without pressing Enter, so you can check or edit it first. Run types it and presses Enter. Copy puts it on the clipboard. Edit opens the editor, which can also delete it. The three buttons appear when the pointer is over a row.
- From the keyboard, Up and Down move the highlight, Enter inserts, Ctrl+Enter (⌘Enter) runs and Esc closes.
A snippet can span several lines. It is typed as one paste, so a shell with bracketed paste (PowerShell 7, zsh, bash 5.1 and later) receives the whole block before running anything. Inserting never presses Enter, even when the command ends with a line break.
Creating and organizing snippets
- New snippet in the Snippets panel opens the editor.
- Select text in a terminal, right-click the pane's header and choose Save as snippet…. The selection becomes the command and its first line the name.
- The editor has four fields: Name, Command, Folder (shown as a heading in the list) and Show for, which is one of "Every location and project", "Only terminals on" a location, or "Only terminals in" a project.
- The list shows the snippets for the focused terminal. A checkbox at its foot shows the snippets for other locations and projects.
Placeholders
A command can ask for a value each time it is used. Write a name in double braces: {{branch}}, or {{branch:main}} to give a default. For example:
git checkout {{branch:main}} && git pull {{remote:origin}} {{branch:main}}
- Insert or run the snippet. A form opens with one field per name; a name used several times is asked for once and fills every use.
- Each field starts with the value you used last time for that snippet, else the default.
- A preview shows the command as it will be typed. Click Insert or Run. Enter does what you opened the form with, Ctrl+Enter always runs, and Esc cancels.
A name starts with a letter or underscore and contains letters, digits, _ and -. Other text in double braces, such as {{ two words }} or GitHub Actions' ${{ secrets.TOKEN }}, is typed as written. Copy copies the command with its placeholders unfilled.