SnippetsLab User Manual

Updated 09032025-043324


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 nest a folder within another folder, you can:

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.2. Tags

Tags offer an additional layer of organization in SnippetsLab, allowing for multiple tags to be associated with a single snippet.

The tags popover will suggest commonly used and appropriate tags for the current snippet. These suggestions evolve based on your usage of tags in the library.

To set a custom color for a tag: Right-click on a tag in the sidebar and choose an option from Customize Color.

To rename or delete a tag: Right-click on a tag in the sidebar and select Rename or Delete.

To change the sort order: Right-click on a tag in the sidebar and choose the desired option in the Sort Tags By submenu. Tags can be sorted alphabetically or by snippets count. Additionally, you can choose to show tags with custom colors first by selecting the Color option.

By default, the snippets list displays all tags for each snippet. You can modify this in Settings > General > Snippets List > Show Tags to show only tags with custom colors or to hide tags from the snippets list.

Note

Tag names are case-insensitive but case-preserving. This means that while searching for or adding existing tags, any capitalization can be used, but the display format will be as initially created. For instance, if you create a tag named LaTeX, you can later search for or add it as latex, but it will always be displayed as LaTeX.

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:

To create a smart group:

  1. Select Library > New Smart Group from the menu bar, or press Control-Command-N.
  2. Enter a name for your smart group.
  3. Specify the rules you wish to apply.
  4. To add a nested set of rules within a rule, hold the Option key and click the Nest button.
  5. 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:

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.

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.

Note: Only languages marked as active will appear in these menus.

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:

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:

Tip

Quickly navigate to a specific fragment using Command-1 ~ Command-9.

1.7. 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.

To always show the notes area: Go to Settings > General, and enable Always show notes field.

To add links: Choose Format > Link… from the menu bar, or press Command-K.

To format text: Use the Format menu in the menu bar. For quick access to common formatting options, add the Format button to the toolbar.

1.8. Attachments

SnippetsLab allows attaching files to snippets for added context, like screenshots, sample data, or configuration files. Attachments must be under 100 MB.

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.9. Code Formatting

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

To format automatically: Navigate to Settings > Text Editing and enable Automatically format code when pasting.

1.10. 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.10.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:

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.10.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

AND, &

Boolean AND

<space>

Boolean AND

OR, |

Boolean inclusive OR

NOT, !

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.

2. Markdown Snippets

https://www.renfei.org/snippets-lab/manual/mac/markdown.html

Saved Wed, 3 Sep at 03:33


SnippetsLab provides comprehensive support for Markdown. Activate these features by setting the language of your snippet to Markdown.

2.1. Preview

To switch between full and side-by-side preview modes: Right-click (or click and hold) the

button in the toolbar and select the preferred mode from the dropdown menu.

For dedicated control for each preview mode, right-click anywhere on the toolbar, select Customize Toolbar…, and drag the Preview Modes control into the toolbar.

Scroll sync. In side-by-side preview mode, SnippetsLab automatically synchronizes scrolling between the editor and preview panels. To make scroll sync one-way only or to disable it, adjust the Sync Scroll settings in the Editor menu in the menu bar.

Preview mode persistence. By default, the selected Markdown preview mode applies globally. However, SnippetsLab can also remember your chosen preview mode for each snippet, which is useful for distinguishing between “finalized” and “in-progress” work. To enable, open Settings > Markdown > Options, and select Remember the selected preview mode for each snippet.

2.2. Editing

Additional Markdown elements such as images, tables, and footnotes are also available in the Format menu.

Inline rich text styles. For improved readability, SnippetsLab enhances Markdown source code with rich text styles in the main editor. If preferred, this can be disabled in Settings > Markdown > Options > Use in-editor rich text styles.

Line break handling. By default, SnippetsLab follows GitHub-flavored Markdown (GFM) or StackOverflow style where a single line break is parsed as a hard break. To adopt the CommonMark specification and treat a line break as a soft break, navigate to Settings > Markdown > Options and turn off Treat newlines as line breaks.

