Skip to content

feat(editor): Add helix match selection - #1188

Draft
glcraft wants to merge 22 commits into
nushell:mainfrom
glcraft:main
Draft

feat(editor): Add helix match selection#1188
glcraft wants to merge 22 commits into
nushell:mainfrom
glcraft:main

Conversation

@glcraft

@glcraft glcraft commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Add match actions from helix to reedline, and bind the new behaviors to the helix mode.

Keybindings:

  • mi<TextObject> : select inside a text object
  • ma<TextObject> : select around a text object
  • ms<TextObject> : add the specified text object around the selection
  • md<TextObject> : remove the nearest specified text object around the selection
  • mr<old TextObject><new TextObject> : replace the nearest specified text object around the cursor with another text object

This includes the following new EditCommand:

  • SelectTextObject
  • AddTextObject
  • RemoveTextObject
  • ReplaceTextObject

Moreover, brackets and quotes are more granular in TextObjectType by differentiating each text object.

Additional notes

Redundant code has been removed, replaced by existing or new functions. In a nutshell, <Cut/Copy><Inside/Around>Pair had been replaced by <Cut/Copy>TextObject.

Detail here

Among that, the following EditCommand has been replaced:

  • EditCommand::CutInsidePair{start: char, end: char) => EditCommand::CutTextObject{scope: TextObjectScope::Inner, object_type: TextObjectType::XXX}
  • EditCommand::CutAroundPair{start: char, end: char) => EditCommand::CutTextObject{scope: TextObjectScope::Around, object_type: TextObjectType::XXX}
  • EditCommand::CopyInsidePair{start: char, end: char) => EditCommand::CopyTextObject{scope: TextObjectScope::Inner, object_type: TextObjectType::XXX}
  • EditCommand::CopyAroundPair{start: char, end: char) => EditCommand::CopyTextObject{scope: TextObjectScope::Around, object_type: TextObjectType::XXX}

In core_editor::editor::Editor, the following functions have been replaced:

  • cut_inside_pair => cut_text_object
  • cut_around_pair => cut_text_object
  • copy_inside_pair => copy_text_object
  • copy_around_pair => copy_text_object

Vi mode implementation has been updated towards that.

All tests passes.

@glcraft
glcraft marked this pull request as draft August 24, 2026 21:36
@fdncred

fdncred commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Hey @glcraft! Good to see you around. Thanks!

glcraft and others added 6 commits August 28, 2026 22:45
…1194)

The note asked for it to fold onto a char-class boundary predicate like
`Word` and `LongWord`. It cannot: keeping `can't` and `3.14` whole turns
on what flanks the `'` or the `.`, which is context rather than class, thus
UAX-29 segmentation stays its own scan.
Remove CutInsidePair, CutAroundPair, CopyInsidePair, CopyAroundPair and
replace them by CutTextObject, CopyTextObject.
Also clean the vi mode implementation to remove action inside/around
pair
@glcraft

glcraft commented Sep 1, 2026

Copy link
Copy Markdown
Author

I updated the first comment

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.

3 participants