hop.nvim icon indicating copy to clipboard operation
hop.nvim copied to clipboard

Make `HopWord` behave like in EasyMotion

Open anuvyklack opened this issue 3 years ago • 3 comments

Hop distributes annotations in a cloud around cursor and last words in the same and the next strings are get 2-keys annotation.

Easymotion distributes 1-key annotations straightforward along lines while they are not end, then it distributes 2-key and so on.

The Easymotion behavior suits me better, because when I want to jump somewhere far I use HopChar1 and use word jumps when I want to jump somewhere nearby, usualy from the beginning of the line somewhere to the end of the same or the second line and annotations there always 2-keys despite rather small distance in "words" metrics. And words under the cursor have 1-key annotations, which I don't need, because if I want there I just press j 2 times instead of invoke hop plugin.

hop

Screenshot from 2022-07-04 23-29-04

Screenshot from 2022-07-05 00-09-59

easymotion

Screenshot from 2022-07-04 23-31-23

Screenshot from 2022-07-05 00-10-50

Is it possible to make HopWord command behave like in EasyMotion?

anuvyklack avatar Jul 04 '22 21:07 anuvyklack

Oh yes, that’s very easy to change. The way to change it is to make the distribution function customizable. Basically, have a way to customize the sort function. I will have a look into that. There are two ways:

  1. Implement some default sorting strategies. There are currently two: the one you mentioned, and reversing that (far keys get 1-chord, near keys get lots). We can imagine naming those and adding yours as a third alternative.
  2. Expose the sorting function directly in the opts and let people provide it (if not provided, it will use the default).

I prefer 1. because configuration shouldn’t have any logic of code, but well, I guess we can explore, too.

hadronized avatar Jul 05 '22 14:07 hadronized

The first variant is better, because not a lot of people would write their own sorting function.

anuvyklack avatar Jul 05 '22 15:07 anuvyklack

Hi! Any updates here?

awerebea avatar Jan 27 '23 08:01 awerebea