Mike Barkas

Software Technologies

Mike Barkas

Mike Barkas

Software Technologies

Learning Vim

September 9, 2015

Getting Started with Vim

Learning Vim can be a daunting task when you think of how much there is to learn. This is because it is so configurable and extensible. Vim can be configured to do many things like writing text documents, email, and to edit computer code. There are also many plugins for Vim to provide specific functionality.

Your first few times using Vim can be difficult and make you want to give up using it, but if you keep things simple at first, be patient, and learn one thing at a time that will help.

The two major things to I wish I learned first is Vim has different modes it operates in and different ways to accomplish cursor movement. Understand these two basic principles before attempting to write or edit your code.

Vim Modes

I would suggest to understand the basics about Vim’s different modes it operates in. Having these different operating modes makes it very different than most of the programs used to write/edit code like Sublime, Atom, Text Wrangler etc. Vim behaves differently in each mode and the keyboard inputs also do different things in each mode. This is what makes Vim so powerful.

Be familiar with the normal, insert, visual, and command modes and how Vim behaves in each and also how to transition from one mode to another. These are the basic modes, there are other modes also.

Once you understand and get used to the different modes you will start to appreciate what Vim can do.

Cursor Movement

One transition to get used to using Vim is not needing to use a mouse. Initially moving away from the mouse can be awkward as your natural reaction is to go for the mouse when you need to move your cursor to a different location. One of the initial barriers learning Vim is understanding how to move your cursor around to different locations. This was one of the most frustrating things for me when I started learning Vim.

Start with basic movements like going to the beginning of the line you are on and going to the end of the line you are on. Once you have that figured out, Learn how to go to the top of file and then the bottom of the file. Making notes of the basic keyboard commands to achieve these basic movements will help you retain the information and provide a guide to refer back to. Some of the cheat sheets found on the Internet for Vim may be to complicated for you when first starting out. Keeping a simpler guide with just the keyboard commands you like, or need, may be best for you.

Start Simple

Find a simple task that you can take the time to do in vim. Something that will take 10 minutes in your current editor may take an hour in vim. The important point here to be patient and tell yourself you are going to take your time and learn how to complete this task, as difficult as it may seem at first.

As with most things, there is many ways to accomplish the same task. And this is true using Vim as well.

Like learning music, or a musical instrument, you wouldn’t learn all the scales and chords at once. Start with fundamental building blocks and build up from there.

So with some practice and repetition, you will soon be looking for ways to customize Vim for yourself and to learn more advanced Vim topics.

Sometimes when I switch to a different word processor, I start pressing jjj or kk and get frustrated my cursor is not moving.

Online Resources

Vim Golf: http://www.vimgolf.com/

Online simulator: http://openvim.com/

Vim