Before You Start
Why Vim feels broken the first time you open it
You open a file. You start typing your name. Instead of letters appearing,
the file starts deleting itself, jumping around, or beeping at you. This
happens to almost everyone the first time, and it happens for one reason:
Vim is not a text box. It’s a set of tools you switch between, and typing
j doesn’t mean “the letter j” until you tell Vim you want it to.
That’s modal editing. Most editors have one mode: you click somewhere, you
type, letters appear. Vim has several modes, and each one gives your
keyboard a different job. In one mode, d deletes. In another, d types
the letter d. Same key, different meaning, depending on which mode you’re
in.
This sounds like a strange design choice until you’ve used it for a week. Here’s the short version of why people stick with it: once your keyboard isn’t reserved for typing letters, every key becomes a command. Moving to the next paragraph, deleting three words, swapping two lines: all of that becomes a couple of keystrokes instead of reaching for a mouse or holding arrow keys. It’s a trade. You spend a little time up front learning what mode you’re in and what the keys do there, and you get a lot of speed back later.
What this book won’t do
It won’t try to convince you Vim is objectively better than every other editor. It isn’t, for every task, for every person. What it will do is get you through the part where Vim feels hostile, so you can decide for yourself whether the trade is worth it once you’re actually fluent.
It also won’t cover everything. This is a beginner’s book, not a reference
manual. You’ll learn enough to edit real files comfortably: move around,
change text, save, search, work with more than one file. Advanced stuff
like macros or scripting Vim itself isn’t here. Once you’re through this
book, :help and a search engine will get you the rest.
A note on frustration
You will, at some point in the first couple of chapters, get stuck in a
mode you don’t understand and not know how to get out. The fix is almost
always the same key: press Esc. It’s the emergency exit. If you forget
everything else from this chapter, remember that one.
Try it
- Open a terminal and run
vimwith no file name, just to see it launch. - Type a few letters. Watch what happens (it probably won’t be what you expect).
- Press
Esc, then type:q!and hit Enter. This quits without saving, which is exactly what you want for this experiment. - Notice how you felt during step 2. That confusion is normal, and it goes away fast once you learn what mode you were in, which is the whole subject of the next chapter.