Skip to main content

Quickstart

A 5-minute guide to using cli-expander.

Step 1: Create Match Files

Create a directory for your match files and add some triggers.

mkdir -p ~/.config/texpand/matches
cat > ~/.config/texpand/matches/base.yml << 'ENDCONF'
matches:
- trigger: ":hello"
replace: "Hello World!"
- trigger: ":thanks"
replace: "Thank you!"
ENDCONF

Step 2: Test Expansion

te :hello
# Output: Hello World!

te :thanks
# Output: Thank you!

Step 3: Add a Date Variable

cat >> ~/.config/texpand/matches/base.yml << 'ENDCONF'
- trigger: ":today"
replace: "Today's date: {{today}}"
vars:
- name: today
type: date
params:
format: "%B %d, %Y"
ENDCONF

te :today
# Output: Today's date: June 14, 2026

Step 4: Try a Form

Forms prompt you for input before expanding.

cat >> ~/.config/texpand/matches/base.yml << 'ENDCONF'
- trigger: ":greet"
form: |
Hello [[name]]!
form_fields:
name:
placeholder: "Your name"
ENDCONF

When you expand this trigger, a form dialog opens in your terminal. Fill in the fields and submit.

te :greet
# Opens interactive form
tip

Forms require a real terminal session. They won't work in piped contexts or headless environments.

Step 5: List Available Triggers

te list
# Output:
# Trigger Replace/Form Type
# :hello Hello World! text
# :thanks Thank you! text
# :today {{today}} text
# :greet form

Step 6: Add Shell Integration (Optional)

echo 'source /path/to/shell/texpand.bash' >> ~/.bashrc
# Restart your shell, then type :hello and press Space

What's Next