feat: quote and bracket text objects (pairs, iq/ib) - #69
Merged
Merged
Conversation
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).
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds quote and bracket text objects on top of the
resolveTextObjectseam from #68.Objects
i"i'i`(withavariants)i(i{i[i<(withavariants), from either delimiteriqfor the nearest quote of any type ("'`)ibfor the nearest bracket of any type ((){}[])Works with
d/c/yand in visual mode:di",ci(,da{,dib,ciq,vi[, and so on.Design
Purely additive over the seam: only
text.ts(new pure functionsbracketRange,quoteRange,anyQuoteRange,anyBracketRange) andtextobject.ts(newcasearms) changed.normal.tsandvisual.tsare untouched.Notes
ibmeans any bracket, not vim's parens-onlyib(documented in the README). Usei(for parentheses specifically.di"on""andci(on()do nothing (the action model has no zero-width insert yet).Testing
just checkgreen: 309 tests, lint clean. Covers nesting, multiline brackets, cursor-on-delimiter, empty pairs, line-scoped quotes, tightest-enclosingiq/ib, and adb-stays-a-motion regression guard.