From d8d996a05c3a869b5f1f734f39e9d4e065adcdcd Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Mon, 20 Jul 2026 09:09:31 -0300 Subject: [PATCH] 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. --- install.sh | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/install.sh b/install.sh index 1c923eb..670716c 100644 --- a/install.sh +++ b/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 } # ----------------------------------------------------------------------------