4. Advanced Features
4.1. Snippet Links
A snippet link is a URL starting with snippetslab://. Open it from any app to go to a specific snippet or fragment. Use snippet links to refer to other snippets, to link to the library from notes or wiki pages, or to open snippets from automation workflows.
To copy a snippet link: Control-click a snippet in the snippets list and choose Copy Snippet Link.
To copy a fragment link: Control-click a fragment tab and choose Copy Fragment Link.
Tip
Command-click a snippet link to open the snippet in a new window.
4.2. Automatic Language Detection
SnippetsLab detects the 50 most popular programming languages with a custom-trained machine learning model. Detection runs entirely on your Mac, and your snippets are never sent to a server.
By default, when you paste content into a new snippet, SnippetsLab automatically detects and sets the language, unless the folder has a default language.
To detect the language at any time, choose Edit > Detect Language. For easier access, add the
Detect Language button to the toolbar.To choose when detection runs automatically, go to Settings > Languages and choose an option from the Automatically detect language pop-up menu.
4.3. Quick Actions
Quick Actions lets you run menu commands and set snippet languages directly from the keyboard. To open Quick Actions, choose View > Show Quick Actions, or press Shift Command A. To change the shortcut, go to Settings > General and record a new shortcut for Quick Actions.
Quick Actions uses fuzzy matching for command names and supports Pinyin search for Chinese commands.
Only commands that apply in the current context are listed. For example, most formatting commands appear only when the editor has focus.
Active languages have priority over other languages.
The last item in the results is always Search Library for followed by your search term. Press ↑ to select it, then press Return to search the entire library.
To go back to a recent query, press ↑ or ↓ while the field is empty or the whole query is selected.
4.4. Integrations
4.4.1. System Services
To create a snippet from selected text in most other apps, Control-click the selection and choose Services > Add to SnippetsLab.
If Add to SnippetsLab is missing, go to System Settings > Keyboard > Keyboard Shortcuts > Services and turn it on in the Text section. You can also assign a keyboard shortcut for quicker access.
Some apps don’t support Services. In these apps, the Services submenu doesn’t appear.
4.4.2. Search with a URL Scheme
To start a search in SnippetsLab from another app or a script, open the following URL, replacing {query} with the search term:
snippetslab://search/{query}
Add query parameters to limit the search scope or filter the results:
Parameter |
Value |
|---|---|
|
A folder name |
|
A tag name |
|
A language name, such as |
Folder, tag, and language names are percent-encoded and must match the names shown in SnippetsLab exactly, including capitalization. Repeat a filter parameter to specify multiple values. For example:
snippetslab://search/sort?scope=title&language=Swift&folder=Code%20Examples
To search using only filters, leave the search term empty:
snippetslab://search/?tag=Utilities&language=Swift
This works with automation tools such as Shortcuts, and with launchers such as Alfred. To set up an Alfred custom search, see Setting Up Alfred Custom Search.
4.4.3. AI Agents and Command-Line Tools
SnippetsLab includes lab, a command-line tool for searching your library, fetching snippets, and, when you allow it, saving new snippets from the shell. It also includes an agent skill and an MCP server for integration with AI coding agents. For setup instructions, see AI Agents and Command-Line Tools. For the options of lab, see the lab(1) Command Manual.
4.4.4. Alfred Workflow
With the official Alfred Workflow, you can search your library in Alfred, and copy, paste, or open snippets. The workflow requires the Alfred Powerpack. To install the workflow, go to Settings > Integrations and click Install Workflow.
To search: Type
snippetfollowed by the search term. Press Return to copy the snippet, Option Return to open it in SnippetsLab, or Command Return to paste it into the active app.To change the Return and Option-Return actions: Go to Settings > Assistant and choose new actions from the Click / Return and ⌥ Click / ⌥ Return pop-up menus.
To change the keyword: In Alfred Settings > Workflows, select SnippetsLab, double-click the Script Filter object, and edit Keyword.
Tip
To list all snippets before you type a search term, change the Script Filter’s keyword option from Argument Required to Argument Optional.
4.4.5. Raycast Extension
With the official Raycast extension, you can search your library from Raycast with filters for folders, tags, and languages, view every fragment of a snippet, and copy, paste, or open snippets. Install it from the Raycast Store.
The extension settings are in Raycast Settings > Extensions > Search SnippetsLab Library:
Save Last Search Filter: Apply the last used search filter when you reopen the extension. By default, the filter is reset when you close the Raycast window.
Search Result: Choose what is shown in the list:
Search Context: When searching, show the content around the first matching keyword.
Folder, Tags, Languages: Show the folder, tags, and languages of each snippet, if available.
Snippet Action: Set the order of actions in the action menu (Command K). Press Return for the first action and Command Return for the second.
CLI Path: The extension uses the
labcommand-line tool included with SnippetsLab. If the tool isn’t found automatically, or to use a different copy, enter the full path tolabhere. For more aboutlab, see AI Agents and Command-Line Tools.