blog
/Development

The Wonders of Vim

Murad

As a software engineer, your choice of development environment will affect your productivity eight hours a day, five days a week. Different people have different tastes as far as text editors/IDE’s go, and for good reason. Personally, I always tend to gravitate toward more minimalist tools and greater transparency, and as I’m sure many would agree, you can’t get much more minimalist than Vim.
 
Vim is an open-source text editor which comes by default with many Unix-based systems. Although it has a graphical, stand-alone interface as well, I use Vim for the command-line functionality. Let’s face it, being able to quickly SSH into a server, open up Vim, write some code, and test it all without changing windows is pretty sweet. Additionally, Vim won’t waste your time with too many menus (and submenus, and sub-submenus, etc.). When you’re using Vim, the only thing you have to worry about is the code itself; you’re free of distractions, menus, unnecessary boxes, and well-meaning yet tragically misguided paperclips who offer you advice.
 
Despite the welcome absence of menus, Vim is still highly configurable and functional. All you need to do to change Vim’s appearance/behavior is make modifications to your .vimrc file (which you will, unfortunately, most likely have to do, as the default behaviors can be silly at times). Some people go crazy with configuration, but I haven’t really found the need to yet. For example, my .vimrc file is 5 lines long at the moment and my world has yet to come crumbling down as a result of it.

Plug and Play with Pathogen

Outside of Vim’s built-in configurations, there are also countless plugins out there for various specialized purposes. Thanks to Pathogen, installing and managing plugins is as easy as downloading them, putting them in the right directory, and adding “call pathogen#infect()” to your .vimrc file. Most plugin installations are as simple as going into your bundle directory and cloning the Github repository of the plugin you’re after.

For Python Programmers

One plugin that I would recommend to any Python programmer using Vim is Syntastic paired with the Python package Flake8. Syntastic is a syntax checking tool for Vim that notifies you of static/syntax errors. Flake8, on the other hand, is a Python package which combines similar syntax checking with a static analyzer that makes sure your code is consistent with pep8, a style guide for writing beautiful Python code. The quality of your code increases immediately, and you learn about good Python style without having to religiously study pep8. For an example, I’ve listed a picture below of some terrible Python code, so you can note how angry Syntastic is at said code:
 
 
These are only the first few reasons that come to mind of why I’m a big fan of Vim, though that’s only scratching the surface. It’s
incredibly well supported (in that a simple Google search will generally remedy any issue you might have) and has a community of super skillful, enthusiastic developers backing it up. Getting used to Vim is certainly an undertaking if you’re completely new to it, but becoming a Vim wizard will make you a better programmer and is well worth it.

About Murad