easymotion / vim-easymotion

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

Jumping to the word starting with letter #425

Closed joshua-light closed 4 years ago

joshua-light commented 4 years ago

Greetings!

I've recently switched to Vim from Emacs. In Emacs, as well as in the Intellij products family there is a plugin called AceJump (or AceJumpLite).

It has a killer feature that allows you to press <Leader> + <any character you want to search> to create labels for all words that start with the specified character. It's pretty great, because in most cases I feel like I don't need to jump in the middle of word, so on average I only need to press 3 keys to jump everywhere (leader + letter + label for word).

For example, here I pressed <Leader> + t: image

(easymotion-s2) has very similar behaviour and results, but I'm not sure whether it's that efficient, because it captures a lot of stuff, so on average I need to press 4 keys (leader + letter + letter + label). Unfortunately, I couldn't manage to find any command that allows me do the exact same thing as in the screenshot.

Is there one in EasyMotion? If not, are there some good (or even better) alternatives?

Thanks in advance!

zsugabubus commented 4 years ago

Try nnoremap <Leader> :<C-U>call EasyMotion#User('\V\<'.escape(nr2char(getchar()), '\'), 0, 2, 0)<CR>. (Untested.)

joshua-light commented 4 years ago

@zsugabubus wow, magic. It works. Even without <C-U> part. Thanks!