How I doubled my productivity as a Software developer

Naveen Negi
6 min readJun 8, 2018

I am big fan of Elixir Lang. But one of the biggest problem that I faced with the language was the IDE. I tried Atom but quickly gave upon it, as it kept crashing, Later I tried VSCode, which wasn’t very bad and kept me happy for few months.

In Elixir community people kept talking about Spacemacs and I was keen on trying it, luckly I got a two month’s break while switching jobs. I had a pet project in Elixir and started using Spacemacs for it.

Everyone recommended using evil-mode with spacemacs which is nothing but vim mode in spacemac, well for next two months I only learned few basic commands of vim and spacemacs. Initially my goal was to be at least as productive as I was with VSCode.

Why should you care ?

Vim is more than a text editor, it is a language in itself. It will quickly take you from frustrated to god-mode developer. With vim you can learn 30 shortcuts and these 30 shortcuts can be combined to produce 1800 odd shortcuts.

To give you an example, consider following basic commands,

d: delete

c: change

y: copy

v: select

w: word

i: select inside (it is a verb)

t: till

Now the combinations that you can do with above 7 commands are diw, ciw, viw, yiw, dw, cw, dt{, ct{, yt{, dt( …. and list goes on.

What prompted me to learn Vim ?

There were many things that got me interested in vim.

  1. I work with various languages like C#, Java, Elixir, Clojure, JavaScript and TypeScript.It was always a pain to switch between different IDEs and remember all the shortcuts in all IDEs.
  2. For Dynamic languages most of the IDEs that I was using were not good enough especially for Elixir Lang (which I loved so much and was spending most of my free time on.)
  3. Most of my colleagues at ThoughtWorks had hacked their IDEs into submission. I felt like I am taking too long to implementing something which they could have done in half the time. I wanted to be at least as good as them if not better.
  4. For things like code refactoring or fixing tests after refactoring, you end up modifying a lot of code and being fast at that definitely helps.

The Turning point

In my new Job I met a guy briefly who was using Vim in Intellij Idea, and he was so fast that I have never seen before.

One conclusion that I drew was that he wasn’t typing any faster than the rest of us, but his key strokes were way less than most of us.

For example if he needed to modify some code 9 line below the current cursor position, it would take him two key stroke to reach the position, and another few key strokes to modify the code.

A rough Start

As I had already started using spacemacs with evil-mode, I decided to use vim-idea plugin for my day to day Java work.

My journey with Vim wasn’t so smooth, especially because we were pair-programming, whenever I used vim, my colleagues would often complain as they saw me struggling with Vim shortcuts.

Strategy to Master Vim

This time I was determined to master Vim. So I started to read Practical Vim, this book was full of insights. It taught me Vim as a philosophy. After reading this book I was convinced that vim is not just a editor but a powerful language. Over the course of next three months I started doing following things.

  1. Read Practical Vim : this book taught me philosophy behind Vim. It taught me Vim as a Language and philosophy. I learned thing like Dot command, text objects, motions, operations and how to use them effectively.
  2. I started looking into many online resources along with the above book, I bought a moleskin notebook and started jotting down most of the vim commands.
  3. Every morning, while brewing my coffee/tea, I would go through the these commands. In the beginning I spend half an hour each day to revise them. Gradually as I got familiar with these shortcuts, my revision time reduced to 5–10 mins. I would usually try out these commands at work.
  4. Like I said, initially I did not practise much, I just remember the shortcuts and focused on the reasoning behind them, for example what are the various Text objects and how to efficiently use them, what are the things that you can do with Dot command.
  5. In order to truly master Vim I decided to buy Happy hacking Keyboard Prof 2. This keyboard is specialised for Vim users (for example it doesn’t have arrow keys, and caps lock is mapped to Contrl key). With this keyboard I was forced to use Vim all the time.
  6. I started to use idea-vim plugin for Java development. Combining Vim with Idea shortcuts turned out to be very powerful combination.
  7. To further enhance my Vim skill, I decided to go all out, I install vimium plugin on chrome to use Vim shortcuts on chrome. Along with Spacemacs, I stared using Tmux (a terminal multiplexer) configured it with Vim, zsh. I also enabled vim in command line (Vim every where :) ).
  8. I disabled continuous key presses on my computer. For example if I wanted to go 10 lines below, I couldn’t press j 10 times and forced to look for alternative ways to do it.
  9. This is not related to Vim but I kept practising my coding speed at typing.io, it is a site where you can test you typing speed on against various programming languages.

Lessons learned …

  1. If you are on insert mode for too long, you are doing it wrong. Do your editing and quickly get out of insert mode.
  2. Using visual mode for selection is also a smell, for example if you want to copy a method, instead of selecting the method in visual mode first and pasting it, you could directly copy the method with { and y}.
  3. Try using text object more often like (ciw, cis, cip …). Often code can be treated as prose.
  4. Learn to use Dot command effectively as it allows you to repeat complex edits (for example text-objects like ciw, diw can be repeated).

Conclusion

Vim is about staying in the zone.

In positive psychology, flow, also known as the zone, is the mental state of operation in which a person performing an activity is fully immersed in a feeling of energised focus, full involvement, and enjoyment in the process of the activity. In essence, flow is characterised by complete absorption in what one does.

When you’re using Vim (as a “power user”), every single micro-decision you make while editing is less likely to drift you away from the zone. That happens because every editing decision translates into a sequence of keystrokes that your brain has learned to play without involving the logical parts of it.

With three months of forced Vim learning I was better than most of fellow developers in terms of productivity. I would often discuss the approach with my pair before coding, once we decided what to do, Doing code changes with Vim was like going into trans and your thoughts just translates into action.

--

--