Skip to main content

Zsh Plugin

The Zsh plugin hooks into ZLE (Zsh Line Editor) to provide in-prompt text expansion.

Installation

Add to your ~/.zshrc:

source /path/to/shell/texpand.zsh

How It Works

The plugin overrides the self-insert ZLE widget to track typed characters. When you press the expand keybinding, it passes the current buffer to texpand expand.

Usage

Type a trigger in your shell prompt and press Ctrl+T:

$ Say :hello to everyone
^ press Ctrl+T
$ Say Hello World! to everyone

Automatic Expansion

The plugin automatically checks for triggers as you type. Type a trigger like :hello followed by a space, and the plugin attempts expansion automatically.

Changing the Keybinding

Edit shell/texpand.zsh and change the bindkey line:

# Change to Ctrl+E instead of Ctrl+T
zle -N _texpand_manual_expand
bindkey '^E' _texpand_manual_expand

Compatibility

The plugin is designed to be compatible with:

  • zsh-autosuggestions
  • zsh-syntax-highlighting
  • Powerlevel10k prompt

Load texpand after other plugins for best compatibility.

What's Next

Set up the Bash Plugin or Fish Plugin if you use those shells.