I used to be an ardent fan of Sublime Text. It was one of the first modern editors that was fast, feature-rich and extensible. However, as I started working with remote machines and Raspberry Pis over SSH the sublime text setup became cumbersome. The whole cycle of saving, re-uploading files for every small change didn’t scale well and running sublime on RPi used up precious resources. So I tried exploring Vim and ended up loving it.
Once you get past the initial learning curve you will have at your disposal a super-fast, ultra-light and highly extensible editor. Personally, what I find amazing about Vim is its minimal footprint. Not to mention the associated cool geek factor.
Some numbers & graphs
Let’s pull up a quick comparison between Sublime Text, Vim and Visual Studio Code (seems to be the current popular choice). The charts show the time and memory for find and replace operations on 2 files.
For the smaller file, Vim and Sublime are really fast. Code is relatively slow but is consistent across file size with ~20 secs. Sublime slows down 10x on the larger file.
The memory usage on the other hand shows a crazy story. Vim uses a mere 4MB while Visual Studio takes 2GB ! Sublime Text comes up in the middle between 400MB - 900MB. Both Sublime and Studio crashed multiple times before I could get them to finish.
Text editors consuming the RAM equivalent of Chrome for performing such simple text operations is ridiculous.
Lesser known features
A common misconception is that VIm isn’t as feature rich as it’s WYSIWYG counterparts. Vim is actually very powerful and customiable. The community is highly active and you can pick from a long never ending list of add-ons to push the boundaries of what Vim can do. Here’s a brief preview of things Vim can do out of the box.
Split Panes & Tabs
:split or :vsplit <filename> to split the pane horizontally or vertically. Entering “:tabedit filename” opens up the file as a newtab. You can switch between the tabs using
<# of tab>gt.
Did you know that Vim has built in auto complete ? Hit “Ctrl + n” It’s pretty basic and provides results only from libraries or headers included. However, there are plenty of plugins available which give you full functionality.
You don’t need to exit your editor to go compile the code or run a command. Typing :!command runs the command and displays the output. Eg. if you want to run make hitting :!make will do.
For people who work on remote systems a lot like me, vim has a killer feature. You can edit the file on remote systems using the following:
Choosing an editor is a matter of personal taste. If you’re like me and prefer not to keep moving your hands between the keyboard and mouse you will love Vim. Give it a chance and you will find the time you invested learning is worth it.