Tmux Implementation
cli-expander supports tmux-native delivery for expanding triggers into any tmux pane, with a built-in fzf popup picker for trigger discovery.
Capabilities
| Feature | Command / Binding | Description |
|---|---|---|
| Inject into pane | ce expand <trigger> --output tmux | Injects expansion into the current tmux pane |
| Target specific pane | ce expand <trigger> --output tmux --target-pane <id> | Injects into a specific pane (e.g. %1, $TMUX_PANE) |
| Auto-detect tmux | ce expand <trigger> --output auto | Uses tmux inside tmux; stdout outside |
| Clipboard copy | ce expand <trigger> --output clipboard | Copies expansion to system clipboard |
| Inject + Enter | ce expand <trigger> --output tmux --enter | Injects and sends Enter |
| Prompt trigger | prefix + e | Opens a tmux prompt to type a trigger name |
| FZF popup picker | prefix + Ctrl+g | Opens an fzf popup over all triggers, injects on selection |
FZF Popup Picker
The popup picker (prefix+Ctrl+g) runs integrations/tmux/ce-tmux-picker.sh which:
- Reads the trigger database via
ce list --json - Converts JSON to tab-separated rows using
python3(handles commas in descriptions) - Opens
fzfin a tmux popup with preview pane - On selection, expands the trigger into the original pane via
ce expand --output tmux --target-pane - Form triggers render inside the popup; completed output is injected into the original pane
Setup
# Build and install
cargo build --release
cp target/release/ce ~/.local/bin/ce
cp integrations/tmux/ce-tmux-picker.sh ~/.local/bin/ce-tmux-picker.sh
# Add to ~/.tmux.conf
run-shell /path/to/cli-expander/integrations/tmux/cli-expander.tmux
# Reload tmux
tmux source-file ~/.tmux.conf
Picker Options
The fzf picker uses tab-delimited data for reliable parsing:
--delimiter=$'\t' --with-nth=1,2
--preview='ce details {1} 2>/dev/null'
--preview-window=right:60%:wrap
--header='Enter: inject into selected pane | Esc: cancel'
Safety and Limits
- Tmux output inserts text only by default; it does not press Enter unless
--enteris set - Multiline tmux injection is rejected until paste-buffer support is implemented
- The
$|$cursor marker is stripped in tmux mode (cursor positioning is shell-plugin-only) - Full-screen terminal apps must have their input area focused for injection to work
- Shell plugin mode remains best for prompt-local expansion; tmux mode is best for cross-pane workflows and popup trigger selection
CLI Reference
# Inject into current pane
ce expand ":hello" --output tmux
# Inject into a specific pane
ce expand ":findx" --output tmux --target-pane %1
# Inject with enter
ce expand ":hello" --output tmux --enter
# Auto-detect: tmux if inside tmux, stdout otherwise
ce expand ":hello" --output auto
# Copy to clipboard
ce expand ":hello" --output clipboard