How to save user made zsh shell functions and aliases

aliasshellzsh

Shell beginner here! I'd like to create aliases and functions in zsh shell to speed up my workflow. For example:

tw() { open -a //Applications/Textwrangler.app "$*"; }

The function itself works, but the problem is that the function definition disappears once I exit the shell. What's the procedure for saving user defined functions and aliases for future use? The zsh documentation isn't particularly helpful… or maybe I'm just being stupid!

Best Answer

What's the procedure for saving user defined functions and aliases for future use?

You probably want to save your customisations in ~/.zshrc.

~/.zshrc is always executed when zsh starts (both interactive logins and non-interactive logins).


Further reading

  • zsh - Installation and Configation, links to example configuration files.
Related Question