Skip to content

Instantly share code, notes, and snippets.

@osa1
Created January 21, 2021 09:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osa1/23e5527e0f341141c3d494091ffa1759 to your computer and use it in GitHub Desktop.
Save osa1/23e5527e0f341141c3d494091ffa1759 to your computer and use it in GitHub Desktop.
chpwd() {
local new_dir=${$(pwd)#${HOME}/}
if [[ $new_dir == $HOME ]]; then
echo "Returning to home"
return
fi
local shell_file_path=$HOME/shells/$new_dir.zsh
if [[ -e $shell_file_path ]]; then
echo "Shell file found for $new_dir, creating new shell with $shell_file_path"
env zsh -c "source ${shell_file_path}; zsh -i"
else
echo "Shell file not found for $new_dir"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment