Vim / Neovim Editing: Operators and Text Objects

Delete, change, yank, repeat, and target text precisely with motions and text objects.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Core operators
Delete with a motion
dw  d$  dd

# Delete words, lines, or ranges.

Change with a motion
cw  c$  cc

# Delete target text and enter insert mode.

Yank with a motion
yw  y$  yy

# Copy text into a register.

Repeat the last change
.

# Run your last edit again.

## Text objects
Operate on a word
ciw  diw  yiw

# Change, delete, or yank the current word cleanly.

Operate inside quotes
ci"  di"  yi"

# Target a quoted string without touching delimiters.

Operate inside delimiters
ci(  ci{  da[

# Edit text inside parentheses, braces, or brackets.

Operate on a paragraph
cip  dip  yap

# Change, delete, or yank paragraph blocks.

## Counts, join, undo, and replace
Prefix commands with counts
3w  5j  2dd

# Repeat a motion or edit multiple times.

Join lines
J  gJ

# Merge lines cleanly.

Undo and redo
u  <C-r>

# Walk backward and forward through edits.

Replace a single character
rX

# Overwrite one character without entering insert mode.

Recommended next

No recommendations yet.