Skip to content
Natalie Perret
Go back

Learning Neovim > 2: Editing Operators

Neovim’s editing model is built on operators + motions. An operator performs an action (delete, change, yank…), and a motion tells it how far to reach.

Table of contents

Open Table of contents

Delete

KeyAction
dwDelete to start of next word
d$Delete to end of line
ddDelete whole line
xDelete character under cursor
d[motion]Delete + any motion (e.g. d3w, dG)

Change

Change operators delete text and drop you into Insert mode.

KeyAction
ceDelete to end of word + enter Insert mode
c$Change to end of line
ccDelete rest of line + enter Insert mode

Undo / Redo

KeyAction
uUndo last command
Ctrl+RRedo

Copy / Paste (Yank)

In Neovim, yank means copy.

KeyAction
pPaste deleted/yanked text after cursor
ywYank (copy) the word at cursor forward
yyYank whole line

The Operator + Motion Pattern

Almost every operator follows the same formula:

[operator][count][motion]

For example:

Once this pattern clicks, you unlock the full expressiveness of Neovim’s editing model.


Share this post on:

Previous Post
Learning Neovim > 1: Normal Mode Navigation
Next Post
Learning Neovim > 3: Insert & Visual Modes