reedline icon indicating copy to clipboard operation
reedline copied to clipboard

feature request: vi/vim mode text objects

Open SimonYde opened this issue 1 year ago • 6 comments

When using the vi/vim mode, I find myself lacking the general text objects that exists in most editors/shells with builtin vim mode. I'm talking about the following:

  • diw
  • ciw
  • dap
  • cap
  • vaw
  • viw

The basic inside and around text objects. These I find extremely useful when navigating in my shell with the vim mode and want to edit a word I just so happened to be in the middle of.

References

fish has this feature as an example of a shell with vi/vim-like keybinds.

SimonYde avatar Nov 07 '24 14:11 SimonYde

We landed this PR recently which, I think, does some of these. Can you confirm? https://github.com/nushell/reedline/pull/844

fdncred avatar Nov 07 '24 15:11 fdncred

That was just the inside delimiter text objects: i"/i( etc.

sholderbach avatar Nov 07 '24 15:11 sholderbach

We landed this PR recently which, I think, does some of these. Can you confirm? #844

My request is I suspect an expansion on the pull request you mention. My request is to add the word and paragraph text objects from vim. Though the pull request goes a long way as is.

SimonYde avatar Nov 07 '24 15:11 SimonYde

I'd love to have a full/complete vim keybind solution with configurable keybinding. Most of the vim stuff is hard coded. Would love to change that.

fdncred avatar Nov 07 '24 17:11 fdncred

It would be great if one also could customize it. Currently ci) works, but I would like to add cib or maybe add my own delimiters (like ciq for changing stuff in ``. There seems to be an CutInside Value: <char> <char> edit I could bind, but how can I bind it to ciq?

oiiiiiiii avatar May 07 '25 20:05 oiiiiiiii

I'm currently working on (and almost finished) #939 to add word (w), WORD (W), bracket (b) and quote (q) text objects. This includes adding jumping to next quote/bracket/pair if not currently in one. I haven't added paragraph (p) at the moment but that should be quite easy to add in later. Edit: should be finished now, ready for review.

JonLD avatar Jul 31 '25 02:07 JonLD