DEV Community

Cover image for Why I switched to Vim from Visual Studio Code
Ayooluwa Isaiah
Ayooluwa Isaiah

Posted on • Originally published at freshman.tech on

Why I switched to Vim from Visual Studio Code

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.

My History with Text Editors

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.

Sublime Text

Sublime Text Editor on a Macbook

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 to spend on a text editor, I began to look for alternatives.

First Stint with Vim

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.

Atom

Atom Text Editor on a Macbook

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.

Visual Studio Code

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.

A package.json file open in Visual Studio Code

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.

VS Code is probably the best text editor for developers who write a lot of JavaScript and TypeScript due to its comprehensive out-of-the-box support for both languages. However, other languages are also well supported. It was really easy to work with Rust for example, which I dabbled in sometime last year, with the help of some plugins.

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.

Trying Vim for the second time

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.

I have adopted the mindset of preferring to just use the keyboard in other areas as well like using jumpapp for switching between applications and using Saka Key for navigating quickly in my browser.

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.

Wrap Up

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.

Here are the ones for Sublime, Atom, and VS Code.

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.

Top comments (23)

Collapse
 
verzola profile image
Gustavo Verzola • Edited

Hey! Nice post! I also forced myself to use Vim full time some years ago and I do not regret. It made me a lot more productive. I recommend this book that helped me understand a lot of Vim:
learnvimscriptthehardway.stevelosh...

Have you ever tried Vim 8 or NVIM? It allows you to get the same colors from GVIM.

My .vimrc: github.com/verzola/.vimrc

Collapse
 
ayoisaiah profile image
Ayooluwa Isaiah

Thanks for sharing your vimrc! Just took a quick look and I can already see some things that I will find useful :)

I've been on Vim 8 since day one so I don't think that's the problem. It appears you need true color support in the terminal as well. I'm not sure what Linux terminal emulators have true color support and I haven't been bothered to look it up. Gvim will do for now.

Collapse
 
verzola profile image
Gustavo Verzola

You are welcome! Most of the things in my vimrc was stolen from other people vimrc or from this book, hehe! I started using these ready vimrc distributions like spf13-vim but my vim took too long to startup... Also there was a lot of plugins and settings that I didn't know how to use or didn't needed, so I created mine with just the things I really need and now it is super fast, like it should be!

About the terminal, if you use Linux, there is a big chance that the default terminal emulator has true color support, but you have to activate in vim with setguicolors. It is useful mostly when you are connected to a server via ssh or use the terminal a lot.

Collapse
 
moopet profile image
Ben Sinclair • Edited

I like this post, but I want to throw in with a bit of a pet peeve:

the free version is unrestricted in its feature set, but you just have to deal with that popup and it can be annoying sometimes

From the horse's mouth:

license must be purchased for continued use.

Sublime text is not free, as in either speech or beer, and it never has been. Abusing the trial by using it as if it was free is commonplace, but it's still abuse of the license.

EDIT: I used PHPStorm briefly with its vim emulation and found that to be the best out of all the editors I'd dallied with.

Collapse
 
ayoisaiah profile image
Ayooluwa Isaiah

Ah yes! Wrong choice of words there. I should have said "the unlicensed version". Thanks for pointing it out 👍

In any case, it's hard to justify Sublime's hefty price tag given the depth of features that competitors, such as VS Code, have got nowadays.

Collapse
 
jorinvo profile image
jorin

Hi Ayo! Nice to see others enjoying to learn vim! Even after three years, I still learn something new almost daily!
Just recently I took time to make more use of macros. This article was really helpful: hillelwayne.com/post/vim-macro-tri...
Also, there is a great Twitter account to follow for learning neat vim tricks: twitter.com/vimgifs

Collapse
 
maxdevjs profile image
maxdevjs

Good article about macros, thank you :)

Collapse
 
oivoodoo profile image
Alexandr K

You don't need to switch to the new editor at all. It's better to have the alternatives daily. in one day it will become boring to use the same editor daily and visual code, spacemacs, vim and other options will come to your life :)

using vim the last ~10-11 years and using visual code with key bindings sometimes as well for js, python,go because of awesome autocomplete there. but vim is still one of the best option to feel like a hacker by developing in terminal or sshing to the server and edit there in place.

Collapse
 
myterminal profile image
Mohammed Ismail Ansari

I have been wanting to learn Vim myself since a while. However, my infatuation with Emacs does not let me try another text-editor at all. I can totally relate what it must have been for you to entirely switch to an editor like Vim where you can 'magically' perform tasks with a few key-strokes here and there, tasks that would otherwise be cumbersome in regular/modern text-editors. I also have huge respect for your efforts on learning Vim, coming from a fairly easy-to-use software like Sublime Text.

Not that I want to disrupt your happy experience with Vim, I'd just like to mention that Emacs can provide a similar experience where after starting to understanding it, in some time (depending upon how quickly you get accustomed to the awkward key-bindings) you would find yourself so excited about a text-editing tool that you cannot stop talking to people about it, as I have been since about five years now :)

It turns out that a text-editor can actually change you as a programmer by providing you with unique tools and methods to perform the same task in a more systematic and efficient way.

Happy text-editing to you!

Collapse
 
ayoisaiah profile image
Ayooluwa Isaiah

Cheers man! Thanks for the comment

Collapse
 
rossijonas profile image
Jonas B. R.

I've been thru almost the same path as you, I've used Sublime Text/Atom for a while, and tried VSCode.

They all seemed pretty much the same.. boring.. and very slow when dealing with large codebases, or with multiple files, or with linters and stuff turned on!

After switching to Vim I realized how it's awesome, the learning proccess is what makes me more excited to use it and I never get bored of it. There's always new tricks, you can program scripts to better your workflow... It's more than my text editor of choice, it's my videogame 😂.

After using Vim for a while, I decided to write quick tips and tutorials for Vim beginners, to help them deal with specific configs and get excited with tricks you can use.

You can check it on medium.com/vim-drops !

Cheers!✌️👨‍💻⌨️👩‍💻✌️

Collapse
 
maximfilimonov profile image
tpaktop

I do use vim as editor of choice for quickly editing a file, though the static analysis and refactoring support is way too much work for me to configure in Vim.
My latest setup based on nvim as it offers many sane defaults and better support for modern plugins.
There is also a fun way to learn vim - Vim Adventures

I do find myself sticking to VSCode more and more these days especially with recently added LiveShare support. With Vim plugin installed I'm feeling right at home and don't really miss much any of vim features.

Collapse
 
maxdevjs profile image
maxdevjs

"instead, learn the features it has that makes it so unique and special": is up to us to choose, red or blue pill...

Harder part has been to "accept" to think in Vim mode, but when it clicked, reality changed :)

Collapse
 
tahini profile image
Tahini

Great post.

Honestly, Vim blows everything else away. It takes time to learn and setup, but once you get proficient, switching to anything else is hard. I have tried multiple times to switch to code, but I can't make it stick. It's not so much the key-bindings (which can be emulated fine on Code - and even better on Atom); it's more the low-level, unix-y nature of it.

I love vim.

Here's my setup, if anyone is interested:
github.com/hew/hotfiles/tree/maste...

Collapse
 
leob profile image
leob • Edited

Interesting ...

I'm using 3 different IDEs (Eclipse for Java, Netbeans for PHP, and Webstorm for Javascript), and I use VIM quite often for simple editing tasks (but not as an IDE ... I like VIM a lot, but an IDE it isn't).

Recently I've tried Atom and VSCode with the aim to replace Netbeans and Webstorm (to reduce the number of IDEs from 3 to 2).

Conclusion: I like VSCode a LOT more than Atom ... VSCode looks a lot better, works better, is faster (Atom feels more sluggish). Atom also requires you to install and configure a mountain of plugins for even the simplest things, VSCode is more or less complete 'out of the box'. I think Atom really lost this war.

Funny thing is, for now I'm still hanging on to Netbeans and Webstorm ... old habits are hard to change, and each has little things that I like just a tad better than the equivalent VSCode feature.

I could however see myself switching to VSCode at some point!