The quickfix and location lists in Vim
This article considers the similarities and differences between the quickfix and location lists and provides examples for when each one is …
I started using Vim as my main editor around six months ago and I can say it has been a worthwhile experience because it has pushed me to think in a more efficient way when it comes to editing text.
This article explains my rationale for switching to Vim so, hopefully, it helps you make a decision on whether investing in learning Vim is justifiable for you too.
I have tried a number of text editors since I first learnt to code just over three years ago and I’ve had good experiences with each one for the most part.
I want to write a bit about those experiences so you can see where I’m coming from and understand how I came to using Vim eventually.
The first editor I used was Sublime Text 3. I chose it because it seemed to be really popular at the time amongst web developers and most tutorials recommended it as a beginner friendly option.
At this point, I was only just learning to code so I only made use of its most basic features, although I did learn how to install plugins for added functionality. Emmet was one of my favourites as it helped me write HTML faster and that was just awesome.
I used Sublime for well over a year and even completed the Front-End certificate on freeCodeCamp doing all my projects within it. To be honest, I didn’t have any real problems with Sublime save for the popup that shows up every now and then encouraging me to purchase the full version of the product.
To be sure, the free version is unrestricted in its feature set, but you just have to deal with that popup and it can be annoying sometimes. As I didn’t have 80 dollars to spend on a text editor, I began to look for alternatives.
Around this period, I decided to give Vim a go for the first time since it was always part of the conversation when you look at text editors for programmers and was favoured by many.
Vim was definitely more difficult to start with and although I was able to learn the basics, I just didn’t see why everything had to be so complicated.
I wasn’t productive at all so I gave up on Vim after messing with it for a while and decided to take a look at Atom instead which was closer to Sublime in terms of interface and workflow.
Switching from Sublime to Atom wasn’t difficult because Atom is largely inspired by Sublime so they had a lot in common which made it really easy for me to start using it.
All the plugins I used or an equivalent were available on Atom so I was pretty much good to go from the start. As a result, I was able to get my work done without much fuss.
However, being built on Electron, Atom was having a huge impact on my RAM and CPU. As I had only 4GB of RAM at the time, this was significant to me and necessitated an upgrade in that department which I effected by installing an additional 4GB on my computer.
With Atom, performance was not as good as Sublime from the start. I was not surprised by this since basically all other Electron apps I had tried had more or less the same issues. Startup time on my PC was slow, but once it loaded up, it wasn’t too bad.
Overtime, I became frustrated at the lack of improvement in this area despite receiving regular updates. So I sought a change all over again.
Around this time, Visual Studio Code was generating a lot of discussion in programming forums and had a lot of good press on various blogs. Since it was also built on Electron, I wasn’t expecting too much difference from Atom in terms of performance, but I gave it a whirl anyway.
I wasn’t too impressed at first; it didn’t seem to offer anything that I wasn’t already getting from Atom and performance wasn’t significantly better. So I uninstalled it and stuck with Atom.
However, with each monthly release, there would be some hype, and I would download it again and try it out. It always seemed to get better while Atom, in contrast, was stuck in a rot especially on the performance side.
Eventually, VS Code became clearly superior in feature-set and performance so I switched to it full-time. At this point, I deleted Atom from my Computer and VS Code reigned supreme.
Switching to VS Code from Atom was not as seamless as the switch from Sublime to Atom. This was partly because the interface was a little different and it took me some time to adjust.
The default key bindings were also so much different from what I was used to coming from Atom. This issue was easily solved by installing an extension that remapped the key bindings to Atom’s so that eased my transition a bit.
In the months in which I used VS Code, I didn’t have much to complain about. Although performance wasn’t as good as Sublime, it was much better than Atom and continued to improve.
Despite this, I still had an eye on learning and using Vim. Any time I read about text editors in a discussion forum like Reddit or Hacker News, someone is bound to sing the praises of Vim and mention how much it can improve personal productivity.
When one of my friends switched to Vim and soon after was singing the same song, that did it for me. I just had to get what was so good about Vim.
Since I didn’t have much going at the time, haven just released Stellar Photos, I decided to switch to Vim cold turkey meaning I didn’t retain any other text editor on my computer during this transition process in a bid to force myself to use Vim exclusively.
It certainly wasn’t as difficult as when I tried it the first time. I used
vimtutor to remind myself of the basic commands and just went from there.
Vim is bare bones and doesn’t come with all the features I had taken for granted in other text editors, but in most cases, I could add the functionality I needed using a plugin.
That said, this became problematic to some extent as it led me to install more
than what I actually needed and my
.vimrc file was populated with a lot of
stuff that I didn’t understand.
So I took a step back and stopped trying to make Vim work like the other text editors I had used and instead, learn the features it has that makes it so unique and special. It quickly dawned on me that Vim can actually do a lot on its own without plugins.
Where necessary, I could still add plugins but, by not using them to scratch my every itch, I was forced to learn the Vim way of doing things which was, in most cases, better than what I was used to.
Working with just the keyboard has been a real eye-opener to just how fast one can be without touching the mouse. Everything can be achieved with just a few strokes, and due to Vim’s modal nature, each key combination has a different meaning in each mode. That may sound complicated on first thought, but it’s actually really intuitive once you get used to it.
One of the things I love about Vim is that each change can be repeated many times using the dot command or macros which does save me a lot of time when editing code. It may just be seconds saved here and there but it adds up.
The one thing I’ve found significantly worse in Vim compared to other editors is the colour and font quality, but I suspect this has more to do with my terminal emulator (I use Terminator).
I know its possible to make Vim look really good in the terminal as I’ve seen screenshots of other setups on r/Unixporn, but I’ve not been able to create something I’m entirely happy with thus far so I’m currently exploring what Gvim (Vim GUI) has to offer.
Having spent six months using Vim as my main editor, I can say it has definitely been a worthwhile experience and I don’t see myself switching over to some other editor anytime soon.
Right now, I’m looking to improve my mastery of the editor, and learn some advanced flows to become even more efficient. To that end, I’m currently reading Practical Vim by Drew Neil which appears to be one of the best books on the subject.
If you already have a productive setup in your current editor, I don’t think it’s necessary to switch to Vim abruptly like I did. It may not even be realistic depending on your work situation.
Having said that, I think it is still useful to learn the Vim way of editing text and you don’t need to use Vim itself to do so. Most editors have a plugin that emulates Vim key bindings so you can easily experience the Vim way without throwing away your existing workflow.
I will keep sharing what I learn on this blog, so if you’re interested in checking out Vim, don’t be afraid to try it. You might just like it.