Implement Kakoune's `A-S`
In Kakoune, it selects the first and last characters of each selection.
Where [] denotes a selection, [helix] becomes [h]eli[x]
It would look similar to https://github.com/helix-editor/helix/blob/87a720c3a13ccc7245f5b0befc008db5bd039032/helix-term/src/commands.rs#L1855-L1864 but use https://github.com/helix-editor/helix/blob/87a720c3a13ccc7245f5b0befc008db5bd039032/helix-core/src/selection.rs#L607-L614 instead
Is anyone working on this one at the moment? I'd like to make my first contribution
Nobody has announced that they're working on this, so it's probably fine?
Cool! Ill give it a shot
I'm not against this, just asking what is a usecase? The only situation I can see is something like selecting parentheses/brackets and delete them, but for that I can use existing keybinds.
#9483
Just created a pull request for this one
Did you have something specific in mind for this command @kirawi? I also wonder if we need a command for this given that we have surround tools builtin while Kakoune does not
It was requested by https://matrix.to/#/!zMuVRxoqjyxyjSEBXc:matrix.org/$bFvOW3o-qWGL_cSdJWwK1wE86NXUz8LFq7rBJtO6VMA?via=matrix.org&via=mozilla.org&via=envs.net and I thought it was simple enough (and because Kakoune included it).
https://github.com/mawww/kakoune/issues/550 is the issue that motivated it in Kakoune. I think right now it could also be useful for basic multi-character pairs.
Overall, I agree that it is a niche command and if you guys don't want to include the command I'd be indifferent to it.
The use-cases mentioned later in the issue are covered by surround tools. The original use-case I'm not sure I fully understand but it seems like it wouldn't come up often so I bet it could be covered instead by subselecting with a regex of ^.|.$. I've asked on matrix what the commenter's use-case is - I'm leaning towards not adding this unless there's something compelling
so I bet it could be covered instead by subselecting with a regex of
^.|.$.
for selections that span across lines, \A.|.\z can be used instead to not match beginning/end of line