How to Start Learning Vim Without Losing Productivity

Becoming a Vim master one step at a time.

Introduction

A few months ago, I had a loss in productivity when I decided to make the switch to Vim. I was using Visual Studios Code as my primary IDE, but I wanted to work more efficiently. I use the terminal for git, React Native, iOS, and Android commands, so having to alt-tab to find my IDE is a concentration breaker.

I plan before tackling a new project. Otherwise, I could potentially make the transition more difficult.

After putting in some thought it finally hit me…

I spent some of my free time setting up my environment and learning the basic key commands, and it was so worth it!

There are times where I jump in head first on a new project because I am so excited. Where I consume myself in learning, tinkering and fiddling with a new project. I will admit that I do get burnt out occasionally and I end up not finishing all projects that I have started.

I was determined to become more efficient in Vim, and I told myself not to burn myself out. I decided to take a different approach than jumping in headfirst. One, in which I will take a slow and steady approach where I’ll use VS Code and Vim at the same time. So I introduced Vim into my development process at a slower pace.

I started using Vim for small edits first.

For example:

When changes needed to be made to the package.json file

Project environment files

Repository README files

Vim Setup

One of my first steps was finding a tutorial on setting up a basic Vim environment that suited my needs. I primarily work in React, React Native, and Javascript so I settled on going through this article.

Even with a tutorial Vim takes getting used to in terms of just setting up. I started installing the core plugins that I needed. Those were, JSX, Javascript highlight, and others. After spending some time in Vim I decided to install more intricate plugins like NERDTree.

A side note: During my initial uses of Vim I ended up installing tmux as well. It added on to the learning process, but having the ability to create multiple panes is a must when developing.

I found out the best approach to learning Vim and tmux together is to start learning the basic commands of each. In Vim I first learned how to move the cursor, make edits, and replacing text. In tmux I focused on initially learning how to create horizontal and vertical pane.

When I learn something new, I start by reading a few chapters in a book related to the topic and then I start practicing. So, I read the first three chapters in tmux 2: Productive Mouse-Free Development.

A Plan on Getting Started

Start using Vim for small edits only

Practice key commands daily for 15 minutes by playing games, tutorials, and books for Vim.

When you feel comfortable with what you know, push yourself outside the comfort zone, and learn something new about Vim.

Find bottlenecks and see if there is a solution or a plugin that will help.

Becoming a Vim Master

Learning Vim with tmux is a long term commitment. The best way on becoming a master is knowing what requirements are needed from an IDE. When I find a weakness in my flow I pinpoint it and focus on making it a strength.

When I realized it was difficult to find files I found a great solution. In the article, I linked above it mentions the use of NERDTree. After installing it there was a learning curve, but my two main commands were:

type :NERDTree to open up the plugin

to open up the plugin type :q to close NERDTree

Another feature I realized was missing is having the ability to search through my files. After some digging on the internet, I found the plugin FZF and the :Ag command. It was really helpful finding where API calls were being made within my code.

To complete my mastery of Vim I used tmux. It allowed me to create an environment where I can have multiple panes. I usually go with a vertical split with two vim IDEs on both sides of my screen and one horizontal split that is the command line.

Conclusion

Getting started on Vim and/or tmux may seem like a daunting task, but if you take it slow and steady you’ll be able to make the switch without losing much of your productivity. Remember that it takes time to learn something new. Especially, something as complicated as Vim, so take it easy. Make a plan and you should be on your way to becoming a Vim master!