ZSH Expand alias

Wed, 07/29/2020 - 14:26 -- 5n00py

Its not a secret that terminals (zsh) has very useful thing  called aliases.

I really love it and now I have a lot of alises (thanks to plugins).

$ alias | wc -l
587


So to find useful aliases I use commands like this:

$ alias G checkout
gcb='git checkout -b'
gcd='git checkout develop'
gch='git checkout hotfix'
gcm='git checkout $(git_main_branch)'
gco='git checkout'
gcr='git checkout release'

$ alias "G"
G='| grep'

But sometimes i want to see the full command behind the alias. Its called expanding.

So when I typing "gco" and then Ctrl+X A, zsh changes my cmd to "git checkout". 
You can see the bindings  here:
$ bindkey G expand
"^G" list-expand
"^I" expand-or-complete
"^Xa" _expand_alias
"^Xe" _expand_word

English

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Image CAPTCHA
Enter the characters shown in the image.