De acordo com o guia do usuário do zsh , os aliases devem ser definidos em ~/.zshrc
:
You may be able to think of some aliases you want to define in your startup files; .zshrc is probably the right place.
Ele também tem uma dica para manter seu ~/.zshrc
clean:
I only tend to use aliases in interactive shells, so I define them from .zshrc, but you may want to use .zshenv if you use aliases more widely. In fact, to keep my .zshrc neat I save all the aliases in a separate file called .aliasrc and in .zshrc I have:
if [[ -r ~/.aliasrc ]]; then . ~/.aliasrc fi
which checks if there is a readable file ~/.aliasrc, and if there is, it runs it in exactly the same way the normal startup files are run.
Então, você pode criar um arquivo chamado ~/.aliasrc
e originá-lo ( .
means source
) do seu ~/.zshrc
.
A mesma fonte sugere que as variáveis ambientais devem estar em ~/.zshenv
:
The easiest place to put these is in .zshenv --- hence it's name. Environment variables will be passed to any programmes run from a shell, so it may be enough to define them in .zlogin or .zprofile: however, any shell started for you non-interactively won't run those, and there are other possible problems if you use a windowing system which is started by a shell other than zsh or which doesn't run a shell start-up file at all --- I had to tweak mine to make it do so. So .zshenv is the safest place; it doesn't take long to define environment variables. Other people will no doubt give you completely contradictory views, but that's people for you.