DEV Community

Cover image for Moving to native vim plugin management
Sabrina
Sabrina

Posted on • Updated on

Moving to native vim plugin management

I want to start with a disclaimer:
Using a plugin manager is 100% easier, I chose to change my workflow this way because I had certain learnings I wanted to get out of it:

  • More minimal configuration/less reliance on plugins in general (by introducing friction for installing plugins, it will make me reconsider if I really need to install it.)
  • Better vim runtime knowledge by removing the magic that my plugin manager was doing behind the scenes.
  • Better git knowledge (I had never used submodules before!)

If you are looking for a good vim plugin manager that isn’t trying to do too much for you, I highly recommend vim-plug which has never let me down in the almost 2 years of using it. (If anything, this article is about me letting it down.😞

With that out of the way let’s talk about the process!

How I went about moving over my plugins were to follow these steps:

  • Remove the Plug command from my .vimrc and uninstall with :PlugClean command
  • Essentially apply the knowledge from this gist to my own setup.
  • I already have version controlled my dotfiles with a bare github repo so I skipped right to Installing plugins by running

dotfiles submodule init

to first initialize my dotfiles repo to use submodules, and then for each of the plugins I wanted to install:

dotfiles submodule add https://github.com/some-username/some-plugin.git pack/plugins/start/some-plugin

Other than that, the instructions in the gist apply. To help maintain this long term, I plan on aliasing some of the commands for updating and removing plugins. I’ve already aliased the updating command:
alias update_plugins=‘dotfiles submodule foreach git pull origin master’

When it came to migrating over these changes to my other laptop after the changes had been pushed up things went smoothly! I pulled the repo and then needed to initialize submodules for that repo:
dotfiles submodule update --init --recursive

I like this new setup so far (keep in mind I haven’t had to delete a plugin yet) and other than the initial migration process taking a while it’s been a seamless adjustment and I enjoy the granularity of cloning some plugins for one computer into .vim/pack/plugins/start/ that I don’t want to actually commit to my dotfiles repo without explicitly having to gitignore it.

What I’d like to do next with this set up is play around with the optional loading of plugins! That’s the biggest thing I’m missing from using a manager right now. All in all this was a lengthy but worth it process in terms of getting the learning I wanted to out of it.

The gists I referenced to do this are embedded below, they’re a great resource and I highly recommend them:

Thank you to Manas Thakur for these resources!

Top comments (0)