Open joshtch opened 10 years ago
I hope you get the idea I'd like to be able to set custom keys for certain specific mappings while keeping a default for the rest.
I get it.
At first, I think I should implement option which show key label from top to bottom when bidirectional search because let g:EasyMotion_keys='NMOLPKQJRISHTGUFVEWDXCYBZA'
is a little bit workaround and has some problem which doesn't show label from 'A' when the number of target label is few.
However, it may breaks '.' repeat support(require tpope/vim-repeat) in bidirectional motion, so I think I should implement the way you said like g:EasyMotion_keys_s
, g:EasyMotion_keys_bd-w
, etc....
In addition to show label alphabetically, g:EasyMotion_keys_{motion}
enable us to configure like vim's default and clever-f motion.
let g:EasyMotion_keys = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
let g:EasyMotion_keys_s2 = 'SABCDEFGHIJKLMNOPQRTUVWXYZ'
let g:EasyMotion_keys_w = 'WABCDEFGHIJKLMNOPQRSTUVXYZ'
let g:EasyMotion_keys_b = 'BACDEFGHIJKLMNOPQRSTUVWXYZ'
let g:EasyMotion_use_upper = 1
map <expr>s EasyMotion#is_active() ?
\ '<Plug>(easymotion-next)' : '<Plug>(easymotion-s)'
map <expr>w EasyMotion#is_active() ?
\ '<Plug>(easymotion-next)' : '<Plug>(easymotion-w)'
map <expr>b EasyMotion#is_active() ?
\ '<Plug>(easymotion-prev)' : '<Plug>(easymotion-b)'
Caution: Easymotion#is_active()
is undocumented yet, experimental and could be changed.
These configuration with implementation of g:EasyMotion_keys_{motion}
enable us to move cursor by typing s{char}{char}*s*ssss...
, wwwwwww....
, bbbbbbb...
and I think it's cool! (and actually I'm not interested in showing label alphabetically from top to bottom while bidirectional motion)
It will take me a little time to implement it for not to break '.' repeat support, but I think I can release it near the future.
If you have any good ideas, please tell me.
Thanks!
That's actually really neat, I like that better too.
I implemented this feature experimentally at feature/custom-targetkeys
branch including '.' repeat support.
<Plug>(easymotion-{name})
correspond to g:EasyMotion_keys_{name}
(Caution: change 'bd-' to 'bd_')
I try it myself for a short time, but is it really useful?
Actually, highlight is annoying to use as clever-f or vim-sneak like motion (s{char}{char}sssss...
) and If I want to use like that motion, I'll maybe implement motion which jump to first match & don't show target label.(This motion is against easymotion concept, but I want it work together with repeat motion and other feature)
As for behaviour of showing target A-Z alphabetically, if cursor position is at near the top or bottom of window, it cannot show label alphabetically.
Anyway, please wait for merging into master. I want some time to consider it's really useful.
I currently have my easymotion keys set as like so:
This way, when I press the map for
<Plug>(easymotion-s)
, the target letters appear alphabetically from top to bottom. For example:searching for
p
(terrible picture but I hope you get the idea)This works great for that mapping, but it looks terrible for others. I'd like to be able to set custom keys for certain specific mappings while keeping a default for the rest.