Bash Plugin
The Bash plugin provides in-prompt text expansion through Bash's readline interface.
Installation
Add to your ~/.bashrc:
source /path/to/shell/cli-expander.bash
Usage
The primary workflow is :trigger[Space]. Type a trigger and press Space to expand.
$ :hello[Space]
$ Hello World!
This opens form TUI for matches that have forms, then inserts the generated result directly into the prompt — ready for editing or execution.
Manual Expansion
Press Ctrl+T to manually expand the current prompt buffer without Space.
FZF Trigger Search
Press Ctrl+F or Alt+F to open a fuzzy search dialog over your entire trigger library:
$ [Ctrl+F]
> findx
:findx Interactive form with 4 fields forms-advanced
:findname Find by name with manual inputs forms-linux
:findrm Find and delete with confirmation forms-linux
:findexec Find and exec on results forms-linux
Selecting a trigger inserts it into the prompt and expands it automatically. The preview panel on the right shows full trigger details using ce details.
The fzf picker features:
| Feature | Behavior |
|---|---|
| Search | Fuzzy match across trigger name, description, and category |
| Preview | Right panel shows ce details output for the selected trigger |
Ctrl+T | Toggle preview window between right, bottom, and hidden |
Enter | Select trigger and expand inline |
Esc | Cancel, leaving prompt unchanged |
The picker runs ce list --csv piped through fzf with --preview='ce details {1}'. This requires the fzf binary to be installed.
How It Works
The plugin captures keybindings via bind -x:
| Binding | Function | Description |
|---|---|---|
Space | _cli_expander_on_space | Intercepts space after a trigger and expands inline |
Ctrl+T | _cli_expander_expand | Manually expand current prompt buffer |
Ctrl+F | _cli_expander_fzf_search | Open fzf fuzzy search over all triggers |
Alt+F | _cli_expander_fzf_search | Fallback fzf search (same as Ctrl+F) |
For :trigger[Space]:
- The prompt buffer is sent to
ce expand - If the trigger is a form, the TUI opens for user input
- The generated text replaces
READLINE_LINE - The result is editable before execution
For Ctrl+F:
- Runs
ce list --csvand pipes it intofzf - Displays triggers with fuzzy search and preview pane
- On selection, extracts the trigger name and expands it via
_cli_expander_expand - On cancel, the prompt is unchanged
Important
Avoid using :trigger[Enter] for command builders. Enter executes the typed trigger as a shell command. Use :trigger[Space] so the expansion lands in the editable command line first.
Changing the Keybinding
Edit shell/cli-expander.bash and change the bind line:
# Change to Ctrl+E instead of Ctrl+T
bind -x '"\C-e": _cli_expander_expand'
For fzf, the binding is:
# Change to Ctrl+G instead of Ctrl+F
bind -x '"\C-g": _cli_expander_fzf_search'
What's Next
Set up the Fish Plugin if you use that shell.