jeansordes411 downloadsExpand text snippets as you type, with support for mobile, regex triggers, and commands.
Auto Expander replaces short triggers with reusable text snippets while you type. It works on desktop and mobile, supports literal and regular-expression triggers, and can run Obsidian commands after an expansion.
$0.$1 in replacements.Once Auto Expander is listed in the Community plugins directory:
Until the community listing is available, install Auto Expander with BRAT:
https://github.com/jeansordes/auto-expander.auto-expander-config.md in the root of your vault.A minimal configuration looks like this:
[
{
// Expands immediately after typing "btw".
"trigger": "btw${0:instant}",
"replacement": "By the way$0"
},
{
// Expands when Space is pressed after "addr".
"trigger": "addr${0:space}",
"replacement": [
"123 Example Street",
"Paris, France$0"
]
}
]
The configuration can be a .md or .json file. In a Markdown file, place the array in a json code block. JSONC comments and trailing commas are supported.
Each snippet accepts the following fields:
| Field | Required | Description |
|---|---|---|
trigger |
Yes | Literal text or a regular expression wrapped in /.../. Add a cursor marker to select the activation method. |
replacement |
No | A string or array of lines to insert. Use $0 for the final cursor position. |
commands |
No | An Obsidian command ID or array of command IDs to run after replacement. |
Add one or more activation methods to the trigger's cursor marker:
${0:instant} — expand as soon as the trigger is typed.${0:space} — expand when Space is pressed.${0:tab} — expand when Tab is pressed.${0:newline} or ${0:enter} — expand when Enter is pressed.${0:backspace} — expand when Backspace is pressed.Multiple methods can be combined, for example ${0:space,tab}. A literal trigger without a cursor marker expands instantly.
Wrap a trigger in forward slashes to treat it as a regular expression:
[
{
"trigger": "/Hello, (.+)${0:newline}/",
"replacement": "Welcome, $1!$0"
}
]
Regular expressions run locally against the editor content. Avoid patterns with catastrophic backtracking; Auto Expander stops long-running matching attempts and shows a notice.
Use command IDs from Obsidian or another installed plugin:
[
{
"trigger": "/today${0:instant}",
"replacement": "<% tp.date.now(\"YYYY-MM-DD\") %>$0",
"commands": "templater-obsidian:replace-in-file-templater"
}
]
The Command delay setting controls the delay between multiple commands.
Auto Expander works entirely inside your vault. It does not make network requests, collect telemetry, or access files outside the vault.
Requirements: Node.js 18 or later and npm.
npm install
npm run ci
Use npm run dev for a watch build. Production releases are built with npm run build and include main.js, manifest.json, and styles.css as individual GitHub release assets.