In bash, aliases can only be placed at the beginning of of a command, but zsh supports aliases anywhere. If you place the following line in your $ZDOTDIR/.zshrc
alias -g G=' | grep -i'
You can then run
cat haystack.txt G "needle"
Suffix aliases allow you to tell zsh to open files with specify a program to open files with certain extensions. Examples:
alias -s c="emacs"
alias -s php="vim"
alias -s java="$EDITOR"
Now in your shell, if you have a php file, file.php
, and you run the command
file.php
It will automatically open file.php
in vim.