Learning Vim: Where To Get Started


Introduction

You have probably already heard of vim, and all of its wondorous powers of keyboard wizardry, speed and customization. Otherwise, you wouldn't be here. I have written this post for the fresh vim-curious mind. If you have arrived here because you can't figure out how to quit vim, just hit <Esc> :q! and be on your way. At this point I assume you have decided to give yourself fully to the warm, loving embrace of vim, but have no idea where to start and it seems confusing and complicated. I would be lying if I said it was easy. I've been learning and utilizing vim for 3 years, and have only now switched to using vim as my primary editor in the past year. This post will talk about some of the resources I used along the way. Hopefully this will help you on your way to become a vim master.

Side Effects

Before we get started I just need to make sure you understand what you are getting yourself into. As I've recently gone through these changes myself. Once you have begun to develop the muscle memory for vim movement and actions, you will begin to depise editors that don't offer this functionality. You will scoff when you have reach for your mouse. You will demand keyboard shortcuts! The terminal will begin to feel like your one and only home, and you'll never want to leave. Are you prepared to undergo these physiolocgial changes? Good. Lets continue....

The Journey Begins

When I first started I only knew the bare minimum so I could edit a configuration file on a remote server and thought vim was cryptic and stupid. The first time I heard someone used only vim, I figured they were some puriest who hated IDEs and auto-complete.

The Adventure

When I first began to truly use vim, the first place I went was Vim Adventures. This does a great job of gamifying learning the basic movements of vim and I personally found it a great place to start. I never bought a license, but played through the first level a few times. If you have $25 to toss at a license, I'd say go for it. In the beginning I wasn't sure I'd continue to learn vim and didn't want to waste the money.

Tutoring

Next, I went to a vim tutor. Not a human one, but one that is provided by vim. Its almost an industry secret that vim ships with this helpful guide. Assuming you have vim installed, you can simply run vimtutor in your favorite terminal. This will seem pretty dry after playing vim-adventures, but will still help you to learn more. If you bought the license for vim-adventures, then this probably won't teach you anything new. However, it might be good practice to run through it.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        Lesson 1.1:  MOVING THE CURSOR


   ** To move the cursor, press the h,j,k,l keys as indicated. **
             ^
             k              Hint:  The h key is at the left and moves left.
       < h       l >               The l key is at the right and moves right.
             j                     The j key looks like a down arrow.
             v
  1. Move the cursor around the screen until you are comfortable.

  2. Hold down the down key (j) until it repeats.
     Now you know how to move to the next lesson.

  3. Using the down key, move to lesson 1.2.

NOTE: If you are ever unsure about something you typed, press <ESC> to place
      you in Normal mode.  Then retype the command you wanted.

NOTE: The cursor keys should also work.  But using hjkl you will be able to
      move around much faster, once you get used to it.  Really!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use What You Have Learned

Now what? We know how to move about and do cool things inside vim we never thought possible. But switching to simply vim doesn't seem all the appetizing if you've been working in an IDE like IntelliJ or VSCode up until now.

My secret was IDE plugins. Most of the popular IDEs, have plugins/addons that will import vim key bindings into your favorite IDE. Now you can continue work inside your favorite IDE and unleash "some" of the power of vim without losing that sweet auto-complete. Its also a way to practice before calling vim your home.

Now for awhile, I thought I would never move past this point. I figured, use the power of an IDE but still get all the great vim bindings. I personally think this is a great place to be if you're not one to spend tons of time to configure and personalize your editor. Because the next step after learning all this is configuring your vim to work more like an IDE.

Bonus Vim! If you're craving using your mouse less, then I have some good news for you! For a mouseless browser experience check out Vimium. Vimium is a chrome browser extension that brings vim-like key bindings to the browser. Allowing you navigate and search without having to reach for your mouse. I don't always use it, but I definitely love having the option. Don't like Chrome? No Problem! There is a port for Firefox as well Vimium-FF.

Make Vim Awesome

When you're ready you move past this point, you will be journeying into the world of vim plugins and configuration. I haven't found anyone better at explaining vim setup and usage other than The Primeagen. When it comes to configuring and making the move to being fully vim their channel has been invaluable. They may even convince you to use Neovim.

Conclusion

I hope this post has provided you with some insight into getting started on your journey to become a vim master. These are the resources I used to get to where I am today. The most valuable part of learning vim for me was igniting the interest into customizing my development experience. If you found this helpful or have any questions feel free to dm, or tweet @natsirtremraf.

Referenced Resources

Learning

IDE Plugins

Browser Extensions

tristanfarmer.dev by Tristan Farmer