Learning Vim: Current Steps

How do you learn a new skill? I don’t know what the optimal way is, but I can discuss how I’ve done it historically, and use a skill I’m currently developing as an example. As an engineer, I always want to improve my efficiency, and establishing a baseline is key.

One of my (m741) goals is to improve my programming skills. I’ve long developed in a custom environment, and I want to get familiar with standard development tools. One of those tools is called vim, and probably every computer person has heard of it. It’s a text editor, like Notepad, and is one of the two main text editors on Unix systems, the other being emacs.

To give an idea of why it’s difficult to learn: Notepad basically has no ‘special features’. You can search, replace, open, save, quit. And that’s basically it. If you want special features, and you want them to be easily accessible, you must be able to perform them with keystrokes rather than a mouse. One option is to use ‘meta keys’, such as alt, windows or ctrl to modify normal keystrokes. For instance, ctrl-s might save. The other option is to have a modal editor, whether one mode allows you to edit, and another allows you to perform unique actions. Vim is a modal editor. In command mode, pressing ‘w’ will skip forward a word. Pressing ‘dd’ will delete a line. The problem is, by default vim probably has over 100 shortcuts, many unintuitive. That’s a steep learning curve, but the end result is massively increased efficiency.

How have I approached this daunting task? For three years, I knew only 6 hotkeys: how to change modes, how to save, how to quit, how to search, and how to get to the end of a file. That’s it, for three years! Embarrassing. I treated the editor as a more obnoxious version of Notepad.

The first step, then, was convincing myself of the power of vim, and why I wanted to learn it. Then, I had to educate myself. I searched around on some popular websites, such as Reddit and StackOverflow. This led me to several tutorials: Derek Wyatt’s Vim Tutorials and Vimcasts. Now I’m watching those tutorials, at a rate of roughly 3/week. Periodically I pause them and try the various keystrokes that have been demoed. After each video completes, I edit a sample file and try to remember all the commands that might seem useful. All of this might be considered active learning, the type of learning that you experience in high school or college: I’m learning, I know I’m learning, and my attention is focused on it.

I also discovered that my IDE at work has a ‘vim mode’. Vim is popular enough that this is an option for many systems. For example, there is Vrapper for Eclipse. I believe emacs also has a way to emulate vim! So, I’ve experimented with this new mode. In a few days, I will permanently enable it in my work IDE. I’m also trying to use ‘optimal’ keystrokes when I open vim itself. For instance, I could press the right arrow 45 times, or I could press ‘$b’ to go to the end of the line and back a word. I would categorize this as passive learning. The idea behind passive learning is to force yourself to learn something by changing your environment – but otherwise not seeking out actual lessons. A similar example might be changing your operating system language when learning a new language, or moving a few miles from work, selling your car, and biking everywhere to get in shape.

These are the current steps I’ve taken. Stay tuned for more updates.

About these ads
Leave a comment

3 Comments

  1. bigatojj

     /  October 12, 2011

    You may also try Pentadactyl, an extension for firefox that makes it behave like vim. I use it all the time, with the gui buttons disabled. I still use mouse a bit, but it enables you to be more efficient in your browsing and even skip mouse at all.

    Reply
  2. m741

     /  October 12, 2011

    I will check it out, thanks! Browsing (and video games) are the two areas where mouse use still dominates for me.

    Reply
  3. Debbie M

     /  November 9, 2011

    There are also online flashcard systems you could probably use to help you efficiently learn whatever vim commands seem useful.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: