Snippets
A snippet maps a short abbreviation to longer text. With expansion on, you type the abbreviation in any app and Macotron replaces it with the text. The Text Snippets plugin also puts snippets in the launcher.
The Text Snippets plugin
The built-in plugin defines one snippet, omw, which expands to "On my way!", and turns on expansion. It also adds two launcher rows:
- omw copies "On my way!" to the clipboard.
- Insert Date copies today's date to the clipboard.
The Insert OMW command does the same as the omw row.
Adding your own
Snippets live in plugin code, not in Settings. Edit plugins/snippets.js in your workdir, or ask your coding agent to, and add a line for each one:
macotron.snippets.set("omw", "On my way!");
macotron.snippets.set(";addr", "1 Infinite Loop, Cupertino, CA 95014");
macotron.snippets.set(";sig", "Thanks,\nIan");
macotron.snippets.setExpansionEnabled(true);
Save the file and reload the plugin. See Writing plugins.
How expansion works
- Expansion happens as soon as the text you typed ends with an abbreviation. You do not press Space or Tab after it.
- Macotron deletes the abbreviation, pastes the text, then puts back what was on the clipboard before (if it was text).
- Space, Return, Tab, Escape, and any Command, Control, or Option shortcut clear what Macotron has seen you type. The abbreviation must come after the last of those, but it can end a longer word: typing
xomwalso expands. - Abbreviations match plain ASCII characters only.
- When two abbreviations both match, the longer one wins.
Pick abbreviations that never occur in normal typing. A prefix such as ; works well: sig would fire halfway through "signal", but ;sig never shows up in a real word.
Expansion watches the keyboard and types for you, so it needs Input Monitoring and Accessibility. Snippets are kept in memory, so the plugin sets them again each time it loads. See Permissions.