Hello. I found that using <a-.> after f works (to repeatedly find the previous character searched for). But using <a-.> after t does not work. The cursor does not move. It is strange because ‘t’ does work on its own, and <a-.> works after ‘f’. But <a-.> does not work after ‘t’.
Has anyone had this kind of issue?
Thank you.
If I start Kakoune with:
echo hello world | kak -n
…then I type flflfl
, the cursor jumps to the first “l” in “hello”, then the second, then the first “l” in “world”. If I go back to the beginning and type fl<a-.><a-.>
I get the same behaviour.
If I go back to the beginning and type tl
,the cursor jumps to the “e” in “hello” (just before the first “l”). If I type another tl
, the cursor is still just before an “l”, so it stays where it is. I can keep typing tl
as many times as I want, and the cursor stays there.
tl<a-.><a-.>
mimics the behaviour of typing tl
multiple times, just as fl<a-.><a-.>
mimics the behaviour of typing fl
multiple times.
Hello. Yes, that is what I was expecting. However, it does not seem to be working for me, even when there are plenty of characters. I made a screen recording:
This happens even when I use the -n flag to start kakoune, so it is not related to the kakrc file. I am using Kakoune 2024.05.18.
Thanks for any suggestions.
To me, the behavior from your screencast is ok. As explained above, kakoune works differently than vim for the t
motion. In vim, repeating t
will find the next occurrence and stop before it. But with kakoune, it considers that the next character is still the correct one. So it does not go further. This is more predictable. And pragmatically, when you are on a letter just before a
and you try to repeat “go just before the next a”, it makes sense to stay where you are.
This behavior bothered me at first but I got used to it over time.
Ah, I get it now… thanks for explaining it!
Oh thank you! I see now. When I repeat ‘t a’ it does the same thing - just stays where it is. That makes sense now. Thanks so much.
I experimented more with the ‘t’ motion. I found that Vim works the same as Kakoune - it does not repeat the movement. (If you type “t d” repeatedly in Vim it won’t move past the first instance even if there are more “d” on the line). But Helix does.
If we define “t” as moving to the _next_character immediately preceding a “d” (in this example), then it would be correct to move to the next instance.
This definition of “t” is useful if you want to extend the selection to reach a specific “d” you have your eye on. Well, especially for “T” which is extending a selection.
For example, suppose you want to change, delete, yank all the text preceding “day” in this sentence:
The car door was definitely cleaned everyday.
In Helix in visual mode, a few “t d” will select up to but not including “day”.
In Kakoune, I’m not sure what is the most efficient way is to select everything up to but not including “day”. Can we use search (/) for “day” to quickly select up to but not including “day”?
(I’'m trying to get into the Kakoune way of thinking…)
I now found that even though Vim does not repeat the ‘t’ motion when repeated (e.g., ‘t d’ , then ‘t d’), pressing the semicolon ‘;’ does move the cursor to the next ‘d’. On the other hand, Kakoune does not do this even when using <a-.> to repeat the motion. So Kakoune does not have a way to repeat ‘find until’ a character, but Vim and Helix do…