Published on 2024-06-16 by GCH

An IDEalization of Vim

You can turn Vim into a kind of operations-IDE by executing:

sudo apt install tig
curl -Ls vim.logical.li | bash

The result is quite satisfying for management of Infrastructure as Code files but also for development, depending on taste and scale. This process has been tested in Ubuntu LTS, from 18.04 to 24.04, and the only external dependencies are Vim plugins. Read on for details.

Wait, what?

There's a lot of excitement around Neovim, so much so that I came up with FOMO. It certainly offers limitless possibilities at the cost of some time invested on understanding the plugin ecosystem. Following a post from @DHH I took a lazy look at LAZYVIM, a project that automates Neovim configuration. It did look interesting, but there are turn-offs: it expects the user to have a C compiler installed, among several other external dependencies, and it requires a version of NeoVim not yet available in Ubuntu LTS versions earlier than 24.04.

Perhaps I need an even lazier Vim with some degree of LTS retrocompatibility.

I never liked to install everything but the kitchen sink in the same Linux computer where I perform sensitive security tasks - the larger the surface, the larger the probability of sucessful intrusions. I work from an Ubuntu laptop with a minimalist desktop profile in which I have different virtual machines with dedicated environments for different purposes. Those environments may or may not have a C compiler installed. Furthermore, I need to access a significant number of remote systems where editing versioned files is part of git-based operations workflows - the interface is usually VPN+SSH, so everything needs to be done from a terminal. Those remote systems rarely have a C compiler installed, as I most often interact with Python, Puppet and Bash. They run a mix of supported Ubuntu LTS versions and it wouldn't be simple to install a recent Neovim package in all of them.

Could we do something with good old ubiquous Vim using only distribution packages and Vim plugins?

By default, Vim behaves as an opinionated notepad where browsing through multiple files and directories is possible if one spends time memorizing very particular key combinations. But with some bits of customization we can make it look like this:

This solution takes less than a minute to configure and can be operated using the following user-friendly shortcuts:

It wouldn't be this easy, of course, without the incredible work done by open source projects nerdtree, tokyonight-vim, lightline.vim, vim-puppet, tig-explorer.vim, and vim-grepper, on top of Vim itself. I am also particularly happy with the tig integration this configuration provides – tig is an awesome git visualization utility included in the Ubuntu distribution.

So here's a recipe to IDEalize your Vim configuration:

sudo apt install tig
curl -Ls vim.logical.li | bash

Security related comment: needless to say you should double check what you're executing first. I'm using a domain redirect to make the solution easy to remember.

Note that this configuration respects your muscle memory, as you can exit vim with the usual :q / :wq key combinations. A gist with the vimrc file is available here.

Claiming that this turns vim into an IDE migh be a bit of an overstatement. But for my main use case – quick edition of multiple version-controlled files dispersed across different environments – it really feels IDEal.