Skip to content

zsh-abbr GitHub release (latest by date) GitHub commits since latest release

splash card: the text '% abbr' as green neon lettering

zsh-abbr is the zsh manager for auto-expanding abbreviations - text that when written in a terminal is replaced with other (typically longer) text. Inspired by fish shell.

TIP

Do you use zsh-abbr and zsh-autosuggestions? Check out zsh-autosuggestions-abbreviations-strategy. It teaches zsh-autosuggestions to suggest your zsh-abbr abbreviations.

For example, abbreviate git checkout as co (or even c or anything else). Type coSpace and the co turns into git checkout. Abbreviate git checkout main as cm. Type cmEnter and the cm turns into and runs git checkout main. Don't want an abbreviation to expand? Use CtrlSpace instead of Space, and ;Enter instead of Enter.

Why? Like aliases, abbreviations save keystrokes. Unlike aliases, abbreviations can leave you with a transparently understandable command history ready for using on a different computer or sharing with a colleague. And where aliases can let you forget the full command, abbreviations may help you learn the full command even as you type the shortened version.

Like zsh's alias, zsh-abbr supports "regular" (i.e. command-position) and "global" (anywhere on the line) abbreviations. zsh-abbr also supports interactive creation of persistent abbreviations which are immediately available in all terminal sessions. Abbreviations automatically sync to a file, ready for your dotfile management.

Run abbr help for documentation; if the package is installed with Homebrew, man abbr is also available.

Except where otherwise noted, © 2024 by Henry Bley-Vroman and licensed under zsh-abbr's license.