Understanding Modes
Modes are the cornerstone of Vim/Neovim's design. Each mode gives your keyboard keys a different meaning. Fluency in modes is the foundation of efficient editing.
In Normal mode, keys are commands. In Insert mode, keys type text. You should spend most of your time in Normal mode and only enter Insert mode when actually adding new text.
Mode Overview
stateDiagram-v2
direction TB
NORMAL: Normal Mode\n(navigation + commands)
INSERT: Insert Mode\n(typing text)
VISUAL: Visual Mode\n(selecting text)
VLINE: Visual Line Mode\n(select full lines)
VBLOCK: Visual Block Mode\n(rectangular selection)
COMMAND: Command-line Mode\n(:commands)
REPLACE: Replace Mode\n(overwrite text)
OPEND: Operator-pending\n(waiting for motion)
[*] --> NORMAL: nvim opens
NORMAL --> INSERT: i/I/a/A/o/O/s/S/c...
INSERT --> NORMAL: Esc / Ctrl+c
NORMAL --> VISUAL: v
NORMAL --> VLINE: V (shift+v)
NORMAL --> VBLOCK: Ctrl+v
VISUAL --> NORMAL: Esc
VLINE --> NORMAL: Esc
VBLOCK --> NORMAL: Esc
NORMAL --> COMMAND: :
COMMAND --> NORMAL: Enter / Esc
NORMAL --> REPLACE: R
REPLACE --> NORMAL: Esc
NORMAL --> OPEND: d / c / y / ...
OPEND --> NORMAL: motion completes
1. Normal Mode — Your Home Base
Normal mode is the default. Every key press triggers a command — move, delete, yank, search.
You can tell you're in Normal mode: no mode indicator at bottom left
(or "NORMAL" if you have a status line configured)
Essential Normal Mode Keys
| Key | Action |
|---|---|
h j k l | Move left/down/up/right |
w / b | Next / previous word start |
e | Next word end |
0 / $ | Line start / end |
^ | First non-blank character |
gg / G | File start / end |
Ctrl+d / Ctrl+u | Scroll half page down/up |
Ctrl+f / Ctrl+b | Scroll full page down/up |
dd | Delete current line |
yy | Yank (copy) current line |
p / P | Paste after / before |
u | Undo |
Ctrl+r | Redo |
x | Delete character under cursor |
/pattern | Search forward |
n / N | Next / previous match |
. | Repeat last change |
2. Insert Mode — When You Actually Type
Enter Insert mode to add or modify text. Exit with Esc.
How to Enter Insert Mode
| Key | Where cursor ends up |
|---|---|
i | Before cursor |
a | After cursor |
I | Start of line (first non-blank) |
A | End of line |
o | New line below, cursor there |
O | New line above, cursor there |
s | Delete char, enter insert |
S | Delete line, enter insert |
gi | Re-enter insert at last insert position |
Insert Mode Shortcuts
Even in Insert mode, some shortcuts are available without leaving:
| Key | Action |
|---|---|
Ctrl+h | Delete previous character (backspace) |
Ctrl+w | Delete previous word |
Ctrl+u | Delete to start of line |
Ctrl+n / Ctrl+p | Next/previous autocomplete suggestion |
Ctrl+t | Indent current line |
Ctrl+d | Un-indent current line |
Ctrl+r {reg} | Insert contents of register |
Ctrl+o {cmd} | Execute one Normal mode command, return to Insert |
Ctrl+o lets you run one Normal mode command without leaving Insert mode. Ctrl+o A jumps to end of line and returns to Insert. Ctrl+o dd deletes a line and returns to Insert.
3. Visual Mode — Select and Act
Visual mode lets you select text, then apply operators to the selection.
| Key | Mode |
|---|---|
v | Character-wise visual |
V | Line-wise visual |
Ctrl+v | Block (column) visual |
gv | Re-select previous selection |
In Visual Mode
Select with motions, then apply operators:
v3w → Select 3 words
V5j → Select 5 lines
Ctrl+v 3j → Select 3 rows of a column
Then:
d → delete selection
y → yank selection
c → change selection
> → indent selection
< → un-indent selection
~ → toggle case
u → lowercase
U → uppercase
Visual Block (Column Editing)
flowchart LR
SRC["Line 1\nLine 2\nLine 3"] --> VBLOCK["Ctrl+v → select column\nI → insert before column\nA → insert after column"]
VBLOCK --> RESULT["PREFIX Line 1\nPREFIX Line 2\nPREFIX Line 3"]
Example — add // comment prefix to 3 lines:
Ctrl+v → Block visual start
2j → Select 3 lines down
I → Insert before block
// → Type the prefix
Esc → Apply to all lines
4. Command-line Mode — Running Commands
Entered via :. Used for file operations, settings, and search/replace.
| Command | Action |
|---|---|
:w | Write (save) |
:q | Quit |
:wq | Write and quit |
:q! | Force quit without saving |
:e filename | Open/edit file |
:vs | Vertical split |
:sp | Horizontal split |
:%s/old/new/g | Global search and replace |
:set number | Enable line numbers |
:help {topic} | Open help |
5. Replace Mode
Replace mode overwrites characters as you type (like Insert with the Insert key in other editors):
R → Enter Replace mode
Backspace → Undo the replacement
Esc → Return to Normal mode
Checking Current Mode
Look at the bottom-left of the Neovim window:
| Display | Mode |
|---|---|
(empty or NORMAL) | Normal |
-- INSERT -- | Insert |
-- VISUAL -- | Visual |
-- VISUAL LINE -- | Visual Line |
-- VISUAL BLOCK -- | Visual Block |
-- REPLACE -- | Replace |
Mode Switching Quick Reference
flowchart LR
N[Normal] -->|i a o O I A| I[Insert]
I -->|Esc| N
N -->|v| V[Visual]
N -->|V| VL[Visual Line]
N -->|Ctrl+v| VB[Visual Block]
V -->|Esc| N
VL -->|Esc| N
VB -->|Esc| N
N -->|:| C[Command]
C -->|Enter/ Esc| N
Common Mode Mistakes
| Mistake | What it looks like | Fix |
|---|---|---|
| Typing in Normal mode | Commands fire instead of text | Press u to undo, then i to insert |
| Stuck in Command mode | : at bottom | Press Esc |
| Forgot you're in Insert | Motions type letters | Press Esc |
| Ctrl+c vs Esc | Can leave pending operations | Use Esc as default; Ctrl+c for interruptions |