Barbarian Meets Coding

presents

Boost Your Coding Fu With VSCode and Vim
Chapter 5.Table of ContentsCheatsheet

Baby Steps in Vim

Rectangle shaped cursor… Curious! If you try to type text right now you’ll be surprised to see that nothing happens. Or to be more precise, nothing that you would have expected to happen happens. That is, as you type there are no characters being typed in the screen. That’s because the core mode in Vim is Normal mode and not Insert mode.

In fact, if you look closely to your status bar you’ll notice something that wasn’t there earlier:

Yes. You are in Normal mode. In this mode you don’t insert text. Instead, you move around and edit it. This design decision stems from the realization that we spend far more time reading, navigating and changing code that we do inserting it in the first place.

These are the very basics you need to survive in Vim:

  • Move around with the hjkl keys
  • Go into Insert mode with i where you can type stuff as usual
  • Go back to Normal mode with <ESC>, <CTRL-C> or <CTRL-[>

The Most Basic of Vim Motions

hjkl are the core and most basic motions in Vim. They allow you to move the cursor by one space in every direction:

           ^
           |
           |
   <-- h j k l -->
         |
         |
         v

They are not the most effective, nor the most efficient way to move around in Vim. But they do give you agility and confidence to move around a file in Normal mode. Learning to hjkl effectively is the equivalent of learning to walk, or learning to ride a bike.

After you get comfortable with more Vim motions you won’t use hjkl as much, but they’ll come very handy for short-distance movements and small corrections. j and k are also very useful within the file explorer, the command palette and the Go To panes as they allow you to move up and down and select different items.


  1. In Windows I’ve used KeyTweak in the past. Long before I joined the hordes of Apple fanboys (and fangirls) and other hipster creatures and got myself a Mac.


Jaime González García

Written by Jaime González García , Dad, Husband, Front-end software engineer, UX designer, amateur pixel artist, tinkerer and master of the arcane arts. You should follow him on Twitter where he shares useful stuff! (and is funny too).Jaime González García