Plug support for EasyMotion prefix (leader) key
This commit is contained in:
parent
d3bbdd90cc
commit
d0352aacfd
@ -62,11 +62,11 @@ function! EasyMotion#init#InitMappings(motions, do_mapping) "{{{
|
|||||||
\ eval('g:EasyMotion_mapping_' . motion) . ' <Plug>(easymotion-' . motion . ')'
|
\ eval('g:EasyMotion_mapping_' . motion) . ' <Plug>(easymotion-' . motion . ')'
|
||||||
elseif a:do_mapping
|
elseif a:do_mapping
|
||||||
\ && !hasmapto('<Plug>(easymotion-' . motion . ')')
|
\ && !hasmapto('<Plug>(easymotion-' . motion . ')')
|
||||||
\ && empty(maparg(g:EasyMotion_leader_key . motion, 'nov'))
|
\ && empty(maparg('<Plug>(easymotion-prefix)' . motion, 'nov'))
|
||||||
|
|
||||||
" Do mapping
|
" Do mapping
|
||||||
silent exec 'map <silent> ' .
|
silent exec 'map <silent> ' .
|
||||||
\ g:EasyMotion_leader_key . motion . ' <Plug>(easymotion-' . motion . ')'
|
\'<Plug>(easymotion-prefix)' . motion . ' <Plug>(easymotion-' . motion . ')'
|
||||||
endif "}}}
|
endif "}}}
|
||||||
|
|
||||||
endfor
|
endfor
|
||||||
@ -86,18 +86,18 @@ function! EasyMotion#init#InitSpecialMappings(motions, do_mapping) "{{{
|
|||||||
" Do mapping {{{
|
" Do mapping {{{
|
||||||
if a:do_mapping
|
if a:do_mapping
|
||||||
\ && !hasmapto('<Plug>(easymotion-special-' . motion . ')')
|
\ && !hasmapto('<Plug>(easymotion-special-' . motion . ')')
|
||||||
\ && empty(maparg(g:EasyMotion_leader_key . motion, 'ov'))
|
\ && empty(maparg('<Plug>(easymotion-prefix)' . motion, 'ov'))
|
||||||
\ && empty(maparg('d' . g:EasyMotion_leader_key . motion, 'n'))
|
\ && empty(maparg('d<Plug>(easymotion-prefix)'. motion, 'n'))
|
||||||
\ && empty(maparg('y' . g:EasyMotion_leader_key . motion, 'n'))
|
\ && empty(maparg('y<Plug>(easymotion-prefix)'. motion, 'n'))
|
||||||
|
|
||||||
silent exec 'omap <silent> ' .
|
silent exec 'omap <silent> ' .
|
||||||
\ g:EasyMotion_leader_key . motion . ' <Plug>(easymotion-special-' . motion . ')'
|
\ '<Plug>(easymotion-prefix)' . motion . ' <Plug>(easymotion-special-' . motion . ')'
|
||||||
silent exec 'xmap <silent> ' .
|
silent exec 'xmap <silent> ' .
|
||||||
\ g:EasyMotion_leader_key . motion . ' <Plug>(easymotion-special-' . motion . ')'
|
\ '<Plug>(easymotion-prefix)' . motion . ' <Plug>(easymotion-special-' . motion . ')'
|
||||||
silent exec 'nmap <silent> ' .
|
silent exec 'nmap <silent> ' .
|
||||||
\ 'd' . g:EasyMotion_leader_key . motion . ' d<Plug>(easymotion-special-' . motion . ')'
|
\ 'd<Plug>(easymotion-prefix)' . motion . ' d<Plug>(easymotion-special-' . motion . ')'
|
||||||
silent exec 'nmap <silent> ' .
|
silent exec 'nmap <silent> ' .
|
||||||
\ 'y' . g:EasyMotion_leader_key . motion . ' y<Plug>(easymotion-special-' . motion . ')'
|
\ 'y<Plug>(easymotion-prefix)' . motion . ' y<Plug>(easymotion-special-' . motion . ')'
|
||||||
endif "}}}
|
endif "}}}
|
||||||
endfor
|
endfor
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
@ -16,11 +16,19 @@ set cpo&vim
|
|||||||
" }}}
|
" }}}
|
||||||
" Default configuration {{{
|
" Default configuration {{{
|
||||||
" Default options {{{
|
" Default options {{{
|
||||||
|
let g:EasyMotion_do_mapping = get(g:, 'EasyMotion_do_mapping', 1)
|
||||||
|
if g:EasyMotion_do_mapping == 1
|
||||||
|
if exists('g:EasyMotion_leader_key')
|
||||||
|
exec 'map ' . g:EasyMotion_leader_key . ' <Plug>(easymotion-prefix)'
|
||||||
|
else
|
||||||
|
if !hasmapto('<Plug>(easymotion-prefix)')
|
||||||
|
map <Leader><Leader> <Plug>(easymotion-prefix)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
call EasyMotion#init#InitOptions({
|
call EasyMotion#init#InitOptions({
|
||||||
\ 'leader_key' : '<Leader><Leader>'
|
\ 'keys' : 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
\ , 'keys' : 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
|
||||||
\ , 'do_shade' : 1
|
\ , 'do_shade' : 1
|
||||||
\ , 'do_mapping' : 1
|
|
||||||
\ , 'do_special_mapping' : 0
|
\ , 'do_special_mapping' : 0
|
||||||
\ , 'grouping' : 1
|
\ , 'grouping' : 1
|
||||||
\ , 'startofline' : 1
|
\ , 'startofline' : 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user