Hacker News new | ask | show | jobs
by grayrest 1607 days ago
Doing the motion first lets you visually confirm the range before invoking the command. You also have the opportunity to adjust the range if you didn't get it quite right.

Mnemonically the vim order works better for English but in practice I find the visual feedback from selection better for anything even moderately complex. An example would b `f` or `t` since I tend to hit the letter I was aiming for earlier than I was expecting.

> In case were `wd` deletes a word - there should be some lag, no?

There's no animation or forced latency. For a short motion that's predictable like `w`, you're typing the d before you actually check the result and it's just as fast as vim but in the opposite order.

4 comments

> Doing the motion first lets you visually confirm the range before invoking the command. You also have the opportunity to adjust the range if you didn't get it quite right.

It should be noted here that Vim more or less works like this in visual mode. If you go "v <motion> <command>" instead of "<command> <motion>", you can visually confirm the range. I can see the argument that it should be the default, though I like the fact that <motion> alone in normal mode just moves you around without preparing for a command.

The same visual feedback exists in vim.

    vwww
selects the next 3 words visually. I can now press `d` to delete them.
I have never felt the need to visually confirm something as obvious as "delete 1 word".

On the other hand, you cannot do something like "delete 3 words" in kakoune. "3wd" just takes you to the third word and deletes that.

Deleting 3 words is definitely slower. And it's kind of infuriating...

What am I doing wrong?

Lowercase w resets (each) selection to end of selection, skips any whitespace, and selects to next word boundary, so www or 3w will select third word counting from cursor. Uppercase W extends selection over any whitespace and then to next word boundary, so WWW or 3W will select from cursor to third end of word. (Most other movements are also in lowercase resetting / uppercase extending pairs.) Thus with length-1 (that is, initial-state) selection you can do wwwd or 3wd to delete third word and preserve whitespace, wWWd or w2Wd to delete three words but preserve whitespace, WWWd or 3Wd to delete three words and any whitespace between cursor and start of first word.

That is, counts work, it’s the movements that are slightly different. See manual §3.4–6[1].

[1]: https://github.com/mawww/kakoune#34-movement

>There's no animation or forced latency. For a short motion that's predictable like `w`, you're typing the d before you actually check the result and it's just as fast as vim but in the opposite order.

Yeah, I just realised we are talking about normal mode basically...