Smart symbols. To automatically converts ASCII symbols to the HTML entity equivalents, navigate to Settings > Markdown > Options and enable Smart symbols. For more details, see SmartSymbols.

Tip

For quick access to common format options, add the “Format” button to the toolbar.

2.3. Code Blocks

Markdown includes full syntax highlighting support for code blocks. Specify a language alias with the fenced code block syntax like below for best results, but the app may guess the most likely language if not specified.

```ruby
def robot_invasion
 puts("robot " * 1000)
end
```

While both fenced and indented code blocks are supported, only fenced code blocks allow you to specify additional options, such as language alias.

```swift linenums="1"
import foo
import bar
import baz
```
```swift hl_lines="2"
import foo
import bar
import baz
```

2.4. Table of Contents

Include an interactive, auto-updating table of contents in the preview with the [TOC] marker. For best results, place it at the start of the snippet.

2.5. LaTeX/MathJax

Powered by MathJax, SnippetsLab supports rendering complex math formulas with high-quality typography. To write inline formulas, use $..$ as delimiters. To write block-level formulas, use $$..$$ as delimiters. Avoid spaces around the $ delimiters for correct rendering.

The **gamma function** is defined for all complex numbers except the non-positive integers. For any positive integer $n$, $\Gamma(n) = (n-1)!\quad$.

Derived by Daniel Bernoulli, for complex numbers with a positive real part, the gamma function is defined via a convergent improper integral:

$$\Gamma(z) = \int_0^\infty x^{z-1} e^{-x}\,dx, \ \qquad \Re(z) > 0\ .$$

The notation $\Gamma (z)$ is due to Legendre. If the real part of the complex number $z$ is strictly positive ($\Re (z)>0$), then the integral converges absolutely, and is known as the Euler integral of the second kind. Using integration by parts, one sees that:

$$
\begin{aligned}
 \Gamma(z+1) & = \int_0^\infty x^{z} e^{-x} \, dx \\
&= \Bigl[-x^z e^{-x}\Bigr]_0^\infty + \int_0^\infty z x^{z-1} e^{-x}\, dx \\
&= \lim_{x\to \infty}\left(-x^z e^{-x}\right) - \left(-0^z e^{-0}\right) + z\int_0^\infty x^{z-1} e^{-x}\, dx.
\end{aligned}
$$

For more information about MathJax, consult the official documentation.

2.6. Diagrams

SnippetsLab has built-in support for Mermaid, a popular library for creating diagrams and visualizations with source code. Supported diagram types include:

To insert a diagram, surround the diagram code with either the mermaid` ordiagram` marker. You can also choose Format > Diagram from the menu bar to quickly insert the required boilerplate.

Refer to official Mermaid documentation for more information on the syntax for each diagram type.

2.7. Preview Themes

Customize the preview CSS theme in Settings > Markdown > Theme.

Markdown themes are designed to integrate with the app’s main theme for a cohesive experience. For example, the main theme’s background color, accent color, and syntax highlighting color styles will be added automatically by SnippetsLab.

Tip

When customizing the CSS, right-click on Markdown preview and select Inspect Element to discover the document structure and necessary CSS selectors.

3. SnippetsLab Assistant

https://www.renfei.org/snippets-lab/manual/mac/assistant.html

Saved Wed, 3 Sep at 03:33


SnippetsLab Assistant is a menu bar companion designed to provide quick access to your library. Advanced users who prefer a keyboard-centric workflow will also find the extensive keyboard shortcut support helpful.

Activate the assistant by clicking the

button in the menu bar. You can also assign a custom keyboard shortcut in Settings > Assistant. The assistant is enabled by default, but can be disabled in Settings, if desired.

Note

The Assistant icon may not be visible in the menu bar if there are too many items, as macOS manages menu bar space automatically. If the icon does not appear, try closing other menu bar apps to make room.

3.1. Browse Mode

To switch to browse mode, click the

Browse button at the top of the window, or press Shift-Command-1.

You can navigate the snippets list with these keyboard shortcuts:

Action

Keyboard Shortcut

Go to the previous or next item

or

Go to the previous or next page

Option-▲ or Option-▼

Jump to the top of bottom

Command-▲ or Command-▼

Scroll up or down without changing selection

Fn-▲ or Fn-▼

3.1.1. Default Snippets

By default, the assistant displays all snippets in the same order as the main window. You can customize the default view in Settings > Assistant > Default Snippets. For example, to show a subset of snippets that you frequently access from the menu bar.

3.1.2. Search

The assistant provides access to all the search tools available in the main window, including search scope, filters, and more. For more information, see Searching.

By default, the assistant remembers your search session even after closing and reopening. To automatically clear the search field each time, enable the Automatically clear search field when open option in Settings > Assistant.

3.1.3. Snippet Actions

You can perform the following actions on snippets in the list:

Action

How To Perform

Copy to Clipboard

Single-click, or press Return, or press Command-C

Open in Main Window

Option-click, or press Option-Return

Paste to Active App

(unassigned by default)

Quick Look

Double-click, press , or swipe right

Dismiss Quick Look

Press or Esc

You can customize the keyboard shortcuts of these actions in Settings > Assistant. You can also swipe left to reveal the primary and secondary options.

Note

The “Paste to active app” action requires accessibility permission because it uses Apple Events to perform the paste operation. You will be prompted to grant access the first time you select this action in Settings. You can also manually grant or revoke access at any time in System Settings > Security & Privacy > Privacy > Accessibility.

3.1.4. Quick Look

With Quick Look active, press Command-1 ~ Command-9 to jump to the first nine fragments. The keyboard shortcuts for snippet actions also work on the currently displayed fragment.

For more convenient access, you can detach a Quick Look by dragging it away from the assistant by the edge. A detached Quick Look stays on top of other windows, and can be resized.

3.2. Create Mode

The create mode allows you to quickly add new snippets to your library without using the main app window. To switch to create mode, click the

Create button at the top of the window, or press Shift-Command-2.

4. Advanced Features

4. Advanced Features

Saved Wed, 3 Sep at 02:58


4.1. Snippet Links

Snippet and fragment links are special URLs that start with snippetslab://. These links let you open specific snippets and fragments from your SnippetsLab library, from anywhere in your system.

Snippet and fragment links can be useful for a variety of use cases, such as:

Tip

Hold Command while clicking on a snippet link to open it in a new window.

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

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

Tips for using Quick Actions

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

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.

How It Works

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:

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

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.

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.

5. Theme Customization

https://www.renfei.org/snippets-lab/manual/mac/themes.html

Saved Wed, 3 Sep at 03:34


SnippetsLab encourages you to personalize the experience by customizing built-in themes or creating new themes from templates. You can change not only syntax highlighting, but nearly all the app’s interface as well.

Note: This section is about customizing the main app theme. To customize the Markdown Preview, see Preview Themes.

5.1. Theme List

You can see all available themes in Settings > Theme. Here, you can:

By default, SnippetsLab applies a transition effect when switching themes. If you wish to disable this animation temporarily (such as to make it easier to compare two similar-looking themes), hold Option.

5.2. Syntax Colors

In SnippetsLab, syntax types are organized hierarchically, mirroring the structure used by Pygments, the underlying syntax highlighting engine.

All syntax types start with a top-level type, for example, Name or Keyword. Consider these as the primary categories of all syntax types. Each top-level type contains subtypes that are more specific, for example, Name.Attribute, Name.Class, Name.Function and Name.Variable are all subtypes of Name. This hierarchy may go deeper, for instance Name.Variable further contains Name.Variable.Class, Name.Variable.Instance, and others. This nesting allows for fine control over syntax coloring at any desired granularity.

In the theme editor, this hierarchical structure is visually represented, where you can expand a type to view its subtypes.

When a color is assigned to a parent type, it is automatically applied to all its descendant types, unless a specific color is already set for a subtype. If a top-level type has no specific color assigned, it defaults to the plain text color.

For more in-depth information about all syntax types, refer to Builtin Tokens section in Pygments documentation.

Any changes made to the selected theme are reflected in real time, and are saved automatically when switching to another theme. To undo the changes since the last save, click the Discard Changes… button.

Note

Languages usually do not make use of all the possible syntax types. They only employ a subset of these types that are relevant to the language features.

5.3. App Colors

To reveal more customization options of the app interface, click the Advanced… button. Most of the interface elements have the ability to adapt their appearance based on the surroundings, for example the background color. This makes it easier to make desired customizations without detailed adjustments to every option.

Any changes made in the Advanced section are reflected in real time. To undo the changes, click the Discard Changes… button. Unsaved changes made before opening the Advanced window are not affected.

5.3.1. Background Color and Theme Style

You can set the app-wide background color in General > Background. You can also override the background color for the sidebar, snippets list, and editor by setting the background color in their respective tabs.

There are two theme styles: Light and Dark. The theme style determines the appearance of texts and icons, and potentially windows and menus. The app is usually able to automatically determine the style based on the background color, but you can manually choose one if required.

5.3.2. Wallpaper Tinting

Wallpaper Tinting, introduced in macOS Mojave, subtly adjusts window colors to match the wallpaper behind the window. While only supported by the Mojave Dark theme by default, it can be enabled in other themes through:

5.3.3. Developer Colors

macOS allows customization of certain system-wide colors such as the accent color and text selection color in System Settings > Appearance. Most built-in themes respect these settings by using dynamic developer colors, instead of fixed colors. These colors are available in the color panel under the Color Palettes tab, Developer category.

These colors may change based on a variety of system settings, such as appearance, accent color, accessibility settings, and more. The most common ones are the accent color (controlAccentColor), and the text selection color (selectedTextBackgroundColor).

Important

It is recommended to use a regular, static color when possible. Developer colors may change in a way that is not expected by the user, and SnippetsLab’s support for developer colors may vary with future macOS releases.

6. Sync and Backup

https://www.renfei.org/snippets-lab/manual/mac/sync-and-backup.html

Saved Wed, 3 Sep at 03:34


6.1. iCloud Sync

When using iCloud Sync, your data is stored in iCloud and automatically synchronized across all your Macs signed in with the same Apple ID. To modify library and sync settings, navigate to Settings > Sync.

6.1.1. Turning on iCloud Sync

To enable iCloud Sync, ensure all the following conditions are met:

Note

Unlike apps like Pages or TextEdit, SnippetsLab doesn’t create an entry in the “iCloud Drive” folder in Finder. This is because SnippetsLab uses a single library format rather than a “documents” architecture, similar to the Notes or Calendar app.

6.1.2. Turning off iCloud Sync

Disabling iCloud Sync closes the iCloud library and opens the local library instead. Consequently, all contents stored in iCloud will no longer be visible. SnippetsLab will prompt you to keep a local copy of your iCloud library before the sync is turned off.

You can still access your iCloud library on other Macs using iCloud. Re-enabling iCloud Sync will make your iCloud library available again.

6.1.3. Troubleshooting iCloud Sync

6.2. Managing Backups

To ensure you always have access to both recent and older versions of your data, SnippetsLab automatically manages backups of your library at various intervals when editing:

To optimize storage space, backups that exceed these predefined intervals are automatically deleted. However, any backups you create manually are excluded from this automatic cleanup process and preserved indefinitely, allowing you to maintain specific snapshots of your library as needed.

To manage or restore backups, go to Settings > Advanced. Here, you can:

Important

It is strongly recommended that you specify a custom backup location to avoid loss of backups due to system operations (like app deletion) or third-party applications that cleans up your Mac.

7. Import, Export, and Publish

https://www.renfei.org/snippets-lab/manual/mac/import-and-export.html

Saved Wed, 3 Sep at 03:40


7.1. Import

SnippetsLab supports importing data from various sources:

To import:

7.2. Export

You can export your library as-is as a manual backup, or for use on another computer, or export it in other formats like JSON, XML, or as individual text files. To export:

7.3. Publish Gist to GitHub

Directly publish your snippets SnippetsLab to GitHub as gists.

SnippetsLab only requires the gist scope, which grants access to your public and private gists. The app does not have access to other parts of your GitHub account, such as repositories or profile information.

To publish a snippet as gist: Right-click a snippet in the snippets list and select the GitHub sub-menu. Then, choose from the following:

To open the gist in GitHub: Right-click a snippet in the snippets list and choose GitHub > Open in GitHub.

You can also copy the gist link to the clipboard with Copy GitHub Gist Link.

To unlink a snippet with GitHub: Right-click a snippet in the snippets list and choose GitHub > Unlink with GitHub.

This action only removes the association within SnippetsLab and does not delete the gist from GitHub.

Tip

You can create a smart group that displays all snippets associated with gists. In smart group conditions, select Gist is Yes. You can also filter by specific gist authors, if desired. Refer to Smart Groups for additional details.

8. Keyboard Shortcuts

8. Keyboard Shortcuts

Saved Wed, 3 Sep at 03:32


8. Keyboard Shortcuts

General

Action Shortcut
Open Settings Command-,
New Folder Shift-Command-N
New Nested Folder Option-Shift-Command-N
New Smart Group Control-Command-N
New Snippet Command-N
New Snippet from Clipboard Option-Command-N
New Fragment Command-T
New Fragment from Clipboard Option-Command-T
Move To Trash Command-Delete
Empty Trash Shift-Command-Delete
Save Command-S
Print Command-P
Find in Library Shift-Command-F
Copy Current Snippet Option-Command-C
Copy Current Snippet Link Control-Option-Command-C
Toggle Main Window (user defined)
Toggle SnippetsLab Assistant (user defined)

Text Editing

Action Shortcut
Paste and Preserve Formatting Option-Shift-Command-V
Duplicate Lines Command-D
Shift Right / Indent Command-] or Tab
Shift Left / Un-indent Command-[ or Shift-Tab
Toggle Comment Command-/
Format Code Control-Command- 
Trim Trailing Whitespaces Control-Command-W
Convert Indentation to Spaces Control-Command-S
Convert Indentation to Tabs Control-Command-T

Format (Markdown/Snippet Notes)

Action Shortcut
Toggle Strong Command-B
Toggle Emphasize (Italic) Command-I
Toggle Underline Command-U
Toggle Inline Code Command-`
Toggle Subscript Control-Command-−
Toggle Superscript Control-Command-+ or Control-Command-Shift-=
Toggle Heading 16 Option-Command-1 ~ Option-Command-6
Insert Link Command-K

UI Navigation

Action Shortcut
Toggle Sidebar Shift-Command-L
Show Quick Actions Shift-Command-A or user defined
Move Focus to Sidebar Control-1
Move Focus to Snippets List Control-2
Move Focus to Editor Control-3
Move Focus to Preview Control-4
Insert Search Filter (Search Field) Option-Esc
Go Back Control-Command-◀︎
Go Forward Control-Command-▶︎
Enter Full Screen Fn-F or Globe-F

Editor

Action Shortcut
Show Next Fragment Shift-Command-[
Show Previous Fragment Shift-Command-]
Jump to Fragment 19 Command-1 ~ Command-9
Move Fragment Right Option-Shift-Command-[
Move Fragment Left Option-Shift-Command-]
Rename Fragment Option-Shift-Command-T
Delete Fragment Option-Shift-Command-Delete
Toggle Markdown Preview Shift-Command-M
Toggle Soft Wrap Lines Shift-Command-W
Make Font Bigger (Editor) Command-+
Make Font Smaller (Editor) Command-−
Zoom In (Preview) Command-+
Zoom Out (Preview) Command-−
Reset Zoom (Preview) Command-0

SnippetsLab Assistant

Action Shortcut
Open Browse Shift-Command-1
Open Create Shift-Command-2
Open Main Window Shift-Command-3
Scroll List Up Fn-▲
Scroll List Down Fn-▼
Jump to Top Command-▲
Jump to Bottom Command-▼
Jump to Previous Page Option-▲
Jump to Next Page Option-▼
Jump to Fragment 19 (Quick Look) Command-1 ~ Command-9
Quick Look ▶︎
Copy Snippet/Fragment Command-C
Activate Primary Action Return
Activate Command Action Command-Return
Activate Alternate Action Option-Return

Tip

It is possible to change the keyboard shortcuts defined by SnippetsLab or add new keyboard shortcuts, as long as the action is listed in the menu bar. For detailed instructions, please refer to Create keyboard shortcuts for apps.

Frequently Asked Questions

https://www.renfei.org/snippets-lab/manual/mac/faq.html

Saved Wed, 3 Sep at 03:39


What languages does SnippetsLab support?

Presently, SnippetsLab supports over 580 language and text formats. For a full list, please refer to Supported Languages.

Can I use Markdown for technical documentation in SnippetsLab?

Absolutely. SnippetsLab has full support for Markdown–including side-by-side preview, rich text formatting, syntax highlighted code blocks, diagrams, LaTeX/MathJax, and more–making it an excellent tool for technical documentations. To learn more about Markdown support, refer to Markdown Snippets.

Why don’t I see SnippetsLab in my iCloud Drive folder?

Unlike apps like Pages or TextEdit, SnippetsLab doesn’t create an entry in the “iCloud Drive” folder in Finder. This is because SnippetsLab uses a single library format rather than a “documents” architecture, similar to the Notes or Calendar app.

How can I set a default language for new snippets?

To set a default language for a folder, right-click on the folder in the sidebar and choose the desired language from Default Language submenu.

To set an app-wide default language, go to Settings > General, and select an option from Default Language.

Can I add or request new languages for SnippetsLab?

Users can’t directly add custom languages. Since SnippetsLab utilizes the open source project Pygments for syntax highlighting, contributing to Pygments is the best way. These additions will be included in future SnippetsLab updates.

How do I mix languages in a single snippet?

Special languages are available for common use cases, such as “HTML+PHP” and “JavaScript+PHP.” You can also:

Can I assign a tag to multiple snippets at once?

Yes. Select all snippets you wish to tag, and drag them to the desired tag in the sidebar.

Why don’t my local images show in Markdown snippets?

Local image URLs aren’t supported directly in Markdown due to Apple’s sandboxing restrictions, as SnippetsLab does not have access to arbitrary files in the system. Instead, add images and other files as Attachments.

Can I hide SnippetsLab from the Dock?

Yes. Navigate to Settings > Assistant, and select Hide dock icon. However, please note that due to technical limitations, when the Dock icon is hidden, the menu bar for SnippetsLab will also become unavailable.

How do I migrate my library between the Mac App Store and Setapp versions?

The Mac App Store and Setapp versions are technically separate apps, therefore the data will not automatically sync between each other with iCloud. To migrate your library, export a copy of the library in SnippetsLab Library format from one version and import it into the other.

Can I import data from external sources?

SnippetsLab supports imports from Quiver, CodeBox, Gist, and any JSON file conforming to the supported format. For more information on JSON import, refer to JSON Import Format Specification.

How do I find and share SnippetsLab crash reports?

If you experience any crashes when using SnippetsLab, it is greatly appreciated if you share more details with us, so we can investigate the underlying issue. To find a crash report, follow the steps below:

  1. In Finder, open the Go menu and choose Go to Folder….
  2. Paste the path ~/Library/Logs/DiagnosticReports/ into the text field.
  3. Click the Go button.
  4. Filter the files by SnippetsLab and locate the latest (or recent) .crash files.
  5. Send these crash reports, along with any additional information (including steps to reproduce the crash, if possible) to support@renfei.org.

Does SnippetsLab support both Intel and Apple Silicon Macs?

Yes. SnippetsLab is a universal application and runs natively on both Intel and Apple Silicon (arm64) systems.

Will SnippetsLab run on older versions of macOS?

SnippetsLab supports the three most recent major releases of macOS. This allows us to more readily adopt new features and enhancements from the latest macOS updates, ensuring the best user experience and app performance.

Users with older macOS versions can still use SnippetsLab, but they may not receive the latest updates or have access to newer features.

Is there a plan for an iOS version of SnippetsLab?

As of now, SnippetsLab is exclusively available for macOS. While we are always exploring new ways to enhance the user experience, there is currently no confirmed plan for releasing an iOS/iPadOS version of SnippetsLab. However, with growing interest and frequent requests regarding the iOS/iPadOS version, we are considering this for potential future development.

Can I download SnippetsLab from outside the Mac App Store?

Currently, SnippetsLab is only available through the Mac App Store and Setapp.

Why is SnippetsLab now free? Is the app still actively maintained?

By making the app free, we hope to bring SnippetsLab to a wider audience, allowing more developers—especially students—to discover and enjoy it. This change also lets us focus on polishing the app without the distractions that often accompany monetization. SnippetsLab will continue to receive updates, with no changes to the development roadmap.

I purchased SnippetsLab in the past. Can I get a refund now that it is free?

Your support has been instrumental in shaping SnippetsLab into what it is today, and for that I am deeply grateful. As such, however, there is no plan to offer refunds for past purchases due to this change. Please note that refunds are still generally available and is handled directly by Apple.

I’ve been enjoying the app and would like to support its development.

This is not a question, but thank you! Your continued use and feedback are the best ways to support its development. Sharing the app with others or leaving a review on the App Store would also mean a lot.

JSON Import Format Specification

JSON Import Format Specification

Saved Wed, 3 Sep at 03:35


General information

SnippetsLab defines a JSON library format and can import data from any .json file that conforms to the required format, as discussed below. This makes it possible to import from arbitrary third-party sources as long as they are converted to the supported format first.

The JSON format is designed to support the app’s full feature set while allowing users to use only a subset of them. For example, you can generate and import a JSON file that only contains snippets (no folders, tags, etc.). Most of the attributes are optional, with a few exceptions, which are marked as “required” in the description.

Schema

Root

Key path: (root)

Field

Type

Description

contents

Dictionary

A dictionary containing all folders, snippets, smart groups, tags, and shortcuts. Required.

Contents

Key path: (root).contents

Field

Type

Description

folders

[Folder]

An array of all root level folders.

snippets

[Snippet]

An array of all snippets.

smartGroups

[SmartGroup]

An array of all smart groups.

tags

[Tag]

An array of all tags.

shortcuts

[Shortcut]

An array of all shortcuts.

Folder

Key path: (root).contents.folders[*].

Field

Type

Description

title

String

Name of the folder.

uuid

String

Unique identifier. See discussion. Required.

children

[Folder]

An array of subfolders inside the folder.

Snippet

Key path: (root).contents.snippets[*].

Field

Type

Description

title

String

Name of the snippet. Required.

folder

String

UUID of the folder that this snippet belongs to.

tags

[String]

An array of UUIDs of tags assigned to this snippet.

pinned

Boolean

Indicates whether this snippet is pinned.

dateCreated

String

Creation date of the snippet. See discussion.

dateModified

String

Last modification date of the snippet. See discussion.

fragments

[Fragment]

An array of fragments. Each must have at least one fragment. Required.

Fragment

Key path: (root).contents.snippets[*].fragments[*].

Field

Type

Description

title

String

Name of the fragment, this is often omitted if there is only one fragment.

note

String

Text for the notes area.

noteAttributes

[NotesAttribute]

Rich text attributes for the notes.

content

String

The content of the snippet. Required.

language

String

Language of the fragment. See discussion.

dateCreated

String

Creation date of the fragment. See discussion.

dateModified

String

Last modification date of the fragment. See discussion.

Smart Group

Key path: (root).contents.smartGroups[*].

Field

Type

Description

title

String

Name of the smart group.

uuid

String

Unique identifier. See discussion. Required.

predicate

String

Search predicate of the smart group. See discussion. Required.

Tag

Key path: (root).contents.tags[*].

Field

Type

Description

title

String

Name of the tag.

uuid

String

Unique identifier. See discussion. Required.

Shortcut

Key path: (root).contents.shortcuts[*].

Field

Type

Description

uuid

String

Unique identifier of the folder, smart group or tag that this shortcut links to. Required.

Note Attribute

Key path: (root).contents.snippets[*].fragments[*].noteAttributes[*].

Field

Type

Description

name

String

Name of the attribute, for example strong, underline, link, etc. Required.

range

[Int]

Range of this attribute, in the format of [location, length]. The offsets are measured in UTF-16 code units. Required.

stringValue

String

An optional string value for the attribute, currently only used for the link attribute, where this should be the URL for the link.

Discussion

Example

{
      "contents": {
        "folders": [
          {
            "title": "Publishing",
            "uuid": "D3F0277B-6230-46C1-9D2E-3E1B8CE509BF"
          },
          {
            "title": "Graphic Design",
            "uuid": "D42BB115-44C4-4931-ACF8-8AD5F2D1778C",
            "children": [
              {
                "title": "Subfolder 1",
                "uuid": "4D356EC0-6118-4DDE-B09C-EC4116698877",
              },
              {
                "title": "Subfolder 2",
                "uuid": "2C6E47F2-A23F-4B4D-B63E-B1C37973A7BC",
              }
            ]
          }
        ],
        "snippets": [
          {
            "title": "Lorem ipsum",
            "folder": "D3F0277B-6230-46C1-9D2E-3E1B8CE509BF",
            "fragments": [
              {
                "title" : "Fragment",
                "language": "MarkdownLexer",
                "note": "Lorem ipsum is a placeholder text commonly used to demonstrate the visual form of a document or a typeface without relying on meaningful content.",
                "content": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
                "dateCreated": "2011-08-29T20:34:41Z",
                "dateModified": "2011-08-29T20:34:41Z",
                "uuid": "FA7BA77B-A93C-4D92-AC70-42EFF051C4D5",
              }
            ],
            "tags": [
              "017B7917-6B0A-4E9C-8757-F142E7B3C615",
              "D292ECB1-F007-4CE7-A65C-4AB08AD689FD"
            ],
            "dateCreated": "2011-08-29T20:34:41Z",
            "dateModified": "2011-08-29T20:34:41Z",
            "uuid": "5E680391-9BB0-4C8F-BC52-39F1836A717F",
          }
        ],
        "smartGroups": [
          {
            "title": "Markdown",
            "predicate": "ANY parts.language.displayName ==[cd] \"Markdown\"",
            "uuid": "41AD5A0A-84DE-4CD8-A951-7ED4060F7476",
          },
        ],
        "tags": [
          {
            "title": "lorem",
            "uuid": "017B7917-6B0A-4E9C-8757-F142E7B3C615",
          },
          {
            "title": "ipsum",
            "uuid": "D292ECB1-F007-4CE7-A65C-4AB08AD689FD",
          }
        ]
      }
    }