# # Main myzsh script # (runs at shell start) # # check for default shell cat /etc/passwd | grep ~ | grep "/bin/zsh" > /dev/null if [ $? -eq 1 ] && [ $(uname) != "Darwin" ]; then echo "[myzsh]: you should set me as your default shell." fi # check if there are canges to be pushed cd $ZSH if [[ -n $(git status --porcelain) ]]; then echo -n "[myzsh]: local myzsh repo is dirty. commit and push changes? [y/n]" read choice if [ $choice ]; then if [ "$choice" = "y" ]; then git add **/*[^lastrun] git commit -am "autopush by $(whoami)@$(hostname)" git push origin master fi fi fi cd - > /dev/null # force myzsh update (every 30 days) timestamp=$(date +%s) if [ -r $ZSH/lastrun ];then lastrun=$(cat $ZSH/lastrun) if [ $((lastrun+2592000)) -le $timestamp ]; then echo "[myzsh]: i have not been updated for at least 30 days." echo "[myzsh]: forcing update now." cd $ZSH git pull origin master cd - > /dev/null echo $timestamp > $ZSH/lastrun fi else echo $timestamp > $ZSH/lastrun fi # load core for config_file ($ZSH/core/*.zsh); do source $config_file done # load plugins for plugin ($plugins); do if [ -f $ZSH/plugins/$plugin.zsh ]; then source "$ZSH/plugins/$plugin.zsh" fi done # load theme if [ -f $ZSH/themes/$THEME.zsh ]; then source "$ZSH/themes/$THEME.zsh" fi # load completion autoload -U compinit compinit -i