Preview zsh-abbr abbreviation expansions as you type.
$ abbr g=git
Added the regular user abbreviation `g`
$ g| # "|" represents your cursor
→ git
Type an abbreviation and a preview of what it expands to will be displayed.
Source zsh-abbr-preview in your .zshrc (either before or after sourcing zsh-abbr):
source /path/to/zsh-abbr-preview/zsh-abbr-preview.plugin.zshOr use your plugin manager:
# zinit
zinit light olets/zsh-abbr
zinit light cohml/zsh-abbr-preview
# oh-my-zsh
plugins=(... zsh-abbr zsh-abbr-preview)Customize the preview prefix by setting this variable before sourcing the plugin:
ZSH_ABBR_PREVIEW_PREFIX="..." # default: "→ "zsh-abbr- Zsh 5.0+
zsh-abbr-preview hooks into zle-line-pre-redraw to check if your current input matches an abbreviation. It uses zsh-abbr's own expansion functions (_abbr_regular_expansion and _abbr_global_expansion) to ensure the preview logic stays in sync with actual abbreviation behavior.
The preview should respects all zsh-abbr configurations, including:
ABBR_REGULAR_ABBREVIATION_GLOB_PREFIXES- glob patterns for valid prefixes (e.g., "*;")ABBR_REGULAR_ABBREVIATION_SCALAR_PREFIXES- literal prefixes (e.g., "sudo")ABBR_SPLIT_FN- custom word splitting function
When an abbreviation is detected, its expansion is displayed below your prompt using zle -M. Multi-word abbreviations (e.g., git s → git status) are fully supported.
MIT