There are several Kakoune keys that I don’t really understand the purpose of. For example, e
extends the selection until the next end-of-word. It does exactly the same thing that E
does if you only press it once. It seems like you don’t need to have e
as a command and it would be more useful if it meant to move to the next end of the word without extending the selection. Then e
/E
would be analogous to l
/L
and other pairs of movement/selection commands.
The behaviour of e
to extend the selection seems like a hang-over from Vim, so that you can say in Kakoune you type ed
to delete until the end of the word whereas in Vim you type de
.
It would be useful for navigating with f
and t
to go forward on a line without extending the selection.
Thanks to Reddit user “ftonneau” I was able to redefine f
and t
not to extend the selection:
define-command -params 1 find-character %{
# Args: 1 = count
on-key %{
exec %arg(1) f %val(key)
exec <semicolon>
}
}
map global normal f ':find-character %val(count) <ret>'
define-command -params 1 to-character %{
# Args: 1 = count
on-key %{
exec %arg(1) t %val(key)
exec <semicolon>
}
}
map global normal t ':to-character %val(count) <ret>'
https://old.reddit.com/r/kakoune/comments/1gw3mbq/basic_movement_question_from_new_user/m0fuswt/
I do not think e
and E
are equivalent if pressed only once. E
extends whereas e
does not. Admittedly, you won’t see any difference if the current selection consists of only 1 character. Try it with a selection that is more than 1-character wide, however, and you’ll see the difference between extending (E) versus merely selecting (e), even if e/E is pressed only once.
You are right. e
creates a selection from the current cursor position to the end of the word, while E
extends the selection until the end of the word.
I suppose e
/b
is a quick way to select an entire word at once to do something with that word, but it is not as useful as a quick way of moving through text because of leaving a word selected.