Install Vim plugins by direct git clone instead of interactive :PluginInstall
Vundle's :PluginInstall hangs when stdout is not a TTY (e.g. automated runs on Alpine). Clone each plugin declared in .vimrc directly instead - unattended, idempotent, and skips the Vundle self-reference.
This commit is contained in:
36
install.sh
36
install.sh
@@ -188,25 +188,43 @@ deploy_dotfiles() {
|
||||
# Vim plugins via Vundle
|
||||
# ----------------------------------------------------------------------------
|
||||
install_vim_plugins() {
|
||||
info "Installing Vim plugins (Vundle)"
|
||||
info "Installing Vim plugins"
|
||||
if [ ! -f "$HOME/.vimrc" ]; then
|
||||
warn "No .vimrc deployed; skipping Vim plugin install."
|
||||
return 0
|
||||
fi
|
||||
|
||||
VUNDLE_DIR="$HOME/.vim/bundle/Vundle.vim"
|
||||
if [ ! -d "$VUNDLE_DIR" ]; then
|
||||
info "Cloning Vundle"
|
||||
run git clone --depth=1 https://github.com/VundleVim/Vundle.vim.git "$VUNDLE_DIR"
|
||||
fi
|
||||
info "Running :PluginInstall (idempotent)"
|
||||
# Headless, tolerant of the 'dracula' colorscheme-not-found warning at startup.
|
||||
if [ "$DRY_RUN" -eq 1 ]; then
|
||||
printf ' $ vim +PluginInstall +qall\n'
|
||||
else
|
||||
vim +PluginInstall +qall >/dev/null 2>&1 || \
|
||||
warn "Vim PluginInstall exited non-zero; verify with: vim +PluginInstall +qall"
|
||||
ok "Vundle already present, skipping"
|
||||
fi
|
||||
ok "Vim plugins installed"
|
||||
|
||||
# Rather than drive Vundle's interactive :PluginInstall (which hangs when
|
||||
# stdout is not a TTY), clone each plugin declared in .vimrc directly.
|
||||
# This is fully unattended and idempotent.
|
||||
info "Cloning Vim plugins declared in .vimrc"
|
||||
# Extract 'Plugin/Repo' and 'Plugin user/repo' style declarations,
|
||||
# normalise to an https URL, skip the Vundle self-reference.
|
||||
plugins=$(grep -oE "Plugin '[^']+'" "$HOME/.vimrc" \
|
||||
| sed -E "s/Plugin '//; s/'//" \
|
||||
| grep -v "^VundleVim/Vundle.vim$")
|
||||
for repo in $plugins; do
|
||||
name=$(basename "$repo")
|
||||
dir="$HOME/.vim/bundle/$name"
|
||||
if [ -d "$dir" ]; then
|
||||
ok "$name already present, skipping"
|
||||
continue
|
||||
fi
|
||||
info "Cloning $repo"
|
||||
if run git clone --depth=1 "https://github.com/$repo.git" "$dir"; then
|
||||
ok "$name installed"
|
||||
else
|
||||
warn "Failed to clone $repo (non-fatal)."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user