Snippets
Save, organize, and quick-launch command snippets with alias expansion.
Snippets
Snippets are saved command templates you can execute instantly from any terminal. They support alias expansion, fuzzy search, workspace scoping, and categories -- turning complex or frequently-used commands into one-keystroke actions.
What Snippets Are
A snippet is a saved command with metadata:
| Property | Description |
|---|---|
| Name | Human-readable label displayed in the palette and sidebar |
| Command | The shell command to execute (supports full shell syntax) |
| Alias | Short identifier for terminal expansion (e.g., gs) |
| Category | Optional grouping for organization (e.g., "Git", "Docker", "Build") |
| Scope | Global (all workspaces) or workspace-specific |
When you execute a snippet, the command is sent to the active terminal pane exactly as if you had typed it yourself.
Creating Snippets
There are two places to create and manage snippets:
Settings Tab
Open Settings > Snippets for the full management interface:
- Create new snippets with all fields (name, command, alias, category, scope)
- Edit existing snippets
- Delete snippets you no longer need
- Organize by category
Snippets Sidebar
Toggle the snippets sidebar with Ctrl+Shift+Y for quick access while working. The sidebar shows your full snippet library and lets you execute snippets with a single click.
Global vs. Workspace-Scoped
Snippets have two scope levels:
| Scope | Visibility | Best For |
|---|---|---|
| Global | Available in every workspace | Universal commands: git status, docker ps, SSH connections |
| Workspace | Only visible when that workspace is active | Project-specific: build scripts, test runners, deployment steps |
When a workspace is active, both global and workspace-scoped snippets are available. Workspace snippets do not appear in other workspaces, keeping your palette clean and context-relevant.
Tip: Put project-specific build commands, test scripts, and deployment steps into workspace-scoped snippets. They will only show up when you are actually working on that project.
Alias Expansion
Alias expansion lets you run snippets by typing a short prefix directly in the terminal, without opening any palette or menu.
How It Works
- Create a snippet with an alias (e.g., alias
gs, commandgit status) - In any terminal, type
:gsand press Enter - Mosaic intercepts the input, replaces it with
git status, and executes it
The colon prefix (:) distinguishes alias expansion from normal shell input. Only exact alias matches trigger expansion -- partial matches are passed through to the shell as-is.
Alias Tips
- Keep aliases short and memorable (2-4 characters)
- Use consistent prefixes to group related aliases:
:gstfor git status,:gcofor git checkout,:gpfor git push - Avoid aliases that conflict with real commands you use
- Aliases work in every terminal pane across all workspaces (for global snippets) or within the scoped workspace
Snippet Palette
Press Ctrl+; to open the snippet palette -- a quick-launch overlay with fuzzy search.
| Action | Key |
|---|---|
| Open snippet palette | Ctrl+; |
| Filter snippets | Start typing to fuzzy search by name, alias, or command |
| Execute selected | Enter |
| Dismiss | Escape |
The palette searches across both global and workspace-scoped snippets, showing all that match the current workspace context. Fuzzy matching means you do not need to type the exact name -- a few characters from the name, alias, or command text will narrow the list.
Tip: The snippet palette is the fastest way to execute a snippet when you cannot remember its alias. A few keystrokes to fuzzy search is faster than scrolling through the sidebar.
Snippet Sidebar
The sidebar (Ctrl+Shift+Y) provides the full snippet library as a docked panel:
- Browse all snippets organized by category
- Click any snippet to execute it in the active terminal
- Visual distinction between global and workspace-scoped snippets
- Always accessible without interrupting your terminal flow
The sidebar is part of Mosaic's sidebar dock system, so you can position it on any edge of the window and combine it with other panels.
Context Menu Integration
Right-click in a terminal pane header or in the file explorer to access snippets directly from the context menu:
- Snippets submenu -- browse and execute from the right-click menu
- Claude commands -- also available in the same context menu alongside snippets
This provides quick access without memorizing aliases or opening the palette -- especially useful for snippets you use occasionally rather than daily.
Example Snippets
Here are some practical snippet ideas to get started:
| Alias | Command | Category | Use Case |
|---|---|---|---|
gs | git status | Git | Quick git check |
glog | git log --oneline -20 | Git | Recent commit history |
gd | git diff --stat | Git | See what changed |
ports | netstat -ano | findstr LISTENING | System | Find listening ports |
build | npm run build && npm run test | Build | Build and test pipeline |
dc | docker compose up -d | Docker | Start containers |
clean | rm -rf node_modules && npm install | Build | Fresh dependency install |
lint | npx eslint . --fix | Build | Auto-fix lint issues |
serve | npx http-server ./dist -p 3000 | Dev | Quick static file server |
Tip: Snippets shine for complex one-liners that are hard to remember but frequently needed. Instead of looking up the syntax for that
find | xargs | sedpipeline each time, save it once and invoke it with:fixor whatever alias makes sense to you.
Keyboard Reference
| Shortcut | Action |
|---|---|
| Ctrl+; | Open snippet palette (fuzzy search + execute) |
| Ctrl+Shift+Y | Toggle snippets sidebar panel |
:alias + Enter | Expand and execute a snippet alias in the terminal |
Related
- Command Palette -- fuzzy search across all actions, including snippets
- Terminal -- where snippets execute via alias expansion
- Sidebar System -- docking and arranging the snippets sidebar panel
- Daily Notes -- another sidebar panel for tracking tasks alongside your snippets