Repoburg
Login

Customization: Custom Snippets

Custom Snippets are reusable code blocks that you can quickly insert while writing Context Templates. They act as shortcuts, saving you from re-typing common helper functions or template structures.

Managing Snippets

You can manage snippets from the Custom Snippets page, accessible from the home dashboard or via a link on the Context Templates page.

Snippet Properties

  • Prefix: The short trigger word you'll type to bring up the snippet in the editor's autocomplete menu (e.g., rglob).
  • Description: A brief explanation of what the snippet does, which appears in the autocomplete menu.
  • Body: The actual content that will be inserted. This can be plain text or a more complex snippet with placeholders for your cursor to jump to.

Using Placeholders in the Body

You can use standard snippet syntax for placeholders, like ${1:default_value}. When the snippet is inserted, your cursor will jump to the ${1} position, then ${2}, and so on, when you press the Tab key.

Example Body:

<%~ await it.ripGrep('${1:searchTerm} -g "${2:*.ts}"') %>

When you insert this snippet, your cursor will first highlight searchTerm. After you type your search term, pressing Tab will move the cursor to highlight *.ts.

Using Snippets in the Template Editor

When editing a Context Template, simply start typing the prefix of a snippet you've created. The snippet will appear in the autocomplete suggestions. Press Enter or Tab to insert it.