MosaicMosaicTerminal

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:

PropertyDescription
NameHuman-readable label displayed in the palette and sidebar
CommandThe shell command to execute (supports full shell syntax)
AliasShort identifier for terminal expansion (e.g., gs)
CategoryOptional grouping for organization (e.g., "Git", "Docker", "Build")
ScopeGlobal (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:

ScopeVisibilityBest For
GlobalAvailable in every workspaceUniversal commands: git status, docker ps, SSH connections
WorkspaceOnly visible when that workspace is activeProject-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

  1. Create a snippet with an alias (e.g., alias gs, command git status)
  2. In any terminal, type :gs and press Enter
  3. 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: :gst for git status, :gco for git checkout, :gp for 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.

ActionKey
Open snippet paletteCtrl+;
Filter snippetsStart typing to fuzzy search by name, alias, or command
Execute selectedEnter
DismissEscape

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:

AliasCommandCategoryUse Case
gsgit statusGitQuick git check
gloggit log --oneline -20GitRecent commit history
gdgit diff --statGitSee what changed
portsnetstat -ano | findstr LISTENINGSystemFind listening ports
buildnpm run build && npm run testBuildBuild and test pipeline
dcdocker compose up -dDockerStart containers
cleanrm -rf node_modules && npm installBuildFresh dependency install
lintnpx eslint . --fixBuildAuto-fix lint issues
servenpx http-server ./dist -p 3000DevQuick 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 | sed pipeline each time, save it once and invoke it with :fix or whatever alias makes sense to you.

Keyboard Reference

ShortcutAction
Ctrl+;Open snippet palette (fuzzy search + execute)
Ctrl+Shift+YToggle snippets sidebar panel
:alias + EnterExpand and execute a snippet alias in the terminal
  • 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