Suppose I have:
alias gg="git grep"
then stuff like:
gg "int x"
works, but
gg int x
gets complaints. Is there a way to rewrite gg as a function in zsh so that it takes all the arguments after gg, and stuffs them into a string?
Thanks!
To set up a simple alias, edit the ~/. zshrc file using your text editor and add an alias at the bottom. It is good to keep all your aliases in a single section of the file to avoid confusion and ease of edit. alias ginit="git init ."
Zsh is more interactive and customizable than Bash. Zsh has floating-point support that Bash does not possess. Hash data structures are supported in Zsh that are not present in Bash. The invocation features in Bash is better when comparing with Zsh.
The Korn shell( ksh ) searches FPATH for a file defining a shell function to load and execute in the current process. The Z shell ( zsh ) searches fpath for a file defining a shell function to load and execute in the current process.
gg() { git grep "$*"; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With