Skip to content

Commit

Permalink
Add (neo)vim plugin update to upgrade script
Browse files Browse the repository at this point in the history
Known issue: `CocUpdate` does not seem to execute due to immediate `qall`
  • Loading branch information
matyama committed Mar 27, 2022
1 parent e5685da commit c85bd8a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .local/bin/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SKIP: Skip selected tool(s), overrides RUN.
binenv Skip binenv upgrade
sdk Skip sdk upgrade
omz Skip omz update
vim Skip (neo)vim updates (vim-plug, coc)
extras Skip all but apt upgrade
RUN: Run only selected tool(s), can be overridden by SKIP.
Expand All @@ -23,6 +24,7 @@ RUN: Run only selected tool(s), can be overridden by SKIP.
binenv Run only binenv upgrade
sdk Run only sdk upgrade
omz Run only omz update
vim Run only (neo)vim updates (vim-plug, coc)
"

usage() {
Expand All @@ -37,6 +39,7 @@ RUN_RUST=0
RUN_BINENV=0
RUN_SDK=0
RUN_OMZ=0
RUN_VIM=0

POSITIONAL_ARGS=()

Expand Down Expand Up @@ -70,12 +73,16 @@ while [[ $# -gt 0 ]]; do
omz)
RUN_OMZ=$((RUN_OMZ - 2))
;;
vim)
RUN_VIM=$((RUN_VIM - 2))
;;
extras)
RUN_PIPX=$((RUN_PIPX - 2))
RUN_RUST=$((RUN_RUST - 2))
RUN_BINENV=$((RUN_BINENV - 2))
RUN_SDK=$((RUN_SDK - 2))
RUN_OMZ=$((RUN_OMZ - 2))
RUN_VIM=$((RUN_VIM - 2))
;;
*)
echo "Unknown skip option value $2"
Expand Down Expand Up @@ -110,6 +117,7 @@ if [[ $# -eq 0 ]]; then
RUN_BINENV=$((RUN_BINENV + 1))
RUN_SDK=$((RUN_SDK + 1))
RUN_OMZ=$((RUN_OMZ + 1))
RUN_VIM=$((RUN_VIM + 1))
else
while [[ $# -gt 0 ]]; do
case $1 in
Expand Down Expand Up @@ -137,6 +145,10 @@ else
RUN_OMZ=$((RUN_OMZ + 1))
shift
;;
vim)
RUN_VIM=$((RUN_VIM + 1))
shift
;;
*)
shift
;;
Expand Down Expand Up @@ -247,3 +259,9 @@ if [[ -n $ZSH ]] && [[ $ZSH == *oh-my-zsh ]] && [[ $RUN_OMZ -gt 0 ]]; then
"$ZSH/tools/upgrade.sh"
fi

if [[ -n "$EDITOR" ]] && [[ "$EDITOR" == *vim ]] && [[ $RUN_VIM -gt 0 ]]; then
echo "Upgrading ${EDITOR} plugins..."
# FIXME: CocUpdate does not seem to run with +qall
"$EDITOR" --headless +PlugUpdate +CocUpdate +qall &> /dev/null
fi

0 comments on commit c85bd8a

Please sign in to comment.