shellcheck / shellcheck (push) Failing after 17s
An interrupted plugin update can leave a plugin's files out of step with its checkout, and lazy.nvim then refuses to update it, every time. Before syncing, update now stashes such changes, so they can still be recovered with git stash pop, and puts the plugin's submodules back. Flathub retired org.mozilla.Thunderbird in favor of org.mozilla.thunderbird_esr, so update tried to reinstall the old ID on every run. Install the new one. flatpak update already moves existing installs over; a migration carries a skip-packages entry for the old ID over to the new one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
30 lines
1.0 KiB
Bash
Executable File
30 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Only the plugins are updated; the kickstart.nvim config itself is the user's to edit.
|
|
LAZY_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/nvim/lazy"
|
|
|
|
is_installed() {
|
|
command -v nvim &>/dev/null && [ -d "$LAZY_DIR/lazy.nvim" ]
|
|
}
|
|
|
|
# lazy.nvim won't update a plugin whose tracked files differ from its checkout
|
|
# (it checks with `git ls-files -d -m`), which an interrupted update can leave
|
|
# behind. Stash those changes, so the plugin updates and they can still be
|
|
# recovered with `git stash pop` in its folder, and put its submodules back.
|
|
restore_plugins() {
|
|
local dir
|
|
for dir in "$LAZY_DIR"/*/; do
|
|
[ -d "$dir/.git" ] || continue
|
|
[ -n "$(git -C "$dir" ls-files -d -m 2> /dev/null)" ] || continue
|
|
echo " $(basename "$dir") had local changes; stashing them so it can update."
|
|
git -C "$dir" stash push -q -m "Stashed by CoreDesktop's update" \
|
|
&& git -C "$dir" submodule update -q --init --recursive --force
|
|
done
|
|
}
|
|
|
|
run_update() {
|
|
echo "Updating Neovim plugins..."
|
|
restore_plugins
|
|
nvim --headless "+Lazy! sync" +qa
|
|
}
|