improve self-update mechanism

now updating amix's vimrc and oh-my-zsh custom plugins
whole-command-tab-completion
bretello 2020-02-14 16:37:44 +01:00
parent b7378cfe46
commit 4d64de1fa4
2 changed files with 20 additions and 2 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/env zsh
#
# brethil, brutally copied form https://github.com/robbyrussell/oh-my-zsh/blob/master/tools/check_for_upgrade.sh
# brethil, brutally copied from https://github.com/robbyrussell/oh-my-zsh/blob/master/tools/check_for_upgrade.sh
# This also tries to update amix's vimrc and oh-my-zsh
# 14 July 2017
zmodload zsh/datetime
@ -14,7 +15,23 @@ function _update_dotfiles_update() {
}
function _upgrade_dotfiles() {
(cd $DOTFILES; git pull)
(cd $DOTFILES; git pull --rebase &>/dev/null && echo "Succesfully upgraded dotfiles" || echo "Could not upgrade dotfiles")
# amix's vimrc update
amix_vimrc=$HOME/.vim_runtime
if [[ -d $amix_vimrc ]]; then
# the update_plugins.py script makes the vim_runtime dir dirty, so we have to reset --hard
(cd $amix_vimrc && git reset --hard HEAD >/dev/null && git pull --rebase >/dev/null && echo "Upgraded amix's vimrc" || echo "Could not upgrade amix's vimrc" >&2)
(python $amix_vimrc/update_plugins.py >/dev/null || echo "upgraded amix's vimrc's plugins || "echo "Could not upgrade amix's vimrc's plugins" >&2)
else
echo "Could not upgrade amix's vimrc and plugins (missing .vim_runtime folder)" >&2
fi
# custom zsh plugins
custom_plugins=("alias-tips" "fast-syntax-highlighting" "zsh-autosuggestions")
for plugin in $custom_plugins; do
(cd $ZSH/custom/plugins/$plugin && git pull --rebase >/dev/null && echo "Upgraded oh-my-zsh plugin: $plugin" || echo "Could not upgrade oh-my-zsh plugin: $plugin" >&2)
done
# update the zsh file
_update_dotfiles_update
}

View File

@ -46,6 +46,7 @@ function install_zsh_plugins {
# Install fast-syntax-highlighting (git: zdharma), zsh-autosuggestions (git:zsh-users), alias-tips
ZSH_PLUGINS="$HOME/.oh-my-zsh/custom/plugins"
mkdir -p "$ZSH_PLUGINS"
# NOTE: if adding plugins here, be sure to also add them to the _dotfiles_upgrade function in check_for_upgrade.sh
git clone https://github.com/zdharma/fast-syntax-highlighting.git "${ZSH_PLUGINS}/fast-syntax-highlighting" || error=true
git clone https://github.com/zsh-users/zsh-autosuggestions "${ZSH_PLUGINS}/zsh-autosuggestions" || error=true
git clone https://github.com/djui/alias-tips.git "${ZSH_PLUGINS}/alias-tips" || error=true