Skip to main content

Nested Matches

A nested match lets you include the output of one trigger inside another. This creates composable, reusable expansion components.

Basic Usage

Define a reusable match, then reference it using type: match:

matches:
# The reusable base component
- trigger: ":signature"
replace: |
Best regards,
John Doe

# The match that includes it
- trigger: ":email"
replace: |
Dear {{recipient}},

{{sig}}

--
{{signature}}
vars:
- name: recipient
type: form
params:
layout: "Recipient: [[name]]"
fields:
name:
placeholder: "Name"
- name: sig
type: match
params:
trigger: ":signature"

Typing :email prompts for a recipient name, then expands to a full email with the shared signature.

Practical Examples

Dynamic Greeting Templates

- trigger: ":greet-morning"
replace: "Good morning, {{name}}!"

- trigger: ":greet-evening"
replace: "Good evening, {{name}}!"

- trigger: ":greet"
replace: "{{greeting}}"
vars:
- name: greeting
type: match
params:
trigger: ":greet-morning"

Version Info

- trigger: ":ver"
replace: "v{{major}}.{{minor}}"

- trigger: ":release"
replace: "Release {{ver}}"
vars:
- name: ver
type: match
params:
trigger: ":ver"

How It Works

Important Notes

  • The referenced match must exist in your loaded match files
  • Circular references (A includes B, B includes A) will fail
  • Nested matches are resolved before the parent match output is produced
  • You can chain nest multiple levels (match includes match that includes match)

What's Next