Overview
Snippets in SuperCmd provide:- Quick text expansion - Type keyword, get full text
- Dynamic placeholders - Insert current date, time, clipboard, etc.
- Custom variables - Prompt for user input when expanding
- Import/Export - Share snippets or backup
- Search & organize - Pin favorites, search by name/content
Snippets are stored in
~/Library/Application Support/SuperCmd/snippets/snippets.json and sync automatically.Quick Start
Set Name & Content
- Name: Display name (e.g., “Email Signature”)
- Keyword: Optional trigger (e.g., “sig”)
- Content: Your text with optional placeholders
Snippet Manager UI
Implemented insrc/renderer/src/SnippetManager.tsx:
Views
- Search View
- Create/Edit View
40/60 split layout:
- Left: Snippet list with search
- Right: Live preview with placeholder resolution
Snippet Organization
Snippets are sorted automatically (src/main/snippet-store.ts:101):Placeholders
Dynamic content insertion:Built-in Placeholders
| Placeholder | Output | Example |
|---|---|---|
{clipboard} | Current clipboard text | ”Hello, world!” |
{date} | Current date (locale format) | “3/2/2026” |
{time} | Current time (locale format) | “2:30 PM” |
{date:YYYY-MM-DD} | Formatted date | ”2026-03-02” |
{time:HH:mm:ss} | Formatted time | ”14:30:00” |
{random:UUID} | Random UUID v4 | ”a3bb189e-8bf9-…” |
{cursor-position} | Empty (marks cursor position) | - |
Date/Time Formatting
Supported format tokens (src/main/snippet-store.ts:308):{date:YYYY-MM-DD}→ “2026-03-02”{date:MM/DD/YYYY}→ “03/02/2026”{time:HH:mm}→ “14:30”{date:YYYY-MM-DD HH:mm:ss}→ “2026-03-02 14:30:45”
Custom Variables (Arguments)
Prompt for user input when expanding:- “Name” field (required)
- “OrderID” field (defaults to “12345”)
Argument Syntax (src/renderer/src/SnippetManager.tsx:35)
Snippet Keywords
Optional trigger phrases for quick expansion:Setting Keywords
- Edit snippet
- Set Keyword field (e.g., “addr”)
- Save snippet
Using Keywords
Currently, keywords are used for searching in Snippet Manager. Future versions will support inline expansion (type keyword → snippet expands).Keyword Rules
Invalid characters are rejected (src/main/snippet-store.ts:27):Import & Export
Exporting Snippets
Export Format (src/main/snippet-store.ts:352)
Importing Snippets
Import Deduplication (src/main/snippet-store.ts:439)
Duplicate snippets (by name or keyword) are skipped during import to prevent conflicts.
Raycast Compatibility
SuperCmd can import Raycast snippet exports (src/main/snippet-store.ts:423):Snippet Actions
Available operations:| Action | Shortcut | Description |
|---|---|---|
| Copy to Clipboard | Enter | Resolve placeholders and copy |
| Paste Directly | Cmd+Enter | Copy and paste to frontmost app |
| Edit Snippet | Cmd+E | Open edit view |
| Duplicate | Cmd+D | Create copy of snippet |
| Pin/Unpin | Cmd+P | Pin to top of list |
| Delete | Cmd+Delete | Remove snippet |
| Clear All | Cmd+Shift+Delete | Delete all snippets |
Placeholder Resolution
Processing pipeline (src/main/snippet-store.ts:261):Resolution Order
- Extract arguments - Find all
{argument:...}placeholders - Prompt user - If arguments exist, show input form
- Resolve placeholders:
- Replace
{argument:X}with user input - Replace
{clipboard}with current clipboard - Replace
{date}/{time}with current date/time - Replace
{random:UUID}with generated UUID
- Replace
- Return final text
Example Resolution
Snippet:- Attendees: “Alice, Bob”
- Clipboard: “Q1 Planning”
- Current date: 2026-03-02
Inline Argument Fields
When a snippet has 3 or fewer arguments, they appear inline in the snippet list (src/renderer/src/SnippetManager.tsx:33):Best Practices
Use Descriptive Names
Name snippets clearly: “Email Signature” not “sig1”
Set Keywords
Add keywords for frequently used snippets
Pin Favorites
Pin your most-used snippets to the top
Test Placeholders
Preview snippets before saving to verify placeholders
Common Use Cases
Email Templates
Code Snippets
Meeting Notes
Bug Report Template
Keyboard Shortcuts
| Action | Shortcut |
|---|---|
| Open Snippet Manager | Cmd+Shift+S |
| Create New | Cmd+N |
| Search | Cmd+F |
| Edit Selected | Cmd+E |
| Duplicate | Cmd+D |
| Pin/Unpin | Cmd+P |
| Copy Snippet | Enter |
| Paste Snippet | Cmd+Enter |
| Delete | Cmd+Delete |
| Save (in edit view) | Cmd+S |
| Cancel (in edit view) | Escape |
Troubleshooting
Placeholders not resolving
Placeholders not resolving
- Check placeholder syntax:
{date}not{Date} - Verify format string:
{date:YYYY-MM-DD}not{date:yyyy-mm-dd} - For arguments: use
{argument:Name}not{Name} - Preview snippet before saving to test
Import failed
Import failed
- Verify JSON format is valid
- Check file has “snippets” array
- Ensure no duplicate names/keywords with existing snippets
- Try exporting a snippet first to see correct format
Snippet not appearing in list
Snippet not appearing in list
- Check search query isn’t filtering it out
- Verify snippet was saved (check edit view)
- Look for the snippet in All filter (not type-specific)
- Restart Snippet Manager
Arguments not prompting
Arguments not prompting
- Verify syntax:
{argument name="Field"} - Check no invalid characters in argument name
- Ensure snippet content includes the placeholder
- Try removing and re-adding the argument
Performance
Search Performance
Snippet search is fast even with hundreds of snippets (src/main/snippet-store.ts:111):Storage
- JSON format: Human-readable, easy to backup
- File size: ~1KB per snippet
- 1000 snippets: ~1MB file size
- Load time: Less than 50ms on app startup