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

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.

The main window is three panes: groups on the left, the snippet list in the middle, the editor on the right. Locked Organization groups cannot be edited on the desktop.

CodeExpander
Snippets
Signature
sig
Greeting
hi
sig
Ada | Engineer ada@example.com
This computer ยท expansion on

Main window: groups โ†’ snippets โ†’ editor. Organization groups are locked read-only.


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, line numbers, undo/redo. Great for code wrappers and script snippets.
  • Rich text editor: bold, italic, headings, lists, tables, images, links. Great for email templates 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
powershellPowerShell (Windows)
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

Groups & prefix

The left pane is the group tree. Snippets live in groups; abbreviations live on files; prefixes live on groups.

  1. Right-click empty space โ†’ New group, or add a child under a group.
  2. Group settings: name, prefix (e.g. ai-). Prefix ai- + file abbr gen โ†’ type ai-gen then the trigger.
  3. Free: about 5 groups; Pro unlimited. A child group can have its own prefix. Save after you change it.

A group can also set ExpandIn / expand-when / local trigger keys (not synced), and whether it uploads. Locked Organization groups cannot be edited on the desktop. See Organizations and Expand.


Create & edit

Support wants a return-policy line as ret. Pick one of your groups, create a snippet, type the body, save. Next time, type ret and Tab in the email.

  1. Select a Just me group (a locked org group cannot be edited here).
  2. Cmd/Ctrl+N, or click New. Free stops around 50 snippets.
  3. Name it; set the abbreviation and body on a file. Choose plain text, rich text, or a script (Pro).
  4. Save. A new abbreviation or group prefix works the next time you type.

Also: create from clipboard, drop a file, accept a suggested snippet, or open a share pack. One snippet can hold a Chinese and an English signature, each with its own abbreviation.


Suggested snippets

You typed the same sign-off three times today. The main window may ask: save this as an abbreviation? Preview it, then confirm. If you ignore it, the library does not change. Confirm to add it to the current group. The Free ~50 cap still applies. Counts stay on this computer.


Share pack

Bundle groups/snippets for a coworker. They confirm in-app; items land in their local library, not live org sync.

  1. Open codeexpander://import?d=... (over-long payloads are rejected).
  2. The app shows a confirm dialog after decode. Only then it writes. Free-tier caps still apply.
  3. Packs that point at shared org snippets are recognized; copy to my library makes an editable personal copy.

Export lives on snippet/group menus and Data โ†’ Transfer. A share pack is not CE Cloud organization access. See Deep links.


Share & Sync

More: Scripts ยท FillIn ยท Expand

Last updated