Refactoring EasyMotion#init#InitMappings
Now you can chose do mapping or preparing <Plug> only
This commit is contained in:
parent
0bffa2ddc2
commit
ead7164a4b
@ -41,7 +41,7 @@ function! EasyMotion#init#InitHL(group, colors) " {{{
|
||||
execute printf('hi default link %s %s', a:group, group_default)
|
||||
endfunction " }}}
|
||||
|
||||
function! EasyMotion#init#InitMappings(motions) "{{{
|
||||
function! EasyMotion#init#InitMappings(motions, do_mapping) "{{{
|
||||
for [motion, fn] in items(a:motions)
|
||||
silent exec 'nnoremap <silent>
|
||||
\ <Plug>(easymotion-' . motion . ')
|
||||
@ -52,7 +52,7 @@ function! EasyMotion#init#InitMappings(motions) "{{{
|
||||
silent exec 'vnoremap <silent>
|
||||
\ <Plug>(easymotion-' . motion . ')
|
||||
\ :<C-u>call EasyMotion#' . fn.name . '(1, ' . fn.dir . ')<CR>'
|
||||
if g:EasyMotion_do_mapping && !hasmapto('<Plug>(easymotion-' . motion . ')')
|
||||
if a:do_mapping && !hasmapto('<Plug>(easymotion-' . motion . ')')
|
||||
silent exec 'map <silent> ' .
|
||||
\ g:EasyMotion_leader_key . motion . ' <Plug>(easymotion-' . motion . ')'
|
||||
endif
|
||||
|
@ -103,7 +103,7 @@ set cpo&vim
|
||||
\ , 'k' : { 'name': 'JK' , 'dir': 1 }
|
||||
\ , 'n' : { 'name': 'Search' , 'dir': 0 }
|
||||
\ , 'N' : { 'name': 'Search' , 'dir': 1 }
|
||||
\ })
|
||||
\ }, g:EasyMotion_do_mapping)
|
||||
" }}}
|
||||
" Special mapping for other functions {{{
|
||||
call EasyMotion#init#InitSpecialMappings({
|
||||
@ -111,11 +111,13 @@ set cpo&vim
|
||||
\ , 'p' : { 'name': 'SelectPhrase'}
|
||||
\ })
|
||||
" }}}
|
||||
" More functions {{{
|
||||
noremap <Plug>(easymotion-bd-w) :<C-u>call EasyMotion#WB(0,2)<CR>
|
||||
noremap <Plug>(easymotion-bd-e) :<C-u>call EasyMotion#E(0,2)<CR>
|
||||
noremap <Plug>(easymotion-bd-n) :<C-u>call EasyMotion#Search(0,2)<CR>
|
||||
noremap <Plug>(easymotion-bd-jk) :<C-u>call EasyMotion#JK(0,2)<CR>
|
||||
" Prepare more key mapping {{{
|
||||
call EasyMotion#init#InitMappings({
|
||||
\ 'bd-w' : { 'name': 'WB' , 'dir': 2 }
|
||||
\ , 'bd-e' : { 'name': 'E' , 'dir': 2 }
|
||||
\ , 'bd-n' : { 'name': 'Search' , 'dir': 2 }
|
||||
\ , 'bd-jk' : { 'name': 'JK' , 'dir': 2 }
|
||||
\ }, 0) " Prepare <Plug> but don't map by default.
|
||||
" }}}
|
||||
" }}}
|
||||
" Restore 'cpoptions' {{{
|
||||
|
Loading…
Reference in New Issue
Block a user