easymotion / vim-easymotion

Vim motions on speed!
http://www.vim.org/scripts/script.php?script_id=3526
7.44k stars 358 forks source link

Explanation of the core algorithm #334

Closed haudan closed 7 years ago

haudan commented 7 years ago

Yellow!

I've been using EasyMotion for a while now and I love it! I want to (more or less) clone the functionality into some tools I'm using, to improve my productivity.

However, I couldn't figure out how EasyMotion works under the hood, since it seems to employ a more sophisticated strategy than simply selecting all word boundaries and marking them.

So how does EasyMotion work? How does it select which locations to mark? How does it come up with the shortcuts?

I'm sorry for opening an issue if this is already described somewhere. I'm also not keen on reading the source code, mainly because I don't understand vimscript.

Cheers!

haya14busa commented 7 years ago

You can find core code here. https://github.com/easymotion/vim-easymotion/tree/master/autoload/vital/_easymotion/HitAHint

it's a bit difficult to explain it in English without any diagram, so it's easiest to read the code itself i guess.