diff --git a/zsh.d/50-functions.zsh b/zsh.d/50-functions.zsh index e9d123a..e8ed3e6 100644 --- a/zsh.d/50-functions.zsh +++ b/zsh.d/50-functions.zsh @@ -1,6 +1,14 @@ ####################################################################################### # Functions # +# +# +# +# Load usefule modules + +zmodload -F zsh/stat b:zstat +zmodload zsh/datetime +# # Autoload all functions in zshfunctions # autoload -U $LIBRARY/zshfunctions/*(.:t) diff --git a/zsh.d/zshfunctions/awsprofile.zwc b/zsh.d/zshfunctions/awsprofile.zwc deleted file mode 100644 index f71fd1b..0000000 Binary files a/zsh.d/zshfunctions/awsprofile.zwc and /dev/null differ diff --git a/zsh.d/zshfunctions/bak.zwc b/zsh.d/zshfunctions/bak.zwc deleted file mode 100644 index 6552234..0000000 Binary files a/zsh.d/zshfunctions/bak.zwc and /dev/null differ diff --git a/zsh.d/zshfunctions/cdb.zwc b/zsh.d/zshfunctions/cdb.zwc deleted file mode 100644 index ba28fbe..0000000 Binary files a/zsh.d/zshfunctions/cdb.zwc and /dev/null differ diff --git a/zsh.d/zshfunctions/gitfetch b/zsh.d/zshfunctions/gitfetch new file mode 100644 index 0000000..b11bcf7 --- /dev/null +++ b/zsh.d/zshfunctions/gitfetch @@ -0,0 +1,16 @@ +zmodload -F zsh/stat b:zstat +zmodload zsh/datetime +local _gitdir +local last_fetch +local diff + +cd $1 + +_gitdir=$(git rev-parse --git-dir 2> /dev/null) || return 0 +last_fetch=$(zstat +mtime $_gitdir/FETCH_HEAD 2> /dev/null || echo 0) +let "diff = $(strftime %s)- $last_fetch" +[ $diff -gt ${GIT_FETCH_INTERVAL:-30} ] && git fetch --all -p + +return 0 + +# vim: set ts=2 sw=2 tw=0 ft=sh : diff --git a/zsh.d/zshfunctions/status b/zsh.d/zshfunctions/status index 0c780bf..bb16c31 100644 --- a/zsh.d/zshfunctions/status +++ b/zsh.d/zshfunctions/status @@ -16,9 +16,9 @@ echo if [ $HOMEBREW_PREFIX ]; then print -P "$FX[bold]Homebrew enabled: $FG[002]yes$FX[reset]" - print -P "H$FX[bold]omebrew prefix: $FG[002]$HOMEBREW_PREFIX$FX[reset]" + print -P "$FX[bold]Homebrew prefix: $FG[002]$HOMEBREW_PREFIX$FX[reset]" else - print -P "H$FX[bold]omebrew enabled: $FG[001]no$FX[reset]" + print -P "$FX[bold]Homebrew enabled: $FG[001]no$FX[reset]" fi print -nP "\n$FX[bold]iTerm2 integration: " diff --git a/zsh.d/zshfunctions/status.zwc b/zsh.d/zshfunctions/status.zwc deleted file mode 100644 index 0d2d4b1..0000000 Binary files a/zsh.d/zshfunctions/status.zwc and /dev/null differ diff --git a/zsh.d/zshfunctions/x509.zwc b/zsh.d/zshfunctions/x509.zwc deleted file mode 100644 index 138d48c..0000000 Binary files a/zsh.d/zshfunctions/x509.zwc and /dev/null differ