Skip to content

feat: quote and bracket text objects (pairs, iq/ib) - #69

Merged
oribarilan merged 1 commit into
mainfrom
feat/text-objects-pairs
Sep 2, 2026
Merged

oribarilan merged 1 commit into
mainfrom
feat/text-objects-pairs

Conversation

@oribarilan

Copy link
Copy Markdown
Owner

Adds quote and bracket text objects on top of the resolveTextObject seam from #68.

Objects

  • Quotes: i" i' i` (with a variants)
  • Brackets: i( i{ i[ i< (with a variants), from either delimiter
  • iq for the nearest quote of any type (" ' `)
  • ib for the nearest bracket of any type (() {} [])

Works with d/c/y and in visual mode: di", ci(, da{, dib, ciq, vi[, and so on.

Design

Purely additive over the seam: only text.ts (new pure functions bracketRange, quoteRange, anyQuoteRange, anyBracketRange) and textobject.ts (new case arms) changed. normal.ts and visual.ts are untouched.

Notes

  • ib means any bracket, not vim's parens-only ib (documented in the README). Use i( for parentheses specifically.
  • Empty pairs no-op: di" on "" and ci( on () do nothing (the action model has no zero-width insert yet).

Testing

just check green: 309 tests, lint clean. Covers nesting, multiline brackets, cursor-on-delimiter, empty pairs, line-scoped quotes, tightest-enclosing iq/ib, and a db-stays-a-motion regression guard.

Adds quote objects (double, single, backtick) and bracket objects i(/i{/i[/i< with a variants, plus iq (any quote) and ib (any bracket), for d/c/y and in visual mode.

Additive over the resolveTextObject seam, no handler changes: new pure functions in text.ts (bracketRange, quoteRange, anyQuoteRange, anyBracketRange) and new cases in textobject.ts. ib means any bracket (()/{}/[]), diverging from vim parens-only ib (noted in README).
@oribarilan
oribarilan merged commit 7c1160e into main Sep 2, 2026
1 check passed
@oribarilan
oribarilan deleted the feat/text-objects-pairs branch September 2, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant