Modify EasyMotion#User

This commit is contained in:
haya14busa 2014-01-14 01:02:43 +09:00
parent b9ece15e1c
commit 67f5afde53
2 changed files with 16 additions and 28 deletions

View File

@ -313,9 +313,10 @@ function! EasyMotion#SelectPhraseDelete() "{{{
endif endif
endfunction "}}} endfunction "}}}
" -- User Motion ------------------------- " -- User Motion -------------------------
function! EasyMotion#User(pattern, visualmode, direction) " {{{ function! EasyMotion#User(pattern, mode, direction) " {{{
let visualmode = match('\v([Vv])|(C-v)', a:mode) > 0 ? visualmode() : ''
let re = escape(a:pattern, '|') let re = escape(a:pattern, '|')
call s:EasyMotion(re, a:direction, a:visualmode ? visualmode() : '', mode(1)) call s:EasyMotion(re, a:direction, visualmode, a:mode)
endfunction " }}} endfunction " }}}
function! EasyMotion#UserMapping(re, mapping, direction) " {{{ function! EasyMotion#UserMapping(re, mapping, direction) " {{{
silent exec "nnoremap ".a:mapping." :call EasyMotion#User('".a:re."', 0, ".a:direction.")<CR>" silent exec "nnoremap ".a:mapping." :call EasyMotion#User('".a:re."', 0, ".a:direction.")<CR>"

View File

@ -101,36 +101,25 @@ augroup end
" -- Find Motion {{{ " -- Find Motion {{{
" F: {{{ " F: {{{
noremap <silent><expr><Plug>(easymotion-s) " (cound, visual, direction)
\ ':<C-u>call EasyMotion#S(1, "' . EasyMotion#helper#mode(1) . '" ,2)<CR>' noremap <silent><Plug>(easymotion-f) :<C-u>call EasyMotion#S(1,0,0)<CR>
xnoremap <silent><expr><Plug>(easymotion-s) xnoremap <silent><Plug>(easymotion-f) <ESC>:<C-u>call EasyMotion#S(1,1,0)<CR>
\ '<Esc>:<C-u>call EasyMotion#S(1, "' . EasyMotion#helper#mode(1) . '" ,2)<CR>' noremap <silent><Plug>(easymotion-F) :<C-u>call EasyMotion#S(1,0,1)<CR>
noremap <silent><expr><Plug>(easymotion-f) xnoremap <silent><Plug>(easymotion-F) <ESC>:<C-u>call EasyMotion#S(1,1,1)<CR>
\ ':<C-u>call EasyMotion#S(1, "' . EasyMotion#helper#mode(1) . '" ,0)<CR>' noremap <silent><Plug>(easymotion-s) :<C-u>call EasyMotion#S(1,0,2)<CR>
xnoremap <silent><expr><Plug>(easymotion-f) xnoremap <silent><Plug>(easymotion-s) <ESC>:<C-u>call EasyMotion#S(1,1,2)<CR>
\ '<Esc>:<C-u>call EasyMotion#S(1, "' . EasyMotion#helper#mode(1) . '" ,0)<CR>'
noremap <silent><expr><Plug>(easymotion-F)
\ ':<C-u>call EasyMotion#S(1, "' . EasyMotion#helper#mode(1) . '" ,1)<CR>'
xnoremap <silent><expr><Plug>(easymotion-F)
\ '<Esc>:<C-u>call EasyMotion#S(1, "' . EasyMotion#helper#mode(1) . '" ,1)<CR>'
"}}} "}}}
" T: {{{ " T: {{{
noremap <silent><expr><Plug>(easymotion-t) noremap <silent><Plug>(easymotion-t) :<C-u>call EasyMotion#T(1,0,0)<CR>
\ ':<C-u>call EasyMotion#T(1, "' . EasyMotion#helper#mode(1) . '" ,0)<CR>' xnoremap <silent><Plug>(easymotion-t) <ESC>:<C-u>call EasyMotion#T(1,1,0)<CR>
xnoremap <silent><expr><Plug>(easymotion-t) noremap <silent><Plug>(easymotion-T) :<C-u>call EasyMotion#T(1,0,1)<CR>
\ '<Esc>:<C-u>call EasyMotion#T(1, "' . EasyMotion#helper#mode(1) . '" ,0)<CR>' xnoremap <silent><Plug>(easymotion-T) <ESC>:<C-u>call EasyMotion#T(1,1,1)<CR>
noremap <silent><expr><Plug>(easymotion-T)
\ ':<C-u>call EasyMotion#T(1, "' . EasyMotion#helper#mode(1) . '" ,1)<CR>'
xnoremap <silent><expr><Plug>(easymotion-T)
\ '<Esc>:<C-u>call EasyMotion#T(1, "' . EasyMotion#helper#mode(1) . '" ,1)<CR>'
"}}} "}}}
" Multi: {{{ " Multi: {{{
noremap <silent><expr><Plug>(easymotion-s2) noremap <silent><Plug>(easymotion-s2) :<C-u>call EasyMotion#S(2,0,2)<CR>
\ ':<C-u>call EasyMotion#S(2, "' . EasyMotion#helper#mode(1) . '" ,2)<CR>' xnoremap <silent><Plug>(easymotion-s2) <Esc>:<C-u>call EasyMotion#S(2,1,2)<CR>
xnoremap <silent><expr><Plug>(easymotion-s)
\ '<Esc>:<C-u>call EasyMotion#S(2, "' . EasyMotion#helper#mode(1) . '" ,2)<CR>'
"}}} "}}}
"}}} "}}}
@ -213,7 +202,6 @@ xnoremap <silent><Plug>(easymotion-repeat)
" -- Line Motion {{{ " -- Line Motion {{{
" F Line: {{{ " F Line: {{{
" (cound, visual, direction)
noremap <silent><Plug>(easymotion-fl) :<C-u>call EasyMotion#SL(1,0,0)<CR> noremap <silent><Plug>(easymotion-fl) :<C-u>call EasyMotion#SL(1,0,0)<CR>
xnoremap <silent><Plug>(easymotion-fl) <Esc>:<C-u>call EasyMotion#SL(1,1,0)<CR> xnoremap <silent><Plug>(easymotion-fl) <Esc>:<C-u>call EasyMotion#SL(1,1,0)<CR>
noremap <silent><Plug>(easymotion-Fl) :<C-u>call EasyMotion#SL(1,0,1)<CR> noremap <silent><Plug>(easymotion-Fl) :<C-u>call EasyMotion#SL(1,0,1)<CR>
@ -223,7 +211,6 @@ xnoremap <silent><Plug>(easymotion-sl) <Esc>:<C-u>call EasyMotion#SL(1,1,2)<CR>
"}}} "}}}
" T Line: {{{ " T Line: {{{
" (cound, visual, direction)
noremap <silent><Plug>(easymotion-tl) :<C-u>call EasyMotion#TL(1,0,0)<CR> noremap <silent><Plug>(easymotion-tl) :<C-u>call EasyMotion#TL(1,0,0)<CR>
xnoremap <silent><Plug>(easymotion-tl) <Esc>:<C-u>call EasyMotion#TL(1,1,0)<CR> xnoremap <silent><Plug>(easymotion-tl) <Esc>:<C-u>call EasyMotion#TL(1,1,0)<CR>
noremap <silent><Plug>(easymotion-Tl) :<C-u>call EasyMotion#TL(1,0,1)<CR> noremap <silent><Plug>(easymotion-Tl) :<C-u>call EasyMotion#TL(1,0,1)<CR>