Add vi 'y' bindings and some i / a support#6769
Conversation
Many people have mentioned wanting support for changing / yanking / deleting between "" and '', meaning the commands `ci' ci" yi' yi" di' di"`, so this adds that support in a generic, and thus potentially confusing way. The concept is that we check for the character backwards and forwards before making the selection. Unfortunately, this will also work for *any* character that isn't `w` or `W`, so `cia` could change everything between two `a` characters. Looking through the [bind documentation](https://fishshell.com/docs/current/cmds/bind.html) and input handler at `src/input.cpp`, this is the best possible solution I could come up with until `forward-jump` and `backward-jump` can accept input in the call to `bind`, and not just from stdin, meaning we can write a binding as: ``` bind di\" backward-jump-till \" and repeat-jump-reverse ...` ``` If that were done, then other commands such as `di)` to go between `()` would be possible. There are also some added `y` bindings not part of #6648. Let me know if you need anything else.
|
I'm not sure how useful this is - it seems like it really only works for But on the other hand, I'm not entirely sure how to bring this into the binding system. How do we break this down? Adding arguments to bind functions like you propose is one idea, but that complicates the already weird bind DSL. Can we find operations that this requires, and add them so that we can then implement these things in their terms? I think we might be able to? "di)" to me appears to require the following:
And for "di(" it would require a backward jump first or a forward-jump with the argument switched around. Which just leaves the question of what we do with this now. And personally, I'd assume that pressing So I'm merging this. Thanks! |
|
I think this should all be possible if |
Description
Many people have mentioned wanting support for changing / yanking /
deleting between "" and '', meaning the commands
ci' ci" yi' yi" di' di",so this adds that support in a generic, and thus potentially confusing way.
The concept is that we check for the character backwards and forwards
before making the selection. Unfortunately, this will also work for any
character that isn't
worW, sociacould change everything betweentwo
acharacters.Looking through the bind documentation
and input handler at
src/input.cpp,this is the best possible solution I could come up with until
forward-jumpandbackward-jumpcan accept input in the call tobind,and not just from stdin, meaning we can write a binding as:
If that were done, then other commands such as
di)to go between()wouldbe possible.
There are also some added
ybindings not part of #6648.Let me know if you need anything else.
TODOs: