Support JumpToAnywhere motion!

You can config this motion by g:EasyMotion_re_anywhere in your vimrc
Example:

    let g:EasyMotion_re_anywhere = '\v(<.|.>|^$)'
This commit is contained in:
haya14busa 2013-12-20 16:48:13 +09:00
parent ead7164a4b
commit d739e65270
2 changed files with 19 additions and 0 deletions

View File

@ -127,6 +127,24 @@ endfunction "}}}
call s:EasyMotion(@/, a:direction, a:visualmode ? visualmode() : '', '') call s:EasyMotion(@/, a:direction, a:visualmode ? visualmode() : '', '')
endfunction " }}} endfunction " }}}
function! EasyMotion#JumpToAnywhere(visualmode, direction) " {{{
let re = '\v' .
\ '(<.|^$)' . '|' .
\ '(.>|^$)' . '|' .
\ '(\l)\zs(\u)' . '|' .
\ '(_\zs.)' . '|' .
\ '(#\zs.)'
" Anywhere regular expression: {{{
" 1. word
" 2. end of word
" 3. CamelCase
" 4. after '_' hoge_foo
" 5. after '#' hoge#foo
" }}}
let g:EasyMotion_re_anywhere = get(g:, 'EasyMotion_re_anywhere', re)
call s:EasyMotion( g:EasyMotion_re_anywhere, a:direction, a:visualmode ? visualmode() : '', '')
endfunction " }}}
function! EasyMotion#SelectLines() "{{{ function! EasyMotion#SelectLines() "{{{
let orig_pos = [line('.'), col('.')] let orig_pos = [line('.'), col('.')]

View File

@ -117,6 +117,7 @@ set cpo&vim
\ , 'bd-e' : { 'name': 'E' , 'dir': 2 } \ , 'bd-e' : { 'name': 'E' , 'dir': 2 }
\ , 'bd-n' : { 'name': 'Search' , 'dir': 2 } \ , 'bd-n' : { 'name': 'Search' , 'dir': 2 }
\ , 'bd-jk' : { 'name': 'JK' , 'dir': 2 } \ , 'bd-jk' : { 'name': 'JK' , 'dir': 2 }
\ , 'jumptoanywhere' : { 'name': 'JumpToAnywhere' , 'dir': 2 }
\ }, 0) " Prepare <Plug> but don't map by default. \ }, 0) " Prepare <Plug> but don't map by default.
" }}} " }}}
" }}} " }}}