-
-
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: add bidirectional motion repeat with selection support #12884
base: master
Are you sure you want to change the base?
Conversation
- Add Alt-Shift-. binding to reverse repeat last motion - Split repeat_last_motion into normal/reverse variants - Support extending selections with repeat motions - Update documentation and tutor to reflect new commands
Add MotionMode handling in goto_diag_{next,prev} commands to support reverse repeat operations.
goto_next_change and goto_prev_change now support reverse repeat (changes direction). extend_repeat_last_motion and extend_repeat_last_motion_reverse will now override the movement (move / extend) behavior if for some reason someone binds extend_repeat_last_motion in normal mode it will work as expected.
- Update tree-sitter object navigation to support reverse direction - Add reverse direction support for goto_ts_object_impl and select_sibling_impl - Update move_node_bound_impl to handle reverse motions
I'm also using Colemak DH and Alt + Shift anything is literally impossible for me to press. Nice to see someone else using it! I think A-S-. is the one that makes the most sense and one that feels consistent with other keybindings in the editor |
Think @pascalkuthe uses it too! What keyboard you guys use? Something with qmk firmware I'm guessing. I use this little thing |
This is my layout I'm also using corne keyboard! Really comfortable. The numbers are in weird positions, but I placed them there for a reason. :) I was trying to find a solution for how I can possibly have a natural combination for Shift + Alt. Tried for a long time, but nothing feels good. Everything adjustments feels like a compromise to make that combination possible. So I've just decided to remap any Shift + Alt I come across. |
Following is off-topic nerding out about keyboards for anyone reading this PR:
Ha love it! looks like the type of insane micro-optimization I would try. One thing that stands out to me about your layout are the arrow keys on the primary layer. Personally, I put these on the raise layer (right mid thumb cluster button for me) in the same position as vim movement keys. Seems like that would be easier to reach and would also free up a lot of possibilities on your primary layer. I have one deviation from Colemak-DH. I swap the I tried the swap on: https://colemakmods.github.io/mod-dh/analyze.html and this is an improvement in score on Colemak-DH due to swapping the same-finger bigrams Anyway, moving arrow keys off main layer opens up a lot of things you can do. You can move Personally, I like having number row across all my main layers so I can hold the layer down with the opposite hand that's pressing the number key. I get away with this by having a dedicated layer for F keys (LOWER + v takes me to FN layer). Interesting that you press space with your left hand. I've always wondered if that would be a better balance in typing across both hands! |
Also funny to me that you're not the first person I've run into that uses this keyboard: meow-edit/meow#626 (comment) Thought this would be a lot more rare. |
<ret> has it's own logic and seems there's no other tests for it atm.
Reviewing this again, I realized it makes sense to be able to reverse the motion of Here a breakdown of motions where reverse repeat last motion applies: applies:
does not apply
|
Closes #12877
Fixes #8761
Related discussion: #8495
This continues @Aqaao's initial work here.
Taking into consideration @the-mikedavis's comment here.
Add reverse motion repeat
A->
(A-S-.
) to complement existing repeat (Alt-.
)I'm completely open to suggestions for an alternative key binding. I personally use a heavily modified keymap to support Colemak-DHm. I'm planning to bind this to
'
/"
(select register&
) in my config.New commands:
repeat_last_motion_reverse
extend_repeat_last_motion
extend_repeat_last_motion_reverse
Add extend variants for both forward/reverse motion repeat
Why add extend variants of
repeat_last_motion
? This is motivated by @pascalkuthe's comment:The extend variants override the last
movement
(i.e Move / Extend) to always extend.Update documentation and tutor
Note this also fixes some issue I run into when using find / till on
<ret>
Basically, it works as expected now.I haven't searched through existing issues to see if any can be closed yet.couldn't find any existing issues. Thinkf
/t
+<ret>
is not something people would expect to do anything.Short demos
find / till
.
either starting in normal or select mode and switching:find_till.mp4
repeat motion and reverse repeat on next paragraph:
paragraph.mp4
repeat motion and reverse on next function:
function.mp4