macOS
app.
See other variants:
Windows

Since version 1.5, Texpad has supported Snippets functionality to make it easy to insert regularly used blocks of text into your document. Texpad is distributed with a small number of helpful Snippets, but the system is fully configurable. You may edit them and/or add your own.

# Usage

To use a Snippet, either choose the Snippet from the dropdown menu, or press the associated hotkey – all hotkeys are activated with a control key.

# Configuring

All snippets are stored as text files in the Snippets subdirectory of Texpad’s Application Support directory. To open this directory, click the option from the top of the menu.

To delete a snippet delete the file and it will be removed when Texpad is rebooted.

To rename a snippet, rename the file containing the snippet. The file extension is ignored, and will not form part of the snippet name.

To add a snippet, either copy the snippet file into the directory, or create a new file in that directory, with the name you want the snippet to carry.

# Syntax

Snippet files are flat text files with a straightforward key = value syntax. Lines beginning with a % sign are interpreted as comments and ignored. All other lines have a key = value syntax.

The key is flattened. That is to say all whitespace, dashes and underscores are stripped and the entire key is rendered into lower case. For example Ctrl-Key, Ctrl key and ctrlkey are all equivalent keys.

If there is no right hand side to the line, then starting with the next line, all lines until the end of the file are used as the value.

An example file follows.

An example snippet
% A snippet to insert an itemize environment
ctrl key = z
group = Environment
insert at cursor =
\\begin{itemize}
\item
\end{itemize}

# Hotkeys: Key combinations associated with snippets

insert at cursor The text that should be inserted at the current cursor position. Any currently selected text will be substituted for <SELECTION> and the new selection will be placed around that text.