Skip to content

Instantly share code, notes, and snippets.

@orschiro orschiro/.zshrc
Created Jan 22, 2015

What would you like to do?
# .zshrc
# Access custom aliases in the shell
[ -e "${HOME}/.zsh_aliases" ] && source "${HOME}/.zsh_aliases"
# Fix command not found after installation
zstyle ':completion:*' rehash true
# Update shell aliases immediately
reload_aliases () {
# do nothing if there is no $ALIAS_FILE
[[ -e $ALIAS_FILE ]] || return 1
# check if $ALIAS_FILE has been modified since last reload
if [[ $LAST_ALIAS_RELOAD < $(stat -c %Y $ALIAS_FILE) ]]; then
# remove all aliases; optional!
# only do this if all of your aliases are defined in $ALIAS_FILE
# also affects aliases defined on the command line
unalias -m '*'
# load aliases
source $ALIAS_FILE
# update date of last reload
# make reload_aliases to be run before each prompt
autoload -Uz add-zsh-hook
add-zsh-hook precmd reload_aliases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.