The Computer Oracle

How to expand aliases inline in zsh?

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops

--

Chapters
00:00 How To Expand Aliases Inline In Zsh?
00:35 Accepted Answer Score 38
01:02 Thank you

--

Full question
https://superuser.com/questions/1514569/...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#macos #zsh

#avk47



ACCEPTED ANSWER

Score 38


Just press C-x a, not C-x-a (C-x is a prefix). It will call _expand_alias function to expand the alias.

Moreover, you can add this line to your zshrc then you can expand alias just with TAB:

zstyle ':completion:*' completer _expand_alias _complete _ignored

A full example zshrc:

autoload -Uz compinit; compinit;
bindkey "^Xa" _expand_alias
zstyle ':completion:*' completer _expand_alias _complete _ignored
zstyle ':completion:*' regular true