Looking into Vim

Vim

Vim vs Emacs is one of the big fights in the Software Development vanguard. At least, apparently it is? I had only recently heard about Vim and Emacs tangentially from podcasts that discuss more of the recent news in the software world. I ignored it for a little bit, assuming that if I needed to know the knlowledge would find me in due course. But when it had turned up in most of my listening collection, I decided to find out what in the heck these things are and why everyone seemed to be fighting between them.

So What are Vim and Emacs?

Vim and Emacs, it turns out, are programs which allow you to navigate and edit text documents. At least, they are until you become fluent. In their post, Why I Use Vim, Pascal Precht describes the learning curve more like scaling a mountain and sliding down the other side. And from what little I’ve tried, the description seems pretty accurate. They’re powerful text-based editors which allow you to interact with the file system and traverse, search, and edit documents all without leaving the program or even having to touch the mouse. They can serve as an alternative to a visual IDE in the software development world. The intention is that, without the need for the more graphical elements of modern IDEs, the terminal style editor can be faster and the editing of code can be more efficient due to being able to freely switch between contexts of use with just the soft slap of a single key.

I had done a little bit of research but, to be honest, I still wasn’t getting it. So I thought I’d just give it a try.

Trying it out

Downloading Vim is pretty quick and the install process is simple. I work on Windows for the moment, so that’s what I installed (and also let’s you in a bit on the super graphical world I’m coming from). Opening up the application presents you with a black, terminal-esque window with a bunch of blue tildes. The classic blinking cursor sitting idly, awaiting the divine keystrokes of a User; with a capital U. A short message lets you know that typing :help will bestow upon you the knowledge of the ancients, the commands by which you can control this arcane console. Like an explorer in the midst of a magi-technological discovery, you imagine the Rosetta stone that this must be; the secret to untapped power and your key to understanding. What appears is a wall of text referencing other documents which, if I had read in full would probably have told me everything I needed to know. Except that I had no idea how to navigate it. The help file is extensive and a little daunting. Honestly, I actually set Vim down for a bit at that point. The problem was that I just had no idea how to get started and, since I wasn’t really sure what it did, I didn’t know what problems to apply it to.

A week or so later, my curiosity had not abated. I was sure that if I dug a little further the reason that everyone cared about these, seemingly unwieldy, text editors would become clear to me. So I did what any knowing professional would in my shoes. I googled it. I discovered OpenVim.

VirtualVim

Using a virtual vim terminal, the site walks you through your first few commands of Vim. It is by no means exhaustive. It’s a short and simple tutorial of basic editing and navigation. But that’s enough. With that short sample I became an apprentice sorcerer. The runes had begun to make sense and I could feel that there was something a little more powerful at the end of this journey. I was excited to explore more; to gain more knowledge. So I used it for a real life problem. I was not fast. I was not a super human hacker now. But there was something intuitive about the mode switching and navigation without having to leave the keyboard. It took me a while to realize that that was what I liked about it. What I still like about it. Using Vim made me realize quite how much you could do without having to touch the mouse at all, outside of Vim as well. A lot of the programs proponents say, and I haven’t been able to tell how serious they are about this, “why would you ever want to leave Vim?” But as a mere apprentice sorcerer, there’s plenty of tasks I still need to do away from that editor. And using the mouse felt natural. But there’s something really fun about being able to traverse you’re whole machine without lifting your hands more than an inch from the keyboard. I don’t actually think it made me faster or better. But using Vim forced me to think about what keyboard shortcuts my programs and desktop offers. And I found that I was really enjoying it. It felt much closer to putting what I wanted to do into action without any barriers. I’m not saying everyone is gonna have this experience. The mouse hand is a useful tool and it can help you to think. But I can see why people use Vim. With the right start and if you can keep the commands in your head for long enough, then it can become a really easy way to traverse text documents. Does it replace an IDE? I’m not sure yet. There’s a lot you need to do in order to be able to set it up with any of the features that modern IDEs have out of the box.

There is a best of both worlds solution. It’s possible to install Vim plugins to some modern environments such as Visual Studio and CLion which place the navigation and input aspects of Vim ontop of the functionality provided by more modern development tools. This seems like a pretty promising step to me in terms of development speed. So I might give that a try at some point.

If you’re interested, here’s where to get Vim and some good resources on the commands available for getting started.

Vim Website – The website for downloading Vim

Vim Adventures – A little adventure game based around Vim commands. A fun way to get used to the basics.

Vim Cheat Sheet – Pretty dry but really useful during learning. Just the basic commands one after the other.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s