Global Alias in Zshrc File
I Am Using the Command Line in a Macbookpro Terminal, with Zsh as the Default Profile. I Am Trying to Write a Global Alias to the Zshrc in My Home Directory...
I am using the command line in a MacBookPro terminal, with zsh as the default profile.
I am trying to write a global alias to the zshrc in my home directory file but encounter a strange error.
If I write the alias text using NANO the file saves the new alias, however if I write the following in the command line, the zshrc file does not updates to include the new alias.
MWE:
alias -g c="clear"
source ~/.zshrc
Any ideas on how to discover the problem?
1 Answer
Global aliases in Zsh are so aggressive that you’re replacing even the c in ~/.zshrc. Your
source ~/.zshrc
is interpreted as
source ~/.zshrclear
You probably want a simple alias instead of a global alias. Try this instead:
alias c='clear'