Is it possible to include file in config file of zsh? How?

This is, how I do it in my .zshrc:

if [ -f ~/.zsh/zshalias ]; then
    source ~/.zsh/zshalias
else
    print "404: ~/.zsh/zshalias not found."
fi

.zshrc and .bashrc are script files, not config files, so you "source" the alias file. In Zsh (.zshrc) and Bash (.bashrc) alike:

. my_alias

will run my_alias and leave its effects in the same environment with the RC files, effectively giving you the aliases in the shell. Of course, your are not limited to aliases either. I use a .shrc that is sourced by both .bashrc and .zshrc for common exports, functions and aliases.

For more on sourcing see Different ways to execute a shell script.


To source a file if it exists in one line:

[ -f .aliases ] && source .aliases