How to Learn Vim: A Practical Guide for Developers
Why I Started Learning Vim (And How You Can Too)
There’s a certain type of developer you’ve probably sat next to at some point. No mouse, no file explorer, just a terminal and a blur of keystrokes that somehow produces working code. The first time I watched someone work like that, I couldn’t tell if they were a genius or just showing off. Probably a bit of both.
I never thought I’d become one of those people. For years, my relationship with Vim was limited to accidentally opening it and frantically Googling how to close it. But then terminal-first tools started picking up steam, things like Claude Code and other AI-powered CLI workflows, and I kept running into situations where being comfortable in the terminal would’ve saved me time. At some point it stopped feeling like a niche skill and started feeling like something I was falling behind on.
So Why Learn Vim When We Have Modern Editors?
Here’s the thing most people don’t think about: Vim (or vi) is everywhere. It’s on virtually every Unix-based system you’ll ever SSH into. Every Linux server, every cloud instance. When you’re debugging a production issue at 2 AM and you need to edit a config file on a remote server, nobody’s installing VS Code over SSH. You’re opening vi, making the change, and getting out. That’s it. Knowing Vim turns what could be a stressful scramble into a 30-second fix.
Bram Moolenaar, who created Vim itself, maintained it for over 30 years until his passing in 2023, and the tool he built became so embedded in developer culture that almost every modern editor now has a Vim mode. VS Code, JetBrains, Sublime Text. The keybindings are that good.
But beyond the “it’s everywhere” argument, there’s a real productivity angle too. Vim’s modal editing means your hands never leave the keyboard. Once the muscle memory kicks in, you’re navigating, editing, searching, and replacing text faster than you could with a mouse. It’s not magic, it’s just fewer context switches. Your brain stays in the code instead of constantly reaching for the trackpad. I think the gains are less about raw speed and more about staying in flow. And that’s the part that matters most.
Getting Past the “I Can’t Even Move the Cursor” Phase
So I made it one of my New Year’s resolutions to get better at working inside the terminal and using TUIs properly. As part of that, I started learning Vim, and like most people, the initial experience was rough. The cursor moves with h, j, k, l? Pressing i to type? It felt like learning to drive stick shift after years of automatic.
This time though, instead of grinding through dry tutorials or reading documentation that assumes you already know what a “motion” is, I tried something different.
What Helped Me First: Vim Adventures
Vim Adventures is a browser-based game that teaches Vim through actual gameplay. You navigate a little character through puzzles using Vim keybindings. It sounds silly, but it works well. You learn w to move forward by word, b to go back, e to jump to end of word, all by using them to solve levels. The muscle memory starts building without you even realizing it.
It’s the best starting point I’ve found if you’re completely new to Vim. The first few levels are free, and they cover enough to get you past that initial “I can’t even move the cursor” phase. After that, there’s a paid version that goes deeper into operators, text objects, and more advanced motions. I’d say it’s worth it if you’re serious about learning, but even the free levels give you a solid foundation.
Then I Made a Cheatsheet (Because Muscle Memory Takes a While)
Once I got past the basics with Vim Adventures, I started using Vim more consistently for actual work. And one thing that helped was just having a simple reference nearby. Not some massive 50-page doc, just a compact cheatsheet with the stuff you use day to day.
I put one together and shared it on GitHub. It covers the essentials without being overwhelming:
Modes
Modes are the foundation of Vim. Understanding when you’re in Normal, Insert, Visual, or Command mode is the first thing you need to internalize. Everything else builds on top of this.
| Command | What it does |
|---|---|
i | Enter Insert mode (before cursor) |
a | Enter Insert mode (after cursor) |
v | Enter Visual mode |
V | Enter Visual Line mode |
Esc | Return to Normal mode |
: | Enter Command mode |
Navigation
Navigation is where Vim starts feeling powerful. Once you stop using arrow keys and start thinking in words, lines, and paragraphs, everything clicks.
| Command | What it does |
|---|---|
h j k l | Left, Down, Up, Right |
w | Jump forward one word |
b | Jump backward one word |
e | Jump to end of word |
0 | Jump to beginning of line |
$ | Jump to end of line |
gg | Go to first line of file |
G | Go to last line of file |
:{n} or {n}G | Jump to line number n (e.g. :42 in Command mode, or 42G in Normal mode) |
Ctrl+d | Scroll down half a page |
Ctrl+u | Scroll up half a page |
% | Jump to matching bracket |
Jumping to a specific line is one of those things that feels minor until you’re staring at a stack trace that says “error on line 347”. Once you know :347 just takes you there instantly, you’ll use it all the time.
Enabling and Disabling Line Numbers
By default Vim doesn’t show line numbers, which makes the :42 trick a bit hard to use. You can toggle them on the fly from Command mode:
| Command | What it does |
|---|---|
:set number | Show absolute line numbers |
:set relativenumber | Show relative line numbers (distance from current line) |
:set nonumber | Hide line numbers |
:set norelativenumber | Hide relative line numbers |
Relative line numbers are worth trying. Instead of showing the absolute line number, they show how many lines away each line is from your cursor. So if you want to delete the next 5 lines, you can see at a glance it’s 5dd. A lot of Vim users end up combining both with :set number relativenumber, which shows the absolute number on the current line and relative numbers everywhere else.
If you want line numbers on every time you open Vim, add this to your ~/.vimrc:
set number
set relativenumber
Editing
In Normal mode, every key is a command. You can delete, copy, and rearrange text without ever reaching for a menu. This is where the modal approach starts paying off in a real way.
| Command | What it does |
|---|---|
x | Delete character under cursor |
dd | Delete entire line |
dw | Delete word |
d$ | Delete to end of line |
yy | Copy (yank) entire line |
yw | Copy word |
p | Paste after cursor |
P | Paste before cursor |
u | Undo |
Ctrl+r | Redo |
ciw | Change inner word (delete word and enter Insert mode) |
ci" | Change inside quotes |
>> | Indent line |
<< | Unindent line |
Working with Files
These are the commands you’ll use constantly. Saving, quitting, opening files. Worth memorizing on day one.
| Command | What it does |
|---|---|
:w | Save file |
:q | Quit |
:wq | Save and quit |
:q! | Quit without saving |
:e filename | Open a file |
:sp filename | Open file in a horizontal split — keeps your current file open in the top pane |
:vsp filename | Open file in a vertical split — keeps your current file open in the left pane |
Search and Replace
Search in Vim is fast once you get used to it. The replace syntax looks intimidating at first but follows a consistent pattern once you’ve used it a few times.
| Command | What it does |
|---|---|
/pattern | Search forward |
?pattern | Search backward |
n | Next match |
N | Previous match |
:%s/old/new/g | Replace all occurrences in file |
:%s/old/new/gc | Replace all with confirmation |
:s/old/new/g | Replace all in current line |
Visual Mode
Visual mode lets you select text and then operate on it. If you’re coming from a traditional editor, this will feel the most familiar since it’s closer to click-and-drag selection.
| Command | What it does |
|---|---|
v | Start character-wise selection |
V | Start line-wise selection |
Ctrl+v | Start block selection |
d | Delete selection |
y | Yank (copy) selection |
> | Indent selection |
< | Unindent selection |
You can find the full cheatsheet repo here: Vim Cheatsheet on GitHub
If You’re Starting Out, Here’s a Rough Roadmap
I think the mistake most people make with Vim is trying to learn everything at once. You don’t need to memorize 200 commands on day one. Start with movement (h, j, k, l, w, b), learn how to enter and exit Insert mode, and figure out how to save and quit. That’s enough to be functional. Everything else builds on top of that foundation over time.
If you want a rough roadmap, here’s what worked for me:
- Play through Vim Adventures to build basic muscle memory
- Keep a cheatsheet open while you work (the one above or your own)
- Start using Vim for small edits, commit messages, quick config changes
- Gradually increase usage as commands become second nature
- Eventually explore Neovim and plugins when vanilla Vim starts feeling limiting
The whole point isn’t to become a Vim wizard overnight. It’s to get comfortable enough that when you’re SSH’d into a server, or working in a terminal-first tool, or pair programming with someone who lives in the terminal, you’re not the person who can’t move the cursor. The bar is lower than you think, and getting there is kind of fun once you stop fighting it.