1. Essentials
1.1. Folders
SnippetsLab enables you to create an unlimited number of nested folders to organize your library efficiently. Snippets not assigned to any folder will appear under “Uncategorized.”
To show or hide the sidebar: Choose View > Show Sidebar from the menu bar, or press Shift-Command-L.
To create a folder, you can:
To nest a folder within another folder, you can:
Drag the folder and drop it onto another folder.
Hold Option while creating a new folder to directly create it as a nested folder.
To rename or delete a folder: Right-click on the folder and choose Rename or Delete.
Note: Deleting a folder will also remove all its subfolders, and any snippets in these folders will move to “Uncategorized.”
To set a custom folder icon: Right-click on the folder and choose Customize Icon….
SnippetsLab supports all icons from Apple’s SF Symbols library. You can browse commonly used icons through the in-app UI or search for any icon by its full name for direct use.
To sort folders alphabetically: Go to Settings > General and select Automatically sort folders and smart groups.
To set a default language for a folder: Refer to the section on Default language.
Tip
By default, the snippets list displays all snippets in the selected folder and its subfolders. To exclude snippets from subfolders, right-click on the snippets list, expand Display Options, and deselect Include Snippets From Subfolders.
1.3. Smart Groups
Smart groups in SnippetsLab are a dynamic and powerful feature that allow you to search your library based on custom, complex criteria. With smart groups, you can show specific subsets of snippets that meet certain conditions, such as:
All snippets without any tags.
All snippets with multiple fragments.
All snippets in the Apple Development folder, plus any that have either the iOS or macOS tag.
All snippets modified within the last 7 days.
To create a smart group:
Select Library > New Smart Group from the menu bar, or press Control-Command-N.
Enter a name for your smart group.
Specify the rules you wish to apply.
To add a nested set of rules within a rule, hold the Option key and click the Nest button.
For more complex rules (e.g., some criteria matching all rules, others matching any), create sets of nested rules.
You can rename, modify, duplicate, or delete smart groups by right-clicking on them and selecting the appropriate item from the context menu.
Set a custom icon for any smart group by choosing Customize Icon… from the context menu.
Here are a few examples of smart groups that you might find useful:
Recently modified: Show snippets modified within the last 7 days.
Untagged: Show snippets without any tags.
Attachments: Show snippets that have attachments.
By language: Show snippets in a specific language.
By project: Show snippets that belong to a specific project (e.g. filtered by specific folders and/or tags).
Smart groups are an exceptionally flexible tool that can enhance the organization and management of your snippets. Experiment with various smart groups to discover how they can boost your productivity.
1.4. Shortcuts
You can easily access your most frequently used folders, tags, and smart groups by adding them as shortcuts to the Favorites section in the sidebar. This feature provides quick and convenient access to your most important items.
To add a shortcut, you can:
Right-click on a folder, tag, or smart group and select Add to Favorites.
Simply drag and drop a folder, tag, or smart group into the Favorites section of the sidebar.
1.5. Languages
1.5.1. Active languages
SnippetsLab supports a wide range of programming languages and text formats. To limit the length of the language menu, the app displays only active languages as selected by the user. Initially, the list of active languages includes only the most common languages. You should personalize this list to include the languages you frequently use.
To configure active languages, navigate to Settings > Languages. Here, you can activate a language by selecting its checkbox. Deactivating a language removes it from the language menu but does not affect any snippets that use the deactivated language.
1.5.2. Default language
The application allows setting both an app-wide default language and individual default languages for each folder. New snippets will default to the folder’s language setting, or, if none is set, to the app-wide default language.
To set an app-wide default language: Go to Settings > General, and make your selection under Default Language.
To set a folder-specific default language: Right-click on a folder and choose the desired language from the Default Language submenu.
Note: Only languages marked as active will appear in these menus.
1.5.3. Automatic language detection
SnippetsLab features automatic language detection for the 50 most popular languages, powered by Apple’s Core ML technology.
By default, the app automatically assigns a language when you paste content into the editor unless a default language is already set for the folder. You can adjust these settings in Settings > Languages to always enable automatic detection or disable it entirely.
To detect language at any time, right-click anywhere on the toolbar and select Customize Toolbar…. Then, drag the Detect Language button into the toolbar.
1.6. Snippets and Fragments
A snippet in SnippetsLab may contain multiple fragments, which are distinct parts of the snippet. Each fragment can have its own notes and language settings.
Fragments are useful when a snippet logically consists of several parts, particularly when these parts are in different languages. Common use cases include:
A class header and its implementation.
HTML code along with its JavaScript/CSS counterparts.
Various solutions to a single problem.
To pin a snippet, you can:
Swipe right from the snippets list and choose the Pin action.
Right-click and select Pin from the context menu.
To create a new fragment, you can:
To lock/unlock a snippet for editing, you can:
To rename/delete a fragment: Right-click the fragment tab and select an option from the context menu.
To reorder fragments, you can:
Right-click the fragment tab and choose Move to Right/Left.
Press Option-Shift-Command-[ or Option-Shift-Command-].
Tip
Quickly navigate to a specific fragment using Command-1 ~ Command-9.
1.7. Snippet Linking
Snippet and fragment links allow you to open a specific snippet or fragment with a deep link that starts with snippetslab://
. These links work both inside and outside of SnippetsLab, even when the app is not running.
To obtain a snippet link: Right-click on the snippet in the snippets list and select Copy Snippet Link.
To obtain a fragment link: Right-click on the fragment tab and select Copy Fragment Link.
Snippet and fragment links can be useful for a variety of use cases, such as:
Referencing other snippets and fragments within SnippetsLab.
Linking to your SnippetsLab library from other documents, such as wiki pages or README files.
Creating custom keyboard shortcuts or macros that open specific snippets and fragments.
Tip
Hold Command and click on a deep link to open it in a new snippet window.
1.8. Notes
Add notes to a fragment in the dedicated notes area for additional context. By default, notes will also appear in the snippets list, but will be excluded when you copy or paste the snippet content.
By default, the notes area is hidden if there are no notes.
1.9. Attachments
SnippetsLab allows attaching files to snippets for added context, like screenshots, sample data, or configuration files. Attachments must be under 100 MB.
To add an attachment, you can:
To activate Quick Look: Double-click on an attachment or press Space while selected. Note that Quick Look may not be available for all file types.
To manage attachments: Right-click for options like open, rename, delete, or save a copy.
To insert image attachments to Markdown snippet: Drag an attachment into the editor or right-click and choose Insert as Markdown Link.
To automatically optimize images: Navigate to Settings > General, and select Save optimized copies when importing images.
The optimization can often reduce the image file size considerably with limited-to-minimal impact on visual quality.
Tip
Create a smart group to display all snippets with attachments.
1.10. Code Formatting
SnippetsLab uses technologies such as clang-format and Prettier for built-in code formatting in various languages.
To format a snippet, you can:
To format automatically: Navigate to Settings > Text Editing and enable Automatically format code when pasting.
1.11. Searching
SnippetsLab offers advanced searching capabilities. To switch key focus to the main search bar from anywhere in the app, press Shift-Command-F.
1.11.1. Search Filters
Search filters allow you to limit your search results to specific folders, tags, and languages. There are a few ways to insert a search filter:
Type the keyword
in:
in the search bar.Press Option-Esc.
With the search filter menu open, continue typing to narrow down the choices. You can combine multiple filters to show only snippets that satisfy all criteria.
To quickly navigate to an intended item in the filter menu, press Command-Up or Command-Down to jump to the top or bottom of the list, and Option-Up or Option-Down to jump to the previous or next section.
By default, the search filter menu closes automatically after making a selection. To keep it open, hold Option.
1.11.2. Search Options and Advanced Syntax
Click the button to access additional options, including full-text search, fuzzy search, case sensitivity, result ranking, and more.
In non-fuzzy search, SnippetsLab performs whole-word matches by default but also supports advanced queries using special syntax, including boolean, prefix, suffix, substring, phrase, and so on. Moreover, you can combine multiple query types within a single search. For example, the following query will return snippets containing words that start with “foo” or words that end with “bar”:
foo* OR *bar
Below is a list of all supported operators:
Operator |
Description |
---|---|
|
Boolean AND |
|
Boolean AND |
|
Boolean inclusive OR |
|
Boolean NOT |
|
Begin/end logical grouping |
|
Wildcard for prefix and suffix search; ignored in phrase searching. |
|
Delimiter for phrase searching |
The Boolean NOT operator can also be used for logical exclusion. For example, the query foo NOT bar
will return snippets containing foo
but not bar
.
Note: Unary boolean operators (e.g., NOT bar
) are not supported, so such queries will not return any results.