So Long Sublime! Hello, Vim.

First Encounter

I remember the first time I opened Vim. I was greeted with a wall of text that of course, I completely ignored. I mean, all I was trying to do was edit a linux config file, "it shouldn't be that hard"—I thought to myself, foolishly.

After trying to exit Vim and failing horribly, I vowed to never touch this blasted editor again!

Fast forward 5 years

I kept seeing people in talks and demos—while learning about various libraries and frameworks— using Vim. They all seemed to be moving at lightning speed, deleting and changing words so incredibly fast, only taking their hands off the keyboard to gesture things to the audience. I was in awe at the power and control they seemed to have over the editor.

I remember thinking to myself, "I learned Photoshop and Illustrator commands relatively easily, this couldn't be that difficult!" Boy, am I happy I listened to my thoughts and decided to give it another go. After frantically Googling for info on the text editor, I came across quite a few talks and tutorials explaining what the various commands and keyboard shortcuts were. Watching people explain it's power, is when it really began to sink in. This isn't like the graphical editors most of us are used to.

A month later

Here we are a month later, and I have a hard time using anything that doesn't use Vim's commands. If the editor doesn't have HJKL to move around, I feel lost and less productive. It took me a while to get used to the movement commands. I would say, a solid week of hammering H is left, J is down, K is up, L is right into my head before I felt competent and comfortable enough to learn more. After I got a solid grasp on movement, I started to learn about various other commands; like diw for example. Which means "Delete In Word". Whichever word your cursor—not mouse, but the little blinking box—is over, will get deleted and put you into --INSERT-- mode, which allows you to type again. Really, really handy for changing words insanely quickly.

After learning more commands, I quickly started to want features that I missed from Sublime; which led me to Vundle, a package manager for Vim. Very similar to Package Control for Sublime.

Upon installing Vundle, I found something that made me fall in love even more than I already was. Vim-Surround. TL;DR - you can easily change the surrounding character on a word. Let's look at "hello" for example. Say you wanted to change the double quotes, to single quotes. The command for that becomes cs"' while on that word. That's it. Pretty freaking cool!

Another wonderful thing is configuration. Configuration is all done in a .vimrc file (_vimrc with gVim on windows) that you can pretty much copy from machine to machine. I'm sure you could possibly do the same with Sublime, but from what I've ever seen, Sublime doesn't really promote that. It would all have to be done through Package Control. If you have multiple machines that you work on, setting up your editor gets repetitive quickly. Something cool that you can do is upload your .vimrc to GitHub to remove some of the repetitiveness. That means, you can clone it to any machine with Git installed to make the setup go a hell of a lot faster.

You can view my vimrc here. Feel free to clone it, fork it or study it! I might end up putting a bash script in there as well to clone Vundle and flattown (the colorscheme I'm using) from the appropriate repos, just to make it easier for those on *nix systems.

Final thoughts

For those of you that might take away that I think Sublime is a slow editor for unproductive people. You couldn't be more wrong, that was not the point of the post. I used Sublime for a long time, but I wasn't satisfied with the way we worked together. If you feel like you've hit your peak with Sublime and nothing else could make you work faster, or you hate the idea of keyboard shortcuts (please re-think that), that's cool! Stick with what you know. But, for those of you that feel like you haven't hit your potential in efficiency while coding, writing text, blog posts or anything that involves plain-text, give Vim a shot, at least for a month. It might just change your way of looking at writing great code.

Links, tips and the TL;DR

Don't put anything in your VIMRC you don't understand! - This is definitely something that helped me learn the .vimrc file. If you see a setting in someone else's vimrc you don't understand, Google it!

Learn Vim shortcuts through a game! - Really helps get your movement down.

Vim Tutor - Vim tutor is build into Vim. open Vim and type :help tutor before hitting any other key. Yes, the colon is necessary!

One of the talks that helped solidify it's awesomeness (23mins) - The speaker really pushes the power of Vim and gives good tips on how to train yourself.

Last but not least, Google! - This is something you should refer to often already, so use it for learning Vim as well! StackOverflow also has some really helpful Q&As.

TL;DR - Sublime is great, but Vim is better. These are my personal views.