1. Essentials

1.1. Folders

You can organize snippets in any number of nested folders. Snippets that aren’t in a folder appear in Uncategorized.

  • To show or hide the sidebar: Choose View > Show Sidebar, or press Shift Command L.

  • To create a folder: Choose Library > New Folder, or press Shift Command N. To create a nested folder, press Option Shift Command N, press and hold Option while creating a folder, or drag a folder onto another folder.

  • To set a custom icon: Control-click a folder or smart group and choose Customize Icon. To use an SF Symbol that isn’t in the list, enter its full name in the search field.

  • To sort folders alphabetically: Go to Settings > General and select Automatically sort folders and smart groups.

  • To set a default language for a folder: See Default Language.

Deleting a folder also deletes its subfolders. Snippets in these folders are moved to Uncategorized.

Tip

By default, the snippets list includes snippets in subfolders of the selected folder. To show only the snippets directly in the folder, Control-click the snippets list and choose Display Options > Include Snippets From Subfolders so that the checkmark disappears.

1.2. Tags

Tags are another way to organize snippets. Unlike folders, a snippet can have any number of tags.

  • To add tags to a snippet:

    • Click the tag button in the toolbar, or click the ellipsis.circle button and choose Show Tags.

    • Choose Editor > Show Tags from the menu bar.

    • Double-click the tags area of the snippet in the snippets list.

    • Drag snippets onto a tag in the sidebar.

    As you add tags, SnippetsLab suggests tags based on your library usage.

  • To set a tag color: Control-click a tag in the sidebar and choose a color in the Accent Color section. To remove the color, choose the selected color again.

  • To show unused tags: Click the tag button at the right end of the Filter field at the bottom of the sidebar. By default, tags that have no snippets outside the Trash are hidden.

  • To sort tags: Control-click a tag in the sidebar and choose an option from the Sort Tags By submenu. With the Color option, tags with custom colors are listed first.

By default, all tags of each snippet are shown in the snippets list. To show only tags with custom colors, go to Settings > General, click the pop-up menu next to Show tags, and choose Tags with custom colors. To hide all tags, deselect Show tags.

Note

Tag names are case-insensitive, but their original capitalization is preserved. For example, a tag named LaTeX can be found or added as latex, but always appears as LaTeX.

1.3. Smart Groups

A smart group contains all snippets that match a set of rules and is updated as the library changes. You can build rules from folders, tags, languages, dates, and other properties of snippets, and combine them.

To create a smart group, choose Library > New Smart Group, or press Control Command N. To combine rules that must all match with rules where any can match, add a nested set of rules. Press and hold Option, and the + button of each rule changes to a … button. Click it to add a nested set.

To update the rules of an existing smart group, Control-click it and choose Edit Smart Group.

Rules of a smart group for Swift and Objective-C snippets modified in the last 3 months Rules of a smart group for Swift and Objective-C snippets modified in the last 3 months

Here are a few ideas for smart groups:

  • Recently modified: Snippets modified within the last 7 days

  • Untagged: Snippets without any tags

  • Attachments: Snippets that have attachments

  • By language: Snippets in a specific language

  • By project: Snippets in a project’s folders, plus any snippet with the project’s tags

1.4. Favorites

For quick access, add your most-used folders, tags, and smart groups to the Favorites section of the sidebar. Control-click an item and choose Add to Favorites, or drag it into Favorites.

The Favorites section of the sidebar, with Prompts selected The Favorites section of the sidebar, with Prompts selected

1.5. Trash

Deleted snippets are moved to the Trash, which appears in the Favorites section of the sidebar only when it isn’t empty. SnippetsLab doesn’t empty the Trash automatically. An empty snippet, with no title, content, notes, or attachments, is deleted right away.

  • To restore a snippet: Select Trash in the sidebar, Control-click the snippet, and choose Put Back to return it to its original folder. Alternatively, drag it onto a folder in the sidebar, or click Restore at the bottom of the editor.

  • To delete a snippet permanently: Control-click it in the Trash and choose Delete Permanently, or press Option Command Delete. To delete a snippet without moving it to the Trash first, press and hold Option while its shortcut menu is open.

  • To empty the Trash: Choose Library > Empty Trash, press Shift Command Delete, or Control-click Trash in the sidebar and choose Empty Trash.

1.6. Languages

1.6.1. Active Languages

Only active languages are shown in the language menus of the main window and the assistant. Initially, only some common languages are active. To configure the languages listed in the menus, go to Settings > Languages and select the languages you use. Deselecting a language only hides it from the menus and doesn’t affect any snippets that use it.

Language settings showing only the active languages Language settings showing only the active languages

1.6.2. Default Language

You can set a default language for the whole app, and a different default language for each folder. New snippets use the default language of their folder, or the app-wide default language if the folder has none.

  • To set the app-wide default language: Go to Settings > General, click the Default Language pop-up menu, and choose a language.

  • To set a folder’s default language: Control-click the folder and choose from the Default Language submenu.

Only active languages appear in these menus.

1.7. Snippets and Fragments

A snippet can contain multiple fragments, each with its own language, notes, and content. Use fragments for parts that belong together, such as a header and its implementation, HTML with its CSS and JavaScript, or several solutions to one problem.

The main window showing a snippet with three fragments The main window showing a snippet with three fragments
  • To pin a snippet to the top: Swipe right on the snippet in the snippets list, or Control-click it and choose Pin.

  • To copy a snippet:

    • Choose Edit > Copy > Copy Snippet from the menu bar, or press Option Command C. This copies the fragment shown in the editor.

    • Swipe left on the snippet in the snippets list and click Copy. This copies the first fragment.

  • To move snippets to another folder: Control-click the snippets and choose a folder from the Move To submenu, or drag them onto a folder in the sidebar.

  • To open a snippet in its own window:

    • Double-click it in the snippets list.

    • Control-click it and choose Open In New Window.

    • Click the ellipsis.circle button in the toolbar and choose Open In New Window.

    To keep the window in front of other windows, choose View > Float on Top.

  • To change the sort order of the snippets list: Choose View > Sort Snippets By, or Control-click the snippets list and choose an option from the Sort By submenu.

    Only changes to a snippet’s title, content, notes, fragments, or attachments update its modification date. Changing its tags, language, folder, pinned or locked status, or moving it to the Trash doesn’t.

  • To add a fragment:

    • Click the ellipsis.circle button in the toolbar and choose New Fragment or New Fragment From Clipboard.

    • Press Command T, or press Option Command T to create it from the Clipboard content.

  • To lock a snippet and prevent editing: Control-click the snippet and choose Lock Editing. For easier access, add the lock Lock Editing button to the toolbar.

  • To reorder fragments: Control-click a fragment tab and choose Move To Left or Move To Right. Alternatively, drag the tab to a new position, or press Option Shift Command [ or Option Shift Command ].

Tip

To quickly switch between fragments, press Command 1 through Command 9.

1.8. Notes

Add notes to a fragment for context about its content. By default, notes also appear in the snippets list, but they aren’t included when you copy or paste the snippet content.

  • To add notes: Choose Editor > Add Notes, or click the ellipsis.circle button in the toolbar and choose Add Notes. By default, the notes area is hidden when a fragment has no notes. To always show it, go to Settings > General and select Always show snippet notes.

  • To format notes: Use the Format menu. To add a link, press Command K. For quick access to common formatting options, add the Format button to the toolbar.

Formatted notes above the code of a fragment Formatted notes above the code of a fragment

1.9. Attachments

Attach files to a snippet for context, such as screenshots, sample data, or configuration files. Each attachment must be smaller than 100 MB, and each fragment can have up to 100 attachments.

  • To add attachments:

    • Click the ellipsis.circle button in the toolbar and choose Add Attachments.

    • Choose Editor > Add Attachments from the menu bar.

    • Drag files into the snippet, or paste them into the editor.

  • To preview an attachment: Double-click it, or select it and press Space, to open it in Quick Look.

  • To insert an image attachment into a Markdown snippet: Drag the attachment into the editor, or Control-click it and choose Insert As Markdown Link.

  • To optimize images automatically: Go to Settings > General and select Automatically optimize image attachments. This reduces the file size of new image attachments with little visible loss in quality. Existing attachments aren’t affected.

A fragment with two attachments, the first one selected A fragment with two attachments, the first one selected

1.10. Text Editing

Common editor settings are in Settings > Text Editing, including the font, indentation, tab width, line height, line numbers, soft wrap, and autocompletion of brackets and quotes. Autocompletion settings for Markdown lists and code blocks are in Settings > Markdown.

To override automatic indentation and formatting:

  • Auto Indent: When automatic indentation is on, press Option Return to start a new line without indentation.

  • Markdown List Autocompletion:

    • Press Shift Return to continue the current item on a new line without starting a new item.

    • Press Option Return to start a new line without a list marker.

  • Tab: Press Option Tab to insert a literal tab character, even when Indent Using is set to Spaces.

  • Pasting:

    • Choose Edit > Paste and Preserve Formatting or press Option Shift Command V to paste the Clipboard content as is, without automatic code formatting, conversion to Markdown, or inserting images as attachments.

    • When Automatically format code when pasting is selected, press Command Z right after pasting to restore the original formatting.

1.11. Code Formatting

SnippetsLab uses technologies such as clang-format, Prettier, and swift-format for built-in code formatting in many languages.

  • To format a snippet: Choose Edit > Format Code, or press Control Command \. For easier access, add the text.word.spacing Format Code button to the toolbar.

  • To format pasted code automatically: Go to Settings > Text Editing and select Automatically format code when pasting. HTML, Markdown, PHP, and XML are formatted only when you choose Format Code.

1.12. Searching

SnippetsLab offers advanced search. You can search titles or full text, use fuzzy matching, narrow results with filters, and build complex queries with Boolean operators and wildcards. To start searching from anywhere in the app, press Shift Command F.

1.12.1. Search Filters

Use search filters to limit results to specific folders, tags, and languages. To show the filter menu, type in: in the search field, press Option Esc (Escape), or click the magnifyingglass button and choose Insert Filter.

With the filter menu open, keep typing to narrow down the choices. Combine multiple filters to show only the snippets that match all of them.

To move through a long filter menu quickly, press Command ↑ or Command ↓ to jump to the top or bottom, and Option ↑ or Option ↓ to jump to the previous or next section. To add several filters in a row, press and hold Option to keep the menu open after choosing an item.

The search field with a folder filter and a menu of more filters The search field with a folder filter and a menu of more filters

1.12.2. Search Options and Advanced Syntax

Click the magnifyingglass button for more options, including full-text search, fuzzy search, case sensitivity, and result ranking.

When fuzzy search is off, SnippetsLab matches whole words and supports advanced query syntax for combining search terms. For example, search for the following to find snippets with words that start with auth or end with config:

auth* OR *config

Supported operators:

Operator

Description

AND, &

Boolean AND

<space>

Boolean AND

OR, |

Boolean inclusive OR

NOT, !

Boolean NOT

(, )

Begin or end a logical group

*

Wildcard for prefix and suffix search. Ignored in phrase search.

"

Delimiter for phrase search

To exclude matches, put NOT between two terms. For example, search for docker NOT compose to find snippets that contain docker but not compose.