-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: 2-character "find next / prev pair" commands similar to f
and F
#12888
base: master
Are you sure you want to change the base?
Conversation
How is the count accepted? |
Editor is responsible for handling the count, the commands can just read it |
Instead what I'd like to see for the use-case mentioned in #12898 is a refactor of the way that search works in select mode. Currently it adds a selection which is not really correct. It's fine to preserve that behavior in another command but it shouldn't be the behavior of That change to the way search works in select mode should cover this use-case and is more interactive than these commands. |
Yes, I think that's much better! I just tested your commit and it works. What should be done to have it merged? |
It needs some cleaning up - I think the TODO comments can be dropped but Kakoune's behavior for |
I'm imagining this as working for short hops, so avoiding pressing Also, if the selection is going to cover the two characters, I think it should be under the goto menu, since that's how many of the commands in that menu work. Whereas |
2 new commands:
find_next_pair
: Ask for 2 chars. Create selection at the next occurence of these 2 chars (accepts count). Bound toL
find_prev_pair
: Ask for 2 chars. Create selection at the previous occurence of these 2 chars (accepts count). Bound toH
Differences from
f
/F
: Does not drag the selection. Instead, creates a selection at those 2 characters. These commands are like a blend betweengoto_word
andf
/F
motions.Why
More granular control is desired when moving selections. This makes it easier to perform a range of text selections / transformation with fewer keystrokes and less overhead (see linked issue for more examples)
Note
Draft at the moment. Only
find_next_pair
"works" at the moment., lots of copy-pasting in the code. Will refactor tomorrow!Closes #12878