Since starting at 8th Light on Monday as a resident apprentice, one of the key tools that the rest of the team are using to write code is vim (with tmux). This post will highlight what my initial impressions are on using vim/tmux to code on, and how it compares (so far) to using an IDE like IntelliJ.
Prior to joining 8th Light, I spent most of my days using IntelliJ to write Java code. I became very proficient at using IntelliJ and it is an extremely good IDE in my opinion.
Getting used to vim was initially challenging, however even though I've only been using it full time for a few days, I can already see the benefits of using it to write software with.
Distraction free coding: When I use IntelliJ, I tend to have several windows open at one time (Project Structure/Test Output/Gradle Build Targets/Text Editor). The issue is that as well as these windows, IntelliJ also adds its own menus to all sides of the screen. This results in a text editor space that consumes less than a quarter of my monitor. To compensate for this, I would usually prefer working on a large monitor so I have enough screen space to work with. You can easily switch to full screen view, but in IntelliJ I found this a fairly clunky way of working.
With vim/tmux, I've configured my setup such that there are far fewer distractions. I have one pane for a unit test/one pane for production code, and a third for test output. With tmux you can create and switch between panes very quickly. The entire screen is now being used, which results in more space to work with and less distractions.
Mouse-less coding: When using both Eclipse and IntelliJ, I made an effort to learn the tools I'm working with and to memorise the shortcut keys to allow me to work efficiently. Having said that, I did still used to rely on the mouse regularly to navigate several files, traverse a particular file, etc.
Vim/tmux aren't the most mouse-friendly tools that are out there, and as a result the keyboard is the only way to operate these tools efficiently. Being able to traverse text by using the vim keys is not only efficient, it's also comfortable. I am able to keep my hands in the centre of the keyboard over the letters, and switch using INSERT/NORMAL mode to either edit or traverse the text.
The vim dialect: vim provides a dialect to work with, and results in being able to come up with relatively complex shortcuts when working with text. Here's a few shortcuts that I've been making good use of;
cw - change word
5yy - yank 5 lines
dd - delete line
c$ - change current line
r - replace character
. - repeat last action
Highly configurable: there are a plethora of vim plugins out there, and is almost overwhelming initially at just how much you can configure vim. I've been writing ruby during the last couple of days, and using plugins like vim-ruby-refactoring to bring some of the good parts of an IDE to vim. Creating your own keyboard shortcuts is very handy too, for e.g. I have set up a keyboard shortcut that'll save a file and run the unit test in one action.
Not quite a total replacement for an IDE: There are still a number of functions that an IDE does that I'm not sure how vim could achieve. For instance, in IntelliJ if I want to rename a Java method I can simply press a single shortcut, rename the method, and know with certainty that the method name will be changed in all files that are using it. Also navigating Java classes in IntelliJ is a dream, I can traverse Java code very quickly by navigating to methods/classes, and am able to generate new methods on classes without an issue.
I am also a bit concerned that to use vim to develop code efficiently, you probably will want to customize it to your liking. As a result, this may make pairing more difficult compared to an IDE that is ready to use with its default behaviour/shortcut keys set.
Although it's only early days, I can already see huge potential to using vim to develop code on. I'll be researching how a few of the features that an IDE excels at (i.e. indexing classes for easy traversal/editing) can be replicated in vim. It'll also be interesting to see how working with ruby/vim compares to using IntelliJ/Java, and whether an IDE is only required for Java due to it's relatively verbose syntax.