helix icon indicating copy to clipboard operation
helix copied to clipboard

Surround delete breaks the `select -> action` model

Open wooden-worm opened this issue 3 years ago • 2 comments

In helix the surround delete command md doesn't respect selections, the action needs another key to specify which character to delete. This breaks the select -> action model since I can't visually confirm what's being deleted.

I propose helix to add a surround delete selection, which simply deletes the first and last characters of current selections.

Example:

"example text"

ma" => select everything
mx => delete first and last `"` => example text



wooden-worm avatar Sep 09 '22 18:09 wooden-worm

This breaks the select -> action model since I can't visually confirm what's being deleted.

I agree md breaks select-then-act but with the proposed command that trims the ends of a selection, you still have no visual indication of what will be deleted.

I think this is better covered by https://github.com/helix-editor/helix/issues/2413.

the-mikedavis avatar Sep 09 '22 22:09 the-mikedavis

Selections are enough for visual confirmation IMO. I also wouldn't mind using https://github.com/helix-editor/helix/issues/2413 for surround delete, however https://github.com/helix-editor/helix/issues/2413 would not work well if you want to surround delete multiple times.

Example:

[[["text"]]]

x => select the whole line
md md => ["text"]
md md => text

wooden-worm avatar Sep 10 '22 06:09 wooden-worm

This one caught me off-guard. I expected this to work differently—more like ms* would mean select surround so we'd do ms*d and ms*c*. How about adding an me* for that? Read as match enclosing *.

mrkishi avatar Mar 06 '23 10:03 mrkishi