DEV Community

Mike Stemle
Mike Stemle Subscriber

Posted on

It's been a minute, but here's a gist to update your Vim dependencies.

Howdy! It's been a while since I posted anything, so I figured I'd come post something simple and fun.

We all know that updating our system dependencies and our software dependencies is super important for system security, but what about our editor dependencies? That module that you installed for VS Code or Vim or Emacs, what about if security or stability fixes are made?

VS Code solves this problem by having an auto-update capability, and there are several other editors and IDEs which do the same. Unfortunately, those of us who are into the classics (Vim and Emacs are still very widely used) have frequently been left to fend for ourselves.

I've been a Vim user for more than 25 years now (yes, I'm old; it happens), and I use a module manager called "Pathogen" for getting modules running in Vim. It's a pretty common package manager, and almost every module on VimAwesome.com supports it. It's pretty simple, and to install a module with Pathogen all you do is check it out from Git into the ~/.vim/bundles folder. It'll pull the primary branch, and from there once you start Vim the Pathogen package manager sets it up and gives you the functionality.

One of my favorite parts of this is that you can update modules with a simple git pull, but you have to run it in the working director for each of the modules. With a really simple bash script, that's easy to do.

#!/usr/bin/env bash
VIM_BUNDLE_PATH="$HOME/.vim/bundle"
cd "$VIM_BUNDLE_PATH"
for X in $(ls -1); do
cd "$X"
git reset --hard
git pull
cd -
done
echo "Vim bundle updates complete."

If you're like me, and you have a folder with a bunch of git repos checked out, you can also parameterize the directory that it uses as the base folder and update all of your Git repos in a single command. If you do this, though, make sure you remove the --reset flag as that will wipe out local changed to tracked files.

Anyway, I'm gonna get back to work now. Have a great day.

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay