When I used vim, I often used the f
command and the multiline vim-sneak version of it. I actually found no use case for the Kakoune version of the f
command regarding the selection, as I just need it for jumping (most of the time) inside a line. When I want to select a region, I can just use F
. It would also be much more useful if the <a-.>
command after t
would jump to the next match.
So I ended up with the following commands. Maybe it is useful for someone of you too.
define-command fandt-f %{
on-key %{ execute-keys "f" %val{key} ";" }
map global normal "<a-.>" "<a-.>;"
}
define-command fandt-t %{
on-key %{ execute-keys "t" %val{key} ";" }
map global normal "<a-.>" "l<a-.>;"
}
define-command fandt-reverse-f %{
on-key %{ execute-keys "<a-f>" %val{key} ";" }
map global normal "<a-.>" "<a-.>;"
}
define-command fandt-reverse-t %{
on-key %{ execute-keys "<a-t>" %val{key} ";" }
map global normal "<a-.>" "h<a-.>;"
}
hook -group fandt global NormalKey <a-T> %{
map global normal "<a-.>" "H<a-.>"
}
hook -group fandt global NormalKey T %{
map global normal "<a-.>" "L<a-.>"
}
hook -group fandt global NormalKey <a-F>|F %{
unmap global normal "<a-.>"
}
map global normal f ": fandt-f<ret>"
map global normal t ": fandt-t<ret>"
map global normal <a-f> ": fandt-reverse-f<ret>"
map global normal <a-t> ": fandt-reverse-t<ret>"