Skip to Content
Documentsโšก Core๐Ÿ“ Snippets

Snippets

Snippets are short abbreviations that expand into full content: plain text, rich text (HTML), or executable scripts (Pro). A few letters + trigger key โ†’ full block. Template variables like {{date}}, {{clipboard}} (Pro) are replaced on expand. See FillIn & variables.


How to expand snippets

  • Abbreviation & trigger โ€” Type abbreviation + trigger (default Tab, or Space/Enter etc.) to expand; works in any text field.
  • Trigger key: Tab, Space, Enter, Alt, ., ,, ;, -, /, =, ` configurable; โ€œrequire trigger to expandโ€ recommended to reduce accidents.
  • Match modes:
    • Left-to-right: Abbreviation must match input exactly (e.g. sig โ†’ sig+Tab)
    • Right-to-left: Abbreviation only needs to match as suffix (e.g. mysig โ†’ sig+Tab expands)
    • Word boundary: In right-to-left mode, require a word boundary character before the abbreviation to avoid mid-word triggers
    • Adaptive case: Type SIG to expand uppercase version, Sig for title case
  • Inline search: Type // (configurable prefix) to bring up snippet search popup; arrow keys to select, Enter to insert
  • Shortcuts (Pro): Global main/search, create from clipboard, new snippet, edit last expanded, expand last again; per-snippet global shortcut. See Settings โ†’ Shortcuts.

Groups & Multi-file

  • Tree groups + prefix: e.g. all under ai- expand as ai-xxx; manage many snippets by scenario. See Introduction ยท Snippets.
  • Multi-file snippets: One snippet, multiple โ€œfilesโ€ (language/env), each with its own abbreviation and content; maintain once, expand everywhere.
    • Add, copy, delete, and drag-to-sort files
    • Each file independently has: filename, runtime, abbreviation, content, expand scope, global hotkey
    • Multi-file snippets show file count badge in the list

Only in Selected Apps แดพแดฟแดผ

Expand only in selected apps; typing the same abbreviation elsewhere wonโ€™t trigger. Keep expansion in VS Code, Cursor, or browser without triggering in chat or web inputs.

How to Set

  1. Open snippet or group settings.
  2. Find ExpandIn (or โ€œExpand only in these appsโ€).
  3. Select or search apps (e.g. VS Code, Chrome, Cursor); multiple allowed.
  4. Save; that snippet or group only responds to โ€œabbreviation + triggerโ€ in those apps.

If no app is selected, it applies everywhere.

How It Works

  • App detection: Automatically identifies the foreground application; no manual technical configuration needed.
  • Group-level limit: Setting ExpandIn on a group applies to all snippets under it.
  • Snippet-level limit: Per-snippet settings can override the group for finer control.
  • Global search: ExpandIn only affects โ€œabbreviation + triggerโ€ expansion; the global search window (shortcut-activated) is always available everywhere.

Typical Scenarios

ScenarioSuggested Setup
IDE-only code snippetsGroup set to VS Code / Cursor / JetBrains only; abbreviations like log, try wonโ€™t trigger in chat apps
Browser AI promptsSnippet set to Chrome / Safari / Edge only; expand prompts in AI chat sites
Office doc templatesGroup set to Lark / Notion / Docs only; weekly reports and meeting notes only trigger in document tools
Same abbr, different appsSame abbreviation expands differently per app: deploy expands Shell command in Terminal, deployment doc template in documents

Notes

  • Unrecognized apps: If an app canโ€™t be detected (some Electron apps), ExpandIn may not work; disable the restriction for those snippets.
  • Performance: ExpandIn checks the foreground app before each trigger; overhead is negligible.
  • Combine with word boundary: Enable โ€œword boundary checkโ€ to avoid mid-word triggers within the allowed apps.

Best for: Heavy snippet use in IDE and browser without triggering in chat (e.g. WeChat, Slack).


Snippet Editor

Editor Types

Switches automatically based on snippet runtime:

  • Code editor: Syntax highlighting for all major programming languages, line numbers, undo/redo, and theme switching. Great for code wrappers and script snippets.
  • Rich text editor: Bold, italic, headings, lists, tables, images, links, and alignment. Great for email templates, documentation, and formatted content.

Editor Toolbar

ShortcutAction
Cmd/Ctrl+Shift+LToggle read-only / edit mode
Cmd/Ctrl+Shift+PRun / preview snippet
Cmd/Ctrl+Shift+BackspaceDelete current file

Read-only hint: When a snippet is locked (read-only mode), hover over the editor area and the lock icon will flash as a reminder โ€” click it or press Cmd/Ctrl+Shift+L to unlock and edit.

Typical Scenarios

  • Developers: Write code wrappers (try/catch, logging) with syntax highlighting; run scripts directly and copy output.
  • Technical writers: Draft documentation in rich text with images and tables; screenshot and annotate in the same app.
  • Multilingual teams: Share snippets across regions โ€” code snippets work in any IDE, templates adapt to local languages via FillIn.

Code to Image

  • Carbon share: Render code as beautiful image (Carbon.now.sh)
  • Local render: Code to image (local rendering)

FillIn & Template Variables

  • FillIn variables โ€” Popup on trigger: single/multi-line, dropdown, checkbox, %date%, cursor %c% (multi-cursor tabstop supported), clipboard %cv%, nested %s:abbr%; great for prompts and parameterized templates.
    • Variable case formatting: camel/pascal/snake/kebab/upper/lower
  • Snippet template variables (Pro) โ€” In content: {{date}}, {{time}}, {{clipboard}}, {{cursor}}, {{input}}; replaced on expand.

Snippet Types & Execution แดพแดฟแดผ

Built-in Types

TypeDescription
plainPlain text (default)
richRich text (HTML)
shellShell script
applescriptAppleScript (macOS)
jsJavaScript
pythonPython

Custom Runtime

Configure custom runtimes in Settings to run any executable. Supports passing snippet content, clipboard, and selected text into the execution context, plus custom wrapper templates for pre/post-processing.

Execution Methods

  • Preview: Click run button or Cmd/Ctrl+Shift+P in editor; results shown in bottom panel
  • Run and copy: Right-click in snippet list โ†’ โ€œRun and copyโ€; result copied to clipboard after execution

Version History

Auto-saved version history per file:

  • Auto-save: Edits are automatically saved to history as you work
  • Version sources: Initial creation, auto-save, manual save, and apply operations
  • Version diff: Side-by-side visual comparison; review line-level or formatted differences
  • Restore: Roll back to any previous version with one click

Typical recovery scenarios:

  • Accidental deletion โ†’ recover from history in seconds
  • Compare changes โ†’ see exactly what changed between edits
  • Experimental edits โ†’ try new ideas safely, roll back anytime

Share & Sync

  • Share link: Snippets can generate share links (rawurl); right-click to copy or open
  • Cloud sync: Push/Pull individual snippets to GitHub/Gitee Gist
  • Import/Export: Supports JSON, CSV format import/export