Skip to main content

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.

Core Idea

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

KeyAction
h j k lMove left/down/up/right
w / bNext / previous word start
eNext word end
0 / $Line start / end
^First non-blank character
gg / GFile start / end
Ctrl+d / Ctrl+uScroll half page down/up
Ctrl+f / Ctrl+bScroll full page down/up
ddDelete current line
yyYank (copy) current line
p / PPaste after / before
uUndo
Ctrl+rRedo
xDelete character under cursor
/patternSearch forward
n / NNext / 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

KeyWhere cursor ends up
iBefore cursor
aAfter cursor
IStart of line (first non-blank)
AEnd of line
oNew line below, cursor there
ONew line above, cursor there
sDelete char, enter insert
SDelete line, enter insert
giRe-enter insert at last insert position

Insert Mode Shortcuts

Even in Insert mode, some shortcuts are available without leaving:

KeyAction
Ctrl+hDelete previous character (backspace)
Ctrl+wDelete previous word
Ctrl+uDelete to start of line
Ctrl+n / Ctrl+pNext/previous autocomplete suggestion
Ctrl+tIndent current line
Ctrl+dUn-indent current line
Ctrl+r {reg}Insert contents of register
Ctrl+o {cmd}Execute one Normal mode command, return to Insert
The Ctrl+o Trick

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.

KeyMode
vCharacter-wise visual
VLine-wise visual
Ctrl+vBlock (column) visual
gvRe-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.

CommandAction
:wWrite (save)
:qQuit
:wqWrite and quit
:q!Force quit without saving
:e filenameOpen/edit file
:vsVertical split
:spHorizontal split
:%s/old/new/gGlobal search and replace
:set numberEnable 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:

DisplayMode
(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

MistakeWhat it looks likeFix
Typing in Normal modeCommands fire instead of textPress u to undo, then i to insert
Stuck in Command mode: at bottomPress Esc
Forgot you're in InsertMotions type lettersPress Esc
Ctrl+c vs EscCan leave pending operationsUse Esc as default; Ctrl+c for interruptions

What's Next