mirror of
https://github.com/keanuplayz/dotfiles.git
synced 2024-08-15 02:33:12 +00:00
[zsh] add function for checking out latest versions of plugins
This commit is contained in:
parent
0d521c169b
commit
1c43cdcf51
2 changed files with 32 additions and 4 deletions
|
@ -13,7 +13,9 @@ _plugin() {
|
||||||
_perf_timer_stop "plugin $1"
|
_perf_timer_stop "plugin $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
_plugin completions 'zsh-users/zsh-completions'
|
_checkout_latest_version='build=plugin-cfg-git-checkout-version "*"'
|
||||||
|
|
||||||
|
_plugin completions 'zsh-users/zsh-completions' "$_checkout_latest_version"
|
||||||
|
|
||||||
# compinit {{{
|
# compinit {{{
|
||||||
# note that completion system must be initialized after zsh-completions and
|
# note that completion system must be initialized after zsh-completions and
|
||||||
|
@ -60,14 +62,19 @@ _plugin completions 'zsh-users/zsh-completions'
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
_plugin fzf 'junegunn/fzf' build='./install --bin' \
|
_plugin fzf 'junegunn/fzf' "$_checkout_latest_version" \
|
||||||
|
build='./install --bin' \
|
||||||
after_load='plugin-cfg-path path prepend bin' \
|
after_load='plugin-cfg-path path prepend bin' \
|
||||||
after_load='plugin-cfg-path manpath prepend man'
|
after_load='plugin-cfg-path manpath prepend man'
|
||||||
|
|
||||||
_plugin alias-tips 'djui/alias-tips'
|
if command_exists python; then
|
||||||
|
_plugin alias-tips 'djui/alias-tips'
|
||||||
|
fi
|
||||||
|
|
||||||
FAST_WORK_DIR="$ZSH_CACHE_DIR"
|
FAST_WORK_DIR="$ZSH_CACHE_DIR"
|
||||||
if [[ "$TERM" != "linux" ]]; then
|
if [[ "$TERM" != "linux" ]]; then
|
||||||
_plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting'
|
_plugin fast-syntax-highlighting 'zdharma/fast-syntax-highlighting' "$_checkout_latest_version"
|
||||||
set-my-syntax-theme() { fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@"; }
|
set-my-syntax-theme() { fast-theme "$ZSH_DOTFILES/my-syntax-theme.ini" "$@"; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset _checkout_latest_version
|
||||||
|
|
21
zsh/zplg.zsh
21
zsh/zplg.zsh
|
@ -395,6 +395,27 @@ plugin() {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugin-cfg-git-checkout-version() {
|
||||||
|
if (( $# < 1 )); then
|
||||||
|
_zplg_error "usage: $0 <pattern>"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local pattern="$1" tag no_tags=1
|
||||||
|
|
||||||
|
command git tag --sort=-version:refname | while IFS= read -r tag; do
|
||||||
|
no_tags=0
|
||||||
|
if [[ "$tag" == ${~pattern} ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if (( ! no_tags )); then
|
||||||
|
_zplg_log "the latest version is $tag"
|
||||||
|
command git checkout --quiet "$tag"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# Exits with success code 0 if the plugin is loaded, otherwise exits with error
|
# Exits with success code 0 if the plugin is loaded, otherwise exits with error
|
||||||
|
|
Loading…
Reference in a new issue