Command versus Insert mode

Broadly speaking, vim has three modes: “normal”, “command”, and “insert”.

Normal mode

When you first start vim you end up here. This is the mode you start in, for example if you get dumped here after running a git command or running vim manually.

In here you can scroll up and down, move the cursor around, and do some editing like cutting text or deleting lines.

Command mode

When you want to leave vim you go into “command” mode by pressing : (the colon character).

In this mode, at the bottom left you’ll see a : with a blinking cursor to the right of it. If you type things, they show up there.

To get out of “command” mode, back into “normal” mode, usually you can press the “Escape” key. (Pressing the “Escape” key while in “normal” mode does nothing, so you can press it as many times as you want.)

Insert mode

This is the mode you’ll usually want to be in to edit text, such as changing git commit messages. You can tell you’re in “insert” mode because this shows up at the bottom of the editor:

-- INSERT --

You get into “insert” mode from “normal” mode by pressing the i key. You get out of “insert” mode (back into “normal” mode) by pressing the “Escape” key.

Normal people will use the arrow keys to move around, backspace and delete to edit, and ctrl+v / cmd+v to paste. You can’t use the mouse to select text to delete, you have to use other commands or hit backspace/delete a bunch of times.

Bonus: “easy” mode

If you are unlucky, you’ll get into vim and you’ll be in so-called “easy” mode, which basically means you started in “insert” mode.

Just hit the “Escape” key and you’ll end up in “normal” mode.

Bonus: split panel

Sometimes you’ll end up in some crazy view that has a big bar in the middle–this is a view with two editor panels.

You can press the “control” key and the w key twice to switch back and forth between panels. (The text in the bars get slightly bigger when the panel is selected.)

You can close a selected panel by pressing o while in command mode.

Or… you can press the “Escape” key a couple times, try to exit vim, and then start over. That’s what I still do, sometimes.