Nvim Session 01: Insert Mode Controls

You already know these commands from terminal readline/vi-mode. This session maps that muscle memory to Neovim insert mode.

Pre-Session State

  • Heavy terminal user with vi-mode in zsh/bash

  • Know Ctrl-w and Ctrl-u from command line

  • Realize these work in Neovim insert mode

The Readline Connection

Your terminal uses readline (bash) or zle (zsh) with vi-mode. Neovim’s insert mode shares much of this DNA. Commands you’ve been using for years work identically.

Terminal Neovim Effect

Ctrl-w

Ctrl-w

Delete word backward

Ctrl-u

Ctrl-u

Delete to line start

Ctrl-h

Ctrl-h

Backspace (same as <BS>)

Ctrl-[

Ctrl-[

Escape to normal mode

Lesson 1: Deletion Controls

Concept: Delete text without leaving insert mode.

Exercise 1.1: Word deletion with Ctrl-w

Open Neovim and enter insert mode:

i

Type this line:

The quick brown fox jumps over

Now press Ctrl-w repeatedly:

Ctrl-w  → "The quick brown fox jumps "
Ctrl-w  → "The quick brown fox "
Ctrl-w  → "The quick brown "
Ctrl-w  → "The quick "

Muscle memory: Same as terminal. Delete back one word at a time.

Exercise 1.2: Line deletion with Ctrl-u

In insert mode, type:

This entire line will disappear

Press Ctrl-u:

Ctrl-u  → (empty line)

Note: Deletes from cursor to line start, not entire line if cursor is mid-line.

Exercise 1.3: Single character with Ctrl-h

Type:

Helllo World

Position matters - Ctrl-h deletes character before cursor:

Ctrl-h  → "Helllo Worl"
Ctrl-h  → "Helllo Wor"

Equivalent to: Backspace key. Use whichever your fingers prefer.

Lesson 2: The Normal Mode Escape Hatch

Concept: Ctrl-o executes ONE normal mode command, then returns to insert.

Exercise 2.1: Basic Ctrl-o usage

In insert mode with cursor mid-line:

The quick |brown fox

Execute normal mode commands without leaving insert:

Ctrl-o w     " Jump forward one word, return to insert
Ctrl-o b     " Jump back one word, return to insert
Ctrl-o $     " Jump to end of line, return to insert
Ctrl-o 0     " Jump to start of line, return to insert

Exercise 2.2: Ctrl-o with deletion

Delete to end of line without leaving insert:

Ctrl-o D     " Delete to end of line
Ctrl-o dw    " Delete word forward
Ctrl-o db    " Delete word backward

Power move: Ctrl-o D is readline’s Ctrl-k equivalent (kill to end).

Exercise 2.3: Ctrl-o with navigation

Ctrl-o gg    " Jump to file start, return to insert
Ctrl-o G     " Jump to file end, return to insert
Ctrl-o zz    " Center screen on cursor
Ctrl-o ``    " Return to last position

Lesson 3: Register Insertion

Concept: Ctrl-r inserts register contents in insert mode.

Exercise 3.1: Insert last yanked text

First, yank some text in normal mode:

yiw          " Yank inner word

Then in insert mode:

Ctrl-r "     " Insert unnamed register (last yank/delete)
Ctrl-r 0     " Insert yank register (last yank only)

Exercise 3.2: Insert named registers

In normal mode, yank to register a:

"ayiw        " Yank inner word to register a

In insert mode:

Ctrl-r a     " Insert register a contents

Exercise 3.3: Special registers

Ctrl-r %     " Insert current filename
Ctrl-r /     " Insert last search pattern
Ctrl-r =     " Expression register (calculator!)

Expression register example:

Ctrl-r =5*5<CR>    " Inserts "25"
Ctrl-r =system('date')<CR>  " Inserts current date

Lesson 4: Repeat and Special Inserts

Concept: Shortcuts for common insert patterns.

Exercise 4.1: Repeat last insert with Ctrl-a

Type some text and return to normal mode:

i
hostname: kvm-01
<Esc>

Now enter insert mode and press Ctrl-a:

i
Ctrl-a       " Inserts "hostname: kvm-01"

Exercise 4.2: Indent controls

Ctrl-t       " Indent current line (add tab/spaces)
Ctrl-d       " Outdent current line (remove indent)

Use case: Editing YAML/Python where indentation matters.

Exercise 4.3: Digraphs with Ctrl-k

Insert special characters:

Ctrl-k ->    " Inserts →
Ctrl-k !=    " Inserts ≠
Ctrl-k >=    " Inserts ≥
Ctrl-k Co    " Inserts ©
Ctrl-k Eu    " Inserts €

See all digraphs: :digraphs

Lesson 5: Line Manipulation

Exercise 5.1: Insert line above/below

From normal mode:

o            " New line below, enter insert
O            " New line above, enter insert

From insert mode:

Ctrl-o o     " New line below, stay in insert after
Ctrl-o O     " New line above, stay in insert after

Exercise 5.2: Join without leaving insert

Ctrl-o J     " Join current and next line

Summary: Insert Mode Controls

Keypress Effect Source

Ctrl-w

Delete word backward

readline

Ctrl-u

Delete to line start

readline

Ctrl-h

Backspace

readline

Ctrl-o {cmd}

Execute ONE normal command

vim

Ctrl-r {reg}

Insert register contents

vim

Ctrl-a

Insert last inserted text

vim

Ctrl-t

Indent line

vim

Ctrl-d

Outdent line

vim

Ctrl-k {dig}

Insert digraph

vim

What’s NOT the Same

Readline Neovim Why Different

Ctrl-k

Digraph insert

Use Ctrl-o D for kill-to-end

Ctrl-e

Scroll (normal)

Use Ctrl-o $ or End

Ctrl-a

Beginning of line

Use Ctrl-o 0 or Home

Ctrl-t

Transpose

Indents line instead

Exercises to Complete

  1. [ ] Open a file, type a sentence, delete words with Ctrl-w

  2. [ ] Use Ctrl-o to navigate while staying in insert mode

  3. [ ] Yank a word, then insert it elsewhere with Ctrl-r "

  4. [ ] Use Ctrl-r = to insert a calculated value

  5. [ ] Try Ctrl-t and Ctrl-d for indentation

Next Session

Session 02: WORD Motions & Operators - Master W B E and operator pending mode.

Session Log

Timestamp Notes

Start

<Record when you started>

End

<Record when you finished>

Discoveries

<What surprised you?>