How to expand aliases inline in zsh?

Similar to how to expand aliases inline in bash?

I'm using zsh 5.7.1 (x86_64-apple-darwin19.0) and Terminal 2.10 (433).

CTRL - ALT - E works for bash, what's the equivalent for zsh?

(If Use Option as Meta key is disabled in Terminal use ESC - CTRL - E)

CTRL - X - A is suggested but I can't make it work.


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