Triggers and Matches
Triggers are the keywords you type that get expanded. Matches define what they expand to.
How Expansion Works
Match File Format
Match files are YAML files placed in ~/.config/texpand/matches/. They define your triggers and their replacements.
matches:
- trigger: ":hello"
replace: "Hello World!"
Simple Text Replacement
The most basic match replaces a trigger with static text:
- trigger: ":thanks"
replace: "Thank you for your help!"
Multiple Triggers
A match can have multiple triggers that all expand to the same thing:
- triggers: [":hello", ":hi", ":hey"]
replace: "Greetings!"
Multi-line Replacement
Use YAML's | operator for multi-line expansions:
- trigger: ":sig"
replace: |
Best regards,
John Doe
Engineering Team
Match Options
| Option | Type | Default | Description |
|---|---|---|---|
trigger | string | — | Single trigger keyword |
triggers | array | — | Multiple triggers for same match |
replace | string | — | Text to replace trigger with |
form | string | — | Form layout with [[field]] placeholders |
form_fields | object | — | Field configuration for forms |
vars | array | — | Variable definitions |
force_mode | string | — | Injection mode override |
propagate_case | bool | false | Match case of typed trigger |
word | bool | false | Word boundary required |
Word Boundary Detection
With word: true, the trigger only matches at word boundaries:
- trigger: "ls"
replace: "list"
word: true
ls /tmp→ matchescallsls→ does NOT match
Prefix Convention
Triggers typically start with a special character to avoid accidental expansion:
- trigger: ":hello" # colon prefix (recommended)
- trigger: "git!rel" # exclamation separator
- trigger: ";div" # semicolon prefix for code
tip
Using a consistent prefix like : prevents triggers from matching inside normal words.
What's Next
Learn about Match Files and Configuration for organizing your triggers.