Jako Heiberg
HomeInsightsMusingsPortfolioAboutContact
Jako Heiberg

From DBase III+ to edge computing.
The journey continues.

Pages

  • About
  • Portfolio
  • Resume / CV
  • Insights
  • Musings
  • Archive
  • Contact

© 2026 Jako Heiberg · Cape Town, South Africa · UTC+2

Built with React + Cloudflare Workers. No PHP was harmed.

Back to Insights
Insights

Vim From Scratch — Part 2: Modal Editing, and Why Modes Are a Feature

Every other editor lets you type text the moment you open it. Vim makes you ask for permission first. This sounds insane until you realise it's the reason Vim can do so much with so few keys.

August 26, 2026
5 min read
Technology

The thing that trips up every newcomer, without exception, is that Vim doesn't let you just start typing. You open a file, you press h, and instead of an h appearing on screen, your cursor moves left. This feels broken. It is not broken. It is the single idea the entire editor is built on, and once it clicks, you'll wonder why other editors don't work this way.

The core idea: keys mean different things at different times

In a normal editor, letter keys always type letters. That means every command has to be a modifier combination — Ctrl+C, Ctrl+V, Ctrl+Shift+K, and your fingers slowly tie themselves in knots. Vim makes a different trade. It separates the time you spend typing text from the time you spend editing text, and it turns out those are genuinely different activities. You spend far less time inserting new characters than you'd guess — most editing is moving, deleting, copying, and rearranging text that already exists.

So Vim gives editing its own mode, where the whole keyboard is free to be commands, and typing its own mode, where keys are just keys.

The modes you'll actually use

Normal mode is home. This is where Vim starts, and where you'll spend most of your time. Here, letters are commands: h j k l move, d deletes, y copies ("yanks"), w jumps a word forward. When you're not actively typing new text, you should be in Normal mode. Get in the habit of returning here — tap Escape (or Ctrl+[, which is the same thing and closer to home) whenever you finish an edit.

Insert mode is where you type text like a normal person. You enter it deliberately, from Normal mode, and there are several ways in — and which one you pick is itself a small editing decision:

  • i — insert before the cursor
  • a — insert after the cursor (append)
  • I — insert at the first non-blank character of the line
  • A — insert at the end of the line
  • o — open a new line below and start typing
  • O — open a new line above

Notice these already form a little pattern: lowercase near the cursor, uppercase for the extremes of the line. That pattern — lowercase local, uppercase bigger — repeats all over Vim.

Visual mode is for selecting text, which you'll want when a command should apply to exactly the range you can see. v starts a character-wise selection, V selects whole lines, and Ctrl+V selects a rectangular block (genuinely magic for columns of text). Move around to extend the selection, then hit an operator like d or y to act on it.

Command-line mode is what you enter by pressing : from Normal mode. That opens a line at the bottom where you type longer commands: :w to write (save), :q to quit, :wq to do both, :%s/old/new/g to find and replace. This is the old ex editor living inside Vim, and it's powerful enough that Part 8 is dedicated to it.

Getting out of trouble

The universal panic button is Escape. Whatever mode you're in, whatever half-finished command you've started, Escape gets you back to Normal mode. When you're lost — and you will be, early on — mash Escape a couple of times and you're home.

The essential survival kit:

  • Escape — back to Normal mode
  • i — start typing
  • :w then Enter — save
  • :q then Enter — quit
  • :wq — save and quit
  • :q! — quit and throw away changes
  • u — undo (and Ctrl+R to redo)

Why this is worth the discomfort

Here's the payoff, and it's the whole reason to endure the awkward first days. Because Normal mode keys are commands, Vim can offer a huge command vocabulary without a single chord. And because those commands compose — which is the subject of Part 4 — a handful of keys combine into thousands of precise edits. Deleting to the end of a line is D. Changing the word under your cursor is ciw. Duplicating a line is yyp. None of these need a modifier key, none need the mouse, and all of them will one day flow out of your fingers faster than you can describe them.

The mode you're in is the context that gives every other key its meaning. Right now that feels like a burden — one more thing to track. Soon it'll be invisible, the way you don't consciously think about whether Caps Lock is on. Your fingers will know. And when they do, the fact that Vim asked permission first stops being an annoyance and starts being the thing that makes it fly.

Next up: now that you can get around modes, let's learn to actually move — the motions that let you fling the cursor exactly where you want it without ever touching an arrow key.

Jako Heiberg

Software developer with 40+ years of building things that work. Full-stack, FastAPI, React. Based in Cape Town, working remotely, worldwide.

Related Posts

Insights

The Long Game: Staying Employable Without Burning Out

A software career is a forty-year marathon disguised as a series of sprints. Here is how to keep learning without chasing every shiny thing, and keep going without burning to the ground.

August 19, 2026
6 min read
Insights

Your First Job: What Nobody Warns You About

You got in. Now everyone else seems to know things you do not, the real codebase is a horror, and you are convinced they will realise they made a mistake hiring you. Good news: all of that is completely normal.

August 12, 2026
6 min read
Insights

Surviving the Technical Interview

The technical interview tests a strange, artificial skill that barely resembles the actual job - which is exactly why you can prepare for it and get good at it. Here is how, without losing your mind.

August 3, 2026
6 min read