add support for vim's default iskeyword-style word motion'

This commit is contained in:
Yue Xin 2014-02-18 11:02:37 +08:00
parent ff4bdedaa4
commit 02d4f0fc12
2 changed files with 31 additions and 0 deletions

View File

@ -160,6 +160,12 @@ function! EasyMotion#WBW(visualmode, direction) " {{{
call s:EasyMotion('\(\(^\|\s\)\@<=\S\|^$\)', a:direction, a:visualmode ? visualmode() : '', 0) call s:EasyMotion('\(\(^\|\s\)\@<=\S\|^$\)', a:direction, a:visualmode ? visualmode() : '', 0)
return s:EasyMotion_is_cancelled return s:EasyMotion_is_cancelled
endfunction " }}} endfunction " }}}
function! EasyMotion#WBK(visualmode, direction) " {{{
" vim's iskeyword style word motion
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
call s:EasyMotion('\(\(\<\|\>\|\s\)\@<=\S\|^$\)', a:direction, a:visualmode ? visualmode() : '', 0)
return s:EasyMotion_is_cancelled
endfunction " }}}
function! EasyMotion#E(visualmode, direction) " {{{ function! EasyMotion#E(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0 let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_inclusive = mode(1) ==# 'no' ? 1 : 0 let is_inclusive = mode(1) ==# 'no' ? 1 : 0
@ -172,6 +178,13 @@ function! EasyMotion#EW(visualmode, direction) " {{{
call s:EasyMotion('\(\S\(\s\|$\)\|^$\)', a:direction, a:visualmode ? visualmode() : '', is_inclusive) call s:EasyMotion('\(\S\(\s\|$\)\|^$\)', a:direction, a:visualmode ? visualmode() : '', is_inclusive)
return s:EasyMotion_is_cancelled return s:EasyMotion_is_cancelled
endfunction " }}} endfunction " }}}
function! EasyMotion#EK(visualmode, direction) " {{{
" vim's iskeyword style word motion
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0
let is_inclusive = mode(1) ==# 'no' ? 1 : 0
call s:EasyMotion('\(\S\(\>\|\<\|\s\)\@=\|^$\)', a:direction, a:visualmode ? visualmode() : '', is_inclusive)
return s:EasyMotion_is_cancelled
endfunction " }}}
" -- JK Motion --------------------------- " -- JK Motion ---------------------------
function! EasyMotion#JK(visualmode, direction) " {{{ function! EasyMotion#JK(visualmode, direction) " {{{
let s:current.is_operator = mode(1) ==# 'no' ? 1: 0 let s:current.is_operator = mode(1) ==# 'no' ? 1: 0

View File

@ -136,6 +136,15 @@ noremap <silent><Plug>(easymotion-bd-W) :<C-u>call EasyMotion#WBW(0,2)<CR>
xnoremap <silent><Plug>(easymotion-bd-W) <Esc>:<C-u>call EasyMotion#WBW(1,2)<CR> xnoremap <silent><Plug>(easymotion-bd-W) <Esc>:<C-u>call EasyMotion#WBW(1,2)<CR>
"}}} "}}}
" iskeyword {{{
noremap <silent><Plug>(easymotion-iskeyword-w) :<C-u>call EasyMotion#WBK(0,0)<CR>
xnoremap <silent><Plug>(easymotion-iskeyword-w) <Esc>:<C-u>call EasyMotion#WBK(1,0)<CR>
noremap <silent><Plug>(easymotion-iskeyword-b) :<C-u>call EasyMotion#WBK(0,1)<CR>
xnoremap <silent><Plug>(easymotion-iskeyword-b) <Esc>:<C-u>call EasyMotion#WBK(1,1)<CR>
noremap <silent><Plug>(easymotion-iskeyword-bd-w) :<C-u>call EasyMotion#WBK(0,2)<CR>
xnoremap <silent><Plug>(easymotion-iskeyword-bd-w) <Esc>:<C-u>call EasyMotion#WBK(1,2)<CR>
" }}}
" End Word: {{{ " End Word: {{{
noremap <silent><Plug>(easymotion-e) :<C-u>call EasyMotion#E(0,0)<CR> noremap <silent><Plug>(easymotion-e) :<C-u>call EasyMotion#E(0,0)<CR>
xnoremap <silent><Plug>(easymotion-e) <Esc>:<C-u>call EasyMotion#E(1,0)<CR> xnoremap <silent><Plug>(easymotion-e) <Esc>:<C-u>call EasyMotion#E(1,0)<CR>
@ -153,6 +162,15 @@ xnoremap <silent><Plug>(easymotion-gE) <Esc>:<C-u>call EasyMotion#EW(1,1)<CR>
noremap <silent><Plug>(easymotion-bd-E) :<C-u>call EasyMotion#EW(0,2)<CR> noremap <silent><Plug>(easymotion-bd-E) :<C-u>call EasyMotion#EW(0,2)<CR>
xnoremap <silent><Plug>(easymotion-bd-E) <Esc>:<C-u>call EasyMotion#EW(1,2)<CR> xnoremap <silent><Plug>(easymotion-bd-E) <Esc>:<C-u>call EasyMotion#EW(1,2)<CR>
"}}} "}}}
" iskeyword End: {{{
noremap <silent><Plug>(easymotion-iskeyword-e) :<C-u>call EasyMotion#EK(0,0)<CR>
xnoremap <silent><Plug>(easymotion-iskeyword-e) <Esc>:<C-u>call EasyMotion#EK(1,0)<CR>
noremap <silent><Plug>(easymotion-iskeyword-ge) :<C-u>call EasyMotion#EK(0,1)<CR>
xnoremap <silent><Plug>(easymotion-iskeyword-ge) <Esc>:<C-u>call EasyMotion#EK(1,1)<CR>
noremap <silent><Plug>(easymotion-iskeyword-bd-e) :<C-u>call EasyMotion#EK(0,2)<CR>
xnoremap <silent><Plug>(easymotion-iskeyword-bd-e) <Esc>:<C-u>call EasyMotion#EK(1,2)<CR>
"}}}
"}}} "}}}
" -- JK Motion {{{ " -- JK Motion {{{