Surviving Vim: The Absolute Basics
Surviving Vim: The Absolute Basics
You open Neovim. You type something. Nothing appears. You press Backspace. Nothing. You try Ctrl+C. Nothing. You try clicking. Your mouse is irrelevant here. You press Esc seventeen times and finally manage to exit by closing the terminal.
Sound familiar?
You’re not stupid. This is just how Vim works. And once you understand the model behind it, these “WTF moments” transform into something else entirely: precision. In this tutorial we’re going to cover the absolute minimum you need to survive Vim without wanting to throw your computer out the window.
The four modes (and why they exist)
Every text editor you’ve ever used operates in a single mode: you type, and text appears. Vim is different. It separates the act of typing from the act of navigating and editing. This is the modal editing model, and it’s the core idea of the whole course.
Vim has four main modes:
| Mode | How to enter | What you do here |
|---|---|---|
| Normal | Esc or Ctrl+[ | Navigate, copy, paste, delete |
| Insert | i, a, o, and others | Type text like a normal editor |
| Visual | v, V, Ctrl+v | Select text |
| Command | : | Run commands (save, quit, search…) |
When you open Neovim, you’re in Normal mode. This is intentional. Vim assumes you spend most of your time navigating and editing code — not typing new text from scratch. Normal mode is home base.
Think of it like a surgeon: they don’t walk around the operating room with a scalpel in their hand at all times. The tool comes out only when it’s needed. Normal mode is “hands empty, observing.” Insert mode is “scalpel out, cutting.”
Switching between modes
The most important key in Vim is Esc. It takes you back to Normal mode from anywhere. If you’re ever lost, press Esc (once, or twice for good measure) and you’re home.
Normal ──(i / a / o)──→ Insert
Normal ──(:)──────────→ Command
Normal ──(v / V)──────→ Visual
Insert ──(Esc)────────→ Normal
Command ──(Esc / Enter)→ Normal
Visual ──(Esc)────────→ Normal
Memorize this: Esc always brings you back to Normal mode.
Quitting Vim (the eternal meme)
Let’s solve the most famous problem in software development first.
In Normal mode, type : to enter Command mode. You’ll see a : appear at the bottom of the screen. Now type:
:q— quit (only works if there are no unsaved changes):q!— quit without saving (the!forces it):w— save (write) the file:wq— save and quit:x— save and quit (only writes if there are actually changes)ZZ— save and quit (shortcut, no colon needed)
For the “I just want out of here” scenario: :q!. That’s your escape hatch. Always.
:q!
(Neovim closes. You're free.)
⚠️ :q! discards all unsaved changes. If you’ve been editing a file for an hour and you type :q!, it’s gone. Use :w first if you want to keep your work.
Basic navigation: hjkl
In Normal mode, you navigate with the keyboard — no mouse, no arrow keys (well, arrow keys work too, but Vim users frown upon it). The home row navigation keys are:
| Key | Direction |
|---|---|
h | Left |
j | Down |
l | Right |
k | Up |
Why hjkl? Because they’re on the home row of a QWERTY keyboard, right under your right hand. You never have to move your hand to a separate arrow key cluster. It sounds silly until you’ve been doing it for a few weeks and your hands never leave the keyboard.
If you can’t remember which is which: j looks like an arrow pointing down. h is left (it’s to the left of j). From there, k must be up and l must be right.
k
h l
j
Don’t force yourself to use only hjkl from day one. If you need to use arrow keys for now, go ahead. You’ll naturally switch as you practice.
More navigation commands
Once hjkl is in your muscle memory, you’ll want faster ways to move:
0— go to the start of the line$— go to the end of the linegg— go to the first line of the fileG— go to the last line of the fileCtrl+d— scroll half a page downCtrl+u— scroll half a page up
And to jump to a specific line number, type :<number> and press Enter. To go to line 42:
:42
Entering Insert mode
Now that you can navigate, let’s type some text. There are several ways to enter Insert mode — each one places the cursor differently:
i— insert before the cursora— insert after the cursorI— insert at the start of the lineA— insert at the end of the lineo— open a new line below and enter Insert modeO— open a new line above and enter Insert mode
For now, just remember i (before) and o (new line below). Those two get you through 80% of daily editing.
Once in Insert mode, you’ll see -- INSERT -- at the bottom of the screen. Now you can type normally. Press Esc when you’re done to return to Normal mode.
The workflow looks like this:
- Navigate to where you want to edit (Normal mode)
- Press
ioroto enter Insert mode - Type your text
- Press
Escto return to Normal mode - Navigate to the next thing you want to change
- Repeat
This feels slow at first. It’s not. Once it’s in your hands, it’s dramatically faster than keeping your fingers on a mouse — but that comes with practice.
Basic editing
Still in Normal mode, you can delete and manipulate text without entering Insert mode at all:
x— delete the character under the cursordd— delete the entire current lineu— undo the last changeCtrl+r— redo (undo the undo)
These work instantly, no Insert mode needed. Navigate to a character, press x, it’s gone.
Your first real edit
Let’s put it all together. Open Neovim with a new file:
nvim practice.txt
Now follow these steps:
- You’re in Normal mode. Press
ito enter Insert mode. - Type:
Hello, Vim! - Press
Escto go back to Normal mode. - Press
oto open a new line below. - Type:
This is my first edit. - Press
Esc. - Type
:wand press Enter to save. - Now navigate up with
k, then delete the line withdd. - Press
uto undo the deletion. - Type
:wqto save and quit.
Congratulations — you just survived Vim.
Key concepts from this lesson
- Vim has four modes: Normal, Insert, Visual, Command. You start in Normal.
Escalways returns you to Normal mode.:q!quits without saving.:wqsaves and quits.hjklfor navigation: h←, j↓, k↑, l→iinserts before cursor,oopens a new line below.dddeletes a line,uundoes,Ctrl+rredoes.- Normal mode is home. You live there. You visit Insert mode briefly.
You can now open Neovim, make edits, save your work, and quit without panicking. That’s real progress — most people quit Vim before reaching this point.
But we’ve only scratched the surface of what Normal mode can do. In the next tutorial, we’ll explore Normal mode’s real power: word movements, the Vim grammar (operator + motion), and how combining just a handful of commands gives you near-infinite editing combinations.
Never stop coding!