Skip to main content

Installation

Prerequisites

  • Rust toolchain (1.70 or later)
  • Linux (tested on Ubuntu, Fedora, Arch)
  • Terminal emulator (Kitty, Alacritty, GNOME Terminal, xterm)

Install Rust

If you don't have Rust installed:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Build from Source

git clone https://github.com/donnyaw/cli-expander.git
cd cli-expander
cargo build --release

The binary will be at target/release/te.

tip

Use cargo build --release for an optimized binary. Debug builds work but are slower.

Install the Binary

# User-local install (no sudo needed)
cp target/release/te ~/.local/bin/

# Or system-wide
sudo cp target/release/te /usr/local/bin/

Make sure the install location is in your PATH:

export PATH="$PATH:$HOME/.local/bin"
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc

Post-Installation Setup

1. Create Config Directory

mkdir -p ~/.config/texpand/matches

2. Add Your First Match File

cat > ~/.config/texpand/matches/base.yml << 'EOF'
matches:
- trigger: ":hello"
replace: "Hello World!"
- trigger: ":now"
replace: "{{time}}"
vars:
- name: time
type: date
params:
format: "%H:%M"
EOF

3. Verify Installation

te :hello
# Output: Hello World!

te :now
# Output: 14:30

Optional: System-Wide Mode

For system-wide keyboard detection and injection (works in any app, not just terminal), add your user to the required groups:

sudo usermod -aG input $USER
sudo usermod -aG uinput $USER

Then log out and back in for group changes to take effect.

Shell Integration

Source the appropriate plugin for your shell:

The primary shell workflow is :trigger[Space]. Type a trigger and press Space to expand.

# Bash
echo 'source /path/to/shell/texpand.bash' >> ~/.bashrc

# Zsh
echo 'source /path/to/shell/texpand.zsh' >> ~/.zshrc

# Fish
echo 'source /path/to/shell/texpand.fish' >> ~/.config/fish/config.fish

Uninstall

rm ~/.local/bin/te
rm -rf ~/.config/texpand

Remove any source lines you added to your shell config files.

What's Next

Now that cli-expander is installed, read about Triggers and Matches to understand how expansion works.