hadronized / hop.nvim

Neovim motions on speed!
Other
2.47k stars 137 forks source link

Allow Custom Distance Functions #380

Closed johnlevidy closed 6 months ago

johnlevidy commented 6 months ago

I would like to be able to rely on the first 3 hops ( read top to bottom, left to right ) being labeled 'a', 's', 'd' ( rather than Manhattan distance ). For example, in the following case:

abcdefghijklmnopqrstuvwxyz
this is the z i mean

If I start with my cursor on the k and single char hop to "z", the "a" ends up on the z on the line below, which frequently leads to me deleting more than I intend, since I always scan lines left to right before top to bottom.

I would like to provide my own scoring function ( rather than xbias ) which always orders higher lines first and always orders leftmost characters first. That way I can rely on usages like: "dfta" always being safe ( and especially, means in the common case I don't even need to read the targets -- even if it's additional keystrokes it is a sequence I can rely on ).

I'm happy to take a stab at the changes myself if there's appetite for it!