feat: surround operations, textobject registry, and target expansion#155
Merged
Conversation
Introduces a complete surround system and textobject architecture:
Textobject Registry:
- Separate registry from composable motions (same key, different contexts)
- Key resolver with priority-based resolution (pre-set → i/a prefix → composable)
- i/a keymaps in x/o modes for native operator compatibility
- Pattern-based pair detection fallback when treesitter can't parse
Surround Operations:
- ds/cs/ys operators for delete, change, add surround
- gza/gzp standalone add and paste surround
- Visual S to wrap selection with delimiter
- Configurable padding: opening chars pad, closing chars don't (surround_pad)
- Visual feedback: delimiter/target highlighting during prompts
Special Surround Types:
- q: quote alias matching any quote type (", ', backtick)
- t: HTML/XML tags with live multi-cursor rename on cst
- f: function calls (dsf unwraps, csf enters insert mode at name)
Target Expansion:
- +/- keys to grow/shrink selection after picking a target
- Dim +/-/backspace hints on adjacent targets
- Works with ys and gza surround operations
- Any non-expansion key confirms implicitly (zero friction)
Additional fixes:
- undojoin pcall for post-undo safety across all surround actions
- Change action preserves indentation for line-type targets
- Module metadata defaults don't overwrite motion config in infer
- Keyword-only word pattern for surround word targets
- SmartMotionSelected highlight updated to neon blue theme
563 tests passing, 0 failures.
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.
Summary
i/aprefix routing. Pattern-based pair detection fallback when treesitter can't parse.ds/cs/ys/gza/gzp/visualSwith configurable padding (surround_pad), visual feedback (delimiter/target highlighting), and hint label clearing during prompts.q(any quote),t(HTML/XML tags with live multi-cursor rename),f(function calls with in-place name editing).+/-keys to grow/shrink selection after picking a target. Dim hints on adjacent targets. Zero friction for single-target use.47 files changed, 5366 insertions. 563 tests passing, 0 failures.
Test plan
di(/da(/vi(/ci"— pair text objects with labels on all matching pairsds(/ds)— delete surround (opening strips padding, closing doesn't)cs(— change surround with delimiter highlighting, padding-awareysaw(/ysaw)— add surround with/without paddingdsq/csq— quote alias (any type)dst— delete surrounding HTML/XML tagcst— live multi-cursor tag rename (type in opening, closing syncs real-time)dsf— unwrap function callcsf— in-place function name editing (insert mode)gza— standalone surround add with keyword-only word targetsgzp— paste surround with stored pairS— wrap selection with prompted delimiterysaw→ pick →++→(wraps 3 words+/-/⌫hints appear on adjacent targets during expansiondw/yw/cw/dd/yy— no regression on existing motionsdaf/dif/dac/dia— treesitter text objects unchangeddiw/daw— native Vim fallback for unregistered textobject keyspresets = { surround = true }backwards compatible