Compare commits
2 Commits
16e6c27b0f
...
70f3600de3
Author | SHA1 | Date | |
---|---|---|---|
|
70f3600de3 | ||
|
969e0c42f7 |
@ -17,8 +17,8 @@ if [[ $lang ]]; then
|
||||
asdf plugin-update $lng
|
||||
fi
|
||||
|
||||
for version in $(asdf list-all $lng | sort -nrk1,1 | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[asdf:${lng}:install]'")
|
||||
do asdf install $lng $version
|
||||
for version in $(asdf list-all $lng | sort -nrk1,1 | eval "fzf ${FZF_DEFAULT_OPTS} -m --header='[asdf:${lng}:install]'"); do
|
||||
asdf install $lng $version
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
41
home/.zsh/plugins/autoupdate.zsh
Executable file
41
home/.zsh/plugins/autoupdate.zsh
Executable file
@ -0,0 +1,41 @@
|
||||
_zplug-check-interval() {
|
||||
now=$(date +%s)
|
||||
if [ -f "${1}" ]; then
|
||||
last_update=$(cat "${1}")
|
||||
else
|
||||
last_update=0
|
||||
fi
|
||||
interval=$(expr ${now} - ${last_update})
|
||||
echo "${interval}"
|
||||
}
|
||||
|
||||
_zplug-check-for-updates() {
|
||||
if [ -z "${ZPLUG_PLUGIN_UPDATE_DAYS}" ]; then
|
||||
ZPLUG_PLUGIN_UPDATE_DAYS=14
|
||||
fi
|
||||
|
||||
if [ -z "${ZPLUG_PLUGIN_UPDATE_FILE}" ]; then
|
||||
ZPLUG_PLUGIN_UPDATE_FILE="${ZPLUG_HOME:-}/.zplug_plugin_lastupdate"
|
||||
fi
|
||||
|
||||
local day_seconds=$(expr 24 \* 60 \* 60)
|
||||
local plugins_seconds=$(expr ${day_seconds} \* ${ZPLUG_PLUGIN_UPDATE_DAYS})
|
||||
|
||||
local last_plugin=$(_zplug-check-interval ${ZPLUG_PLUGIN_UPDATE_FILE})
|
||||
|
||||
if [ ${last_plugin} -gt ${plugins_seconds} ]; then
|
||||
echo "It has been $(expr ${last_plugin} / $day_seconds) days since your zplug plugins were updated"
|
||||
zplug update
|
||||
|
||||
date +%s >! ${ZPLUG_PLUGIN_UPDATE_FILE}
|
||||
zplug clean --force
|
||||
fi
|
||||
}
|
||||
|
||||
zmodload zsh/system
|
||||
lockfile=${ZPLUG_HOME:-~}/.zplug_autoupdate_lock
|
||||
touch $lockfile
|
||||
if ! which zsystem &> /dev/null || zsystem flock -t 1 $lockfile; then
|
||||
_zplug-check-for-updates
|
||||
command rm -f $lockfile
|
||||
fi
|
@ -37,8 +37,9 @@ zplug "plugins/asdf", from:oh-my-zsh
|
||||
zplug "zsh-users/zsh-completions"
|
||||
zplug "zsh-users/zsh-syntax-highlighting", defer:2
|
||||
|
||||
zplug "~/.zsh/cmd", from:local, use:'(*).sh', as:command, rename-to:'$1'
|
||||
zplug "~/.zsh/themes", from:local, use:cheetah.zsh-theme, as:theme
|
||||
zplug "~/.zsh/plugins", from:local
|
||||
zplug "~/.zsh/cmd", from:local, use:'(*).sh', as:command, rename-to:'$1'
|
||||
zplug "~/.zsh/themes", from:local, use:cheetah.zsh-theme, as:theme
|
||||
|
||||
if [[ $OSTYPE == *darwin* ]]; then
|
||||
zplug "plugins/osx", from:oh-my-zsh
|
||||
|
Loading…
Reference in New Issue
Block a user