Vim Text Objects — iw, aw, i", a(, it and More

Understand Vim text objects: inner (i) and around (a) selections for words, sentences, paragraphs, quotes, brackets, and tags. The key to fast structured editing.

Editing

Detailed Explanation

What Are Text Objects?

Text objects define regions of text based on structure rather than cursor position. They are used with operators and in Visual mode:

{operator}{a|i}{object}
  • i = inner (content only, excluding delimiters)
  • a = around / an (content including delimiters)

Word and Sentence Objects

Object Inner (i) Around (a)
Word iw — the word aw — word + surrounding space
WORD iW — the WORD aW — WORD + surrounding space
Sentence is — the sentence as — sentence + space
Paragraph ip — the paragraph ap — paragraph + blank lines

Delimiter Objects

Object Inner (i) Around (a)
Double quotes i" — inside ".." a" — including quotes
Single quotes i' — inside '..' a' — including quotes
Backticks `i`` — inside backticks `a`` — including backticks
Parentheses i( or ib a( or ab
Square brackets i[ a[
Curly braces i{ or iB a{ or aB
Angle brackets i< a<
HTML/XML tags it — inside tags at — including tags

Practical Examples

  • diw — Delete the word under the cursor
  • ci" — Change the text inside double quotes
  • da( — Delete everything including the parentheses
  • yis — Yank the current sentence
  • vip — Visually select the current paragraph
  • cit — Change the content inside an HTML tag

Text objects are what elevate Vim from a simple text editor to a structural editing powerhouse.

Use Case

You are editing structured text like code, markup, or prose and need to quickly select, delete, or change content based on its structural boundaries like words, quotes, brackets, or tags.

Try It — Vim Cheat Sheet

Open full tool