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
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)
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
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 |