4. Advanced Features

4.2. Automatic Language Detection

SnippetsLab supports automatic language detection for the 50 most popular programming languages, powered by a custom-trained machine learning model built with Apple’s Core ML technology.

How It Works

  • When you paste content into a new snippet, SnippetsLab automatically detects and sets the language, unless a default language is already assigned to the folder.

  • You can manually trigger detection at any time via Edit > Detect Language in the menu bar. For quick access, add the wand.and.stars Detect Language button to the toolbar.

  • You can change the automatic detection behavior in Settings > Languages, for example, choose to always detect automatically, or only manually.

With on-device machine learning, your data remains 100% private and secure—no information is sent to external servers.

4.3. Quick Actions

Quick Actions provide a fast, keyboard-driven way to execute commands across the app. To open Quick Actions, select View > Show Quick Actions from the menu bar, or press Command-Shift-A.

How It Works

  • You can perform most commands available in the main menu with Quick Actions, as well as quickly switch between syntax coloring languages.

  • To customize the shortcut: Go to Settings > General, and record the desired key-binding under Quick Actions.

Tips for using Quick Actions

  • When searching for languages, Active Languages are prioritized in the search results. As such, to improve search results, ensure that the languages you use often are selected in Settings > Languages.

  • Quick Actions support fuzzy matching of command names, including searching by Pinyin for Chinese users.

  • The last command for any query is always “Search Library for …”, allowing you to quickly initiate a search by pressing to jump to the last item, then followed by return.

Note

Only actionable commands based on the current context are shown. For example, most format-related commands appear only when the editor has key focus.

4.4. Integrations

4.4.1. System Services

SnippetsLab integrates with macOS System Services, allowing you to create new snippets directly from most native applications. To use this, right-click on selected text in another app, then choose Services > Add to SnippetsLab from the context menu.

Tips for using System Services

  • If you don’t see the Add to SnippetsLab option, ensure it’s enabled in System Settings > Keyboard > Keyboard Shortcuts > Services. From there, locate and activate the Add to SnippetsLab service under the Text category.

  • You can also assign a custom keyboard shortcut to the SnippetsLab service in System Settings > Keyboard Shortcuts > Shortcuts for even faster access.

  • Note that not all applications support System Services. If the Services submenu does not appear in the context menu, the application may be built with technologies that does not integrate with System Services.

4.4.2. Search via URL Scheme

SnippetsLab provides a custom URL scheme that allows you to initiate in-app searches directly from external tools or apps. To use, open the following URL, replacing {query} with your search term:

snippetslab://search/{query}

This URL scheme can be used in a variety of scenarios, such as triggering searches from custom scripts or automation tools (like Shortcuts), or integrating with launchers such as Alfred (for a setup guide, see Setting up Alfred Custom Search).

4.4.3. Alfred Workflow

For Alfred Powerpack users, SnippetsLab offers an official Alfred Workflow that lets you access your SnippetsLab library directly in Alfred. Using this workflow, you can search for snippets, copy them to the clipboard, paste them into the active app, or open them directly in SnippetsLab.

To get started, open SnippetsLab Settings > Integrations from the menu bar, and click Install Workflow in the Alfred Workflow section.

img-workflow

How It Works

  • To search for snippets: Type snippet {query} in Alfred, replacing {query} with your search term. The following actions are available:

    • Return: Primary action. Defaults to “Copy to Clipboard”.

    • Option-Return: Secondary action. Defaults to “Open in SnippetsLab”.

    • Command-Return: Paste to active app.

  • To modify the primary and secondary actions: Open SnippetsLab Settings > Assistant, and select your desired options from the “Click / Return” and “⌥ Click / ⌥ Return” drop-down menus.

  • To customize the keyword used to trigger the workflow:

    • Open Alfred Settings, and navigate to Workflows.

    • Select SnippetsLab from the list.

    • Double-click the Script Filter object.

    • Update the Keyword field with your preferred keyword.

Tip

By default, the results are empty until you start typing. To display all snippets with an empty query, open the workflow settings in Alfred, double-click the Script Filter object, and change the keyword argument option from Argument Required to Argument Optional.

4.4.4. Raycast Extension

SnippetsLab provides an official Raycast extension, letting you access your library directly from Raycast. Install the extension from the Raycast Store to get started.

Main Features

  • Search for any snippet in your SnippetsLab library directly from Raycast.

  • Set a search filter to refine your search by folder, tag, or language.

  • View snippet contents (including each fragment) without leaving Raycast.

  • Perform actions such as Copy to Clipboard, Paste to Active App, and Open in SnippetsLab.

Settings

There are a few settings you can change to make the extension better fit your workflow. To adjust these settings, go to Raycast Settings > Extensions > Search SnippetsLab Library.

  • Save Last Search Filter: By default, the search filter is reset when you close the Raycast window. Enable this option if you prefer to keep the filter selection persistent across multiple sessions.

  • Search Result: Configure which information is displayed in the list:

    • Search Context: When searching, show the content around the first matching keyword.

    • Folder, Tags, Languages: Display the folder, tags, and languages associated with each snippet, if available.

  • Snippet Action: Control the order of actions in the action menu (Command-K). You can also use Return to invoke the first action and Command-Return to invoke the second action.

  • CLI Path: The extension communicates with SnippetsLab using the lab command-line tool bundled with the app. In most cases, the extension will locate the tool automatically. If not, or if you want to specify a custom location, you can manually enter the absolute path to the lab binary here. For more information on the lab command, see lab(1) Command Manual.