Table of Contents
- 1 Introduction
- 2 Text Manipulation
- 3 Customizability
- 4 Server Savy’s Home (SSH)
- 5 Startup time comparison
- 6 Lightness & Portability
- 7 Availability
- 8 The G Madness
- 9 So why is VS Code more popular?
- 10 Vim Emulation inside VS Code
- 11 Conclusion
VS Code has been an active Dominator in the Code Editing space, owning much of the territory. Being released back in 2015, it is safe to say that VS Code is still pretty much in its infancy. Nevertheless, it has a reported 14+ million active users as of now who either have it installed in their machine, or deployed in a server.
Vim may not be as widely known and used as compared to VS Code, but those who witness the true power of it can barely think of switching out (except for those who can’t sacrifice the love for their lonely mice. Very well done people). This article won’t fit all the cool things about Vim, but here are some of the reasons why I think Vim is a better code editor than VS Code.
A lot of people say this, and I will too. Vim is like a language (ahh, here we go again), but before you start moving off, hear me out first. Vim is not just about the language people talk about. It also has an endless vertex of possibilities no matter how good you think you’re at it. It knows how to hit hard even those who grow their beards old along with Vim. It always has something under its hood to surprise you with!
Enough of it though, it’s time to have a hard talk. If you’ve never used Vim before, I bet you’ll have an eyegasm.
Motion, Mode, Maneuver
Vim is all about pure, distilled efficiency, and in order to achieve that, it has to do things differently from other text editors, which in our case is VS Code. Rather than letting you directly start typing once you enter it, it offers you various types of Modes based on what you need to do. But why is this essential? Because this will allows you to use the regular alphabetical keys on your keyboard for different tasks rather than having to press Ctrl or Shift for every other thing you do. You do need to use them, but not all the time. Vim want you to forget your mouse, and to do that it needs to make sure you can do all your tasks from within your keyboard.
The Motions in Vim is like a match made in Heaven for Modal Editing. This is where the “Vim is like a language” makes its place. It allows you to navigate, edit your text, and do all other fun stuff by using identifiers for words, sentences, paragraphs, code blocks and so on. If you’re not sure what this means, have a look:
The above example is extremely basic, as compared to the array of possibilities you can combo together to become one of those people. Let us break this gif down for a better understanding:
- At first I entered the Insert Mode in Vim by pressing the “i” key so that I could start typing in. Right after, I wrote some seeming weird stuff.
- Once done, I exited from the Insert Mode by pressing the Esc key. This gets us to the Normal Mode in Vim, which is where you first land on when you start Vim. In this mode, we do basic navigation, however, this is the mode which gives Vim all its power – the ability to manipulate text at the speed of thought.
- In the Normal Mode, I pressed the b and w keys to navigate between words, without needing to press the arrow keys. This is what we refer to as the Vim Motion. W represents jumping words in the forward direction, while b represents jumping words in the backwards direction. There are more. But I know you’re confused enough already.
- The next cool thing I did was to change the content of the word under the cursor, which was from “Vim” to “Neovim” by pressing “ciw” keys in a sequence or a combo. C is for change, i is for inside, and w is for word, change-inside-word. Getting the idea yet?
- The last one was dw, which deletes the word in front of your cursor. As simple as it could get.
If you’re wondering what Neovim is, it’s essentially just a fork of Vim with more features like Lua scripting support, but everything I’ll be showing in this article function the same across both Vim and Neovim.
This part of the article will give you a hint of Vim madness, how different key combinations make text editing shenanigans a joy. I’ll not be explaining them for the sake of minimizing the article. So sit, back, grab your cup of coffee, and enjoy the scene (make sure the cup doesn’t fall of as you watch).
These are only the “noobs do” stuff in Vim. You’re left to see the real thing. While I’m not saying VS Code cannot do cool stuff too, but try copying above examples inside of VS Code, and you’ll see the difference. Also, make sure to note down how many mouse clicks and/or drags you need in the process.
Actions describe better than words. And likewise, visual examples describe better than explanations. I know I could baffle a lot about Vim customization. But the simplest way I could show you what Vim has to offer, is this.
Don’t like the dead, plain interface composed of mere defaults?
Then what about this?
Vim lets you customize every aspect of your Editor Interface. From the Modal Menu all the way to how your tabs should look and what information should they view, there’s nothing about Vim you cannot customize. And if you don’t like something or don’t need it at all, just remove it.
Plugins can extend it to a lot higher level. But it is to be noted that in the above example, I’m not using any plugins. The status-line is custom built with Vimscript (used for assigning settings in Vim), and it’s not very hard either. How many aspects of VS Code could you customize, though?
Server Savy’s Home (SSH)
The fact that Vim was designed in the good ol’ days gives it a huge advantage over VS Code. If you keep aside casual programmers and talk about hardcore Server Engineers who spend half of their lives looking at a terminal shell, you don’t know what Vim means to them. As the development of Vim started when GUIs weren’t live yet, it call entirely be run from a virtual terminal (or tty), and accessed over an SSH server with ease.
VS Code can be run from a server too, but never from a terminal shell. Also, more than half of the big-boy servers in the world use a terminal interface only.
Startup time comparison
I won’t need a stopwatch to give you show you exact milliseconds of difference for the startup time between Vim and VS Code. The recordings should be enough to give you a clear idea. And if you don’t believe it, try it for yourself.
If you first notice the extensions tab in VS Code, you’d see I’m using no bulky plugin that’d make the comparison unfair. In both the editors, I’ve used a very basic setup to demonstrate how fast each can load without a lot of plugins installed. If you exit and start your Code Editor frequently, even the above shown loading time in VS Code could be very frustrating, keep aside the fact that you’ll have way more plugins installed while you do so, making it even slower.
I won’t need to go much about this because, well, any experienced developer will understand the reasoning behind this huge gap in loading times between the two. For those of you who’re eager to know, VS Code has to load a plethora of components, including the GUI elements. On the other hand, as Vim is run from the terminal, it only loads what it needs to and requires printing nothing more than ASCII characters to decorate the whole interface, rather than loading GUI elements from an external graphics library. Pretty banal stuff.
Lightness & Portability
Vim is extremely portable. How much portable you ask? It comes at a download size of around 7-9 MB, and 30-40 MB for installation, as compared to VS Code, which comes for roughly a 200 MB download and a little less than 500 MB installation size. The size of the application may not be a big deal in an era where Gigabytes of Hard Disk come at the cost of a month’s bread and butter. But the portability of Vim helps it to minimize bugs, give you the flashing load times as shown in the previous section, as well as allowing you to migrate all you settings at ease. True, distilled ease.
Simply just copy your .vim folder and .vimrc file located in your home directory, save it in your cloud, or migrate it throw it change it delete it. Do whatever you wish. But wait pal. You can migrate your settings from VS Code with Sync Settings option too. However, will it be as painless as just copy pasting, though? You know better.
Due to its compactness, Vim can be run from just about any operating system you can think of. Starting from UNIX systems like Linux and Mac, to Windows, as well as Android and iOS! In Android, you can use either Termux to emulate a semi-Linux system and use it right from there, or you can also install DroidVim from Google Play Store which has a friendly UI as well. For iOS, there are several apps available in the Apple Store which are capable of using most of the Vim command ans functions. Can VS Code do that, huh?
You can try using VS Code from a mobile browser by visiting the vscode.dev website, but is it really usable?
The G Madness
I saved this for the last. And you’ll know why. The letter “g” is a Gateway for Vim Users to enter a whole different world of text manipulation. I could’ve shown this in the Combo Jumbo section, but its just too insane that it needs a heading for itself. Don’t understand what I mean?
Can your code editor do that? I bet it can’t!
The Global g command is a feature of Vim nonparallel to any other. It’s just the boss of its kingdom, the Kingdom of Text Manipulation. I can’t exaggerate enough how cool g is. And the above examples are the simplest you could ever do with g.
Guess what? G stands for gracious, gorgeous, and GLORIOUS!.
So why is VS Code more popular?
VS Code is more popular. No doubt about it. In an age of GUIs, Vim is set a few steps backwards. But does it really mean that VS Code is better? There are a few key points you should know first, before judging it yourself.
VS Code is very beginner friendly, as compared to Vim. It surely isn’t as friendly as text editors like Nano or Notepad++, where you just enter, type, save and exit. but it is friendly enough to let the user exit from it with no problem. Click the close window button and you’re good to go. What about exiting Vim? Well, that is one long story…
Meanwhile, this meme speaks a thousand words.
Better plugin support
VS Code has an extension store that spans more than 30,000+ plugins, and there are several actually useful plugins for it. These plugins can help extend VS Code in great margins, and there is exceptionally good auto-completion and language API plugins that make life easier for beginners.
But does this mean Vim lacks in plugin support? Of course not. Vim itself has more than 20,000+ plugins as of now, while with the birth of Neovim and its lua scripting support, it is very much possible it has more plugins than VS Code has, despite the exact number being unclear. Neovim also has a native LSP support which allows plugins for Neovim to incorporate as-good Auto Completion plugins for it. Which is why, it all now comes down to how easy plugin installation is among these editors. VS Code takes the lead here, as its beginner-friendliness explains already.
Created by Microsoft
Yes, the fact that it is created by Microsoft contributes a lot due to VS Code’s popularity. If you know marketing, you’d understand that having been created by Microsoft, VS Code earned a lot more public visibility and recognition as compared to Vim. Moreover VS Code is actively developed by a large group of humans. Vim is created by a single developer, and is a continuation to a the good ol’ Vi Text Editor, which itself is developed by one mere human being. Period.
Lets you love your mouse
Can’t afford to leave your beloved mouse for the sake of sheer speed and efficiency while coding? You’d probably love VS Code too, then. I’m not saying that VS Code cannot function entirely from a keyboard, but allowing you do a bunch of stuff with a mouse means that you’re less likely to learn the effective keyboard shortcuts you could have otherwise.
Moreover, trying to use only your keyboard for stuff in VS Code will not be as pleasant as you might thing. It’ll constantly require you to press ctrl and shift and alt and all. Good luck trying to save your fingers from breaking, or at least, changing shape.
Vim Emulation Inside VS Code
It’s probably not possible for the vanilla VS Code to be as good as Vim in terms of text manipulation, as mentioned previously in the Text Manipulation section. However, there’s one way…
VS Code has an extension called Vim in the extensions store, and that is as close as VS Code could get to Vim! What it essentially does is that it emulates a near-native Vim experience from right inside VS Code, while also integrating well with the rest of the overall interface.
However, this plugin is in no way complete. It does not have a lot of advanced features yet, including the mighty G command, which sure is something to miss! The following lists will give you an insight on some of the things that work and some that don’t. There sure is more left to try out and cover, but this should be enough for now:
- HJKL navigation (most importantly)
- The Dot Command
- Registers (including CTRL + R from Insert Mode)
- All basic text motions (w, s, p, b, etc.)
- :sort command
- Character jumping (with f and t)
- gf and gx command
- Splitting Windows
- G command (wish it did…)
- About 98% plugins, except for a selected few.
- Changing the Leader key
- Custom key mappings (this sets it wayyy back from the real Vim)
Don’t get me wrong. Even though a lot of cool stuff don’t work just yet, you’re most likely not to worry as the plugin has good integration with VS Code. Which means, you could possibly be able to install other plugins from the extensions store that compliments the emulation. You’ll need to try out yourself to see which integrates and which does not overall.
Hopefully, the developers are still actively trying to push in more features as time flies. So somewhere along the line, you may have luck to see them in the foreseeable future.
Therefore, this is pretty much the only way one can get VS Code to be as close as possible to Vim, which is by using Vim from inside VS Code itself, if they’re unable to give up on that! I know I’ve favoured Vim more in the overall article, but VS Code sure gets a large amount of credit for having this! (Well it is still Vim anyways, just that it’s inside VS Code 😉
After tiring my fingers to tell you about all the goodness of Vim and the reasons for VS Code being popular, I’m quite confident that I haven’t failed my fellow, Vim Comrades. Vim is certainly not what non-users think of it. Yes. Vim definitely has a learning curve, and is hard to learn. But once you get into the flow, you don’t need to take my word for it. You’ll know yourself. I’ve seen people boasting about VS Code being so easy and accessible for beginners and experts alike. But here’s the point. If you can code stuff that work (which by itself is not easy), why fuss about needing an easy editor? If you can learn to code already, what’s in it to say “Vim is soo hard I’m unable to quit from a source file of a C++ game I’m working on”.