Vim Basics: Modes, Buffers & Splits
So you’ve figured out how to exit Vim — congrats, you’ve already survived the hardest part (according to the internet, at least). But if you want to actually use Vim instead of just escaping it, understanding a few core concepts will make everything click. Think of this as the “aha, that’s why it works that way” page.
Modes — the big idea
Most editors work one way: you type, text appears. Vim is different. It has modes, and each mode gives your keyboard a different job. This is what makes Vim powerful — and what confuses beginners.
Here are the four modes you’ll use every day:
NORMAL
mode — This is home base. When you open Vim, you’re here. Keys don’t type text — they navigate, delete, copy, and run commands. Press Esc from any other mode to get back here.
INSERT
mode — Now your keys type text, like a normal editor. Enter it with i (insert before cursor), a (append after cursor), or o (open new line below). Press Esc to return to
NORMAL
.
VISUAL
mode — For selecting text. Press v for character selection, V for whole lines, or Ctrl+v for block selection. Once selected, you can delete (d), copy (y), or change (c) the selection.
COMMAND
mode — Press : in
NORMAL
mode to open the command line at the bottom of the screen. This is where you type commands like :w (save), :q (quit), and :s/old/new/g (replace).
Switching between modes
| From | To | How |
|---|---|---|
| Any mode | NORMAL | Esc |
| NORMAL | INSERT | i, a, o, I, A, O |
| NORMAL | VISUAL | v, V, Ctrl+v |
| NORMAL | COMMAND | : |
Buffers
When you open a file in Vim, it gets loaded into a buffer — an in-memory copy of the file. You can have many buffers open at once, even if you only see one on screen.
| Command | What it does |
|---|---|
:ls |
List all open buffers |
:bn |
Go to the next buffer |
:bp |
Go to the previous buffer |
:bd |
Close the current buffer |
:e filename |
Open a file in a new buffer |
Windows (splits)
Want to see two files side by side? Vim lets you split your screen into windows, each showing a different buffer (or the same one).
| Command | What it does |
|---|---|
:sp |
Horizontal split |
:vsp |
Vertical split |
Ctrl+w h/j/k/l |
Move between splits (left/down/up/right) |
Ctrl+w c |
Close current split |
Ctrl+w = |
Make all splits equal size |
Tabs
Tabs in Vim are like workspaces — each tab can contain its own arrangement of splits and buffers. They’re useful for organizing different tasks.
| Command | What it does |
|---|---|
:tabnew |
Open a new tab |
:tabc |
Close current tab |
gt |
Go to next tab |
gT |
Go to previous tab |
The command line
Whenever you press : in
NORMAL
mode, you enter
COMMAND
mode. The command line is incredibly powerful — here are some essentials:
| Command | What it does |
|---|---|
:w |
Save the file |
:q |
Quit |
:wq |
Save and quit |
:help keyword |
Open Vim’s built-in help |
:set number |
Show line numbers |
:%s/old/new/g |
Replace “old” with “new” everywhere |
What’s next?
Now that you know how Vim thinks, you’re ready to get productive:
- Vim Shortcuts — your cheat sheet for the most useful commands
- Why Vim? — still not sure if Vim is worth learning? Read this