From 02d4f0fc12116136e213bb29eee679f67030b4b5 Mon Sep 17 00:00:00 2001 From: Yue Xin Date: Tue, 18 Feb 2014 11:02:37 +0800 Subject: [PATCH] add support for vim's default iskeyword-style word motion' --- autoload/EasyMotion.vim | 13 +++++++++++++ plugin/EasyMotion.vim | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index fa10e57..95459dd 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -160,6 +160,12 @@ function! EasyMotion#WBW(visualmode, direction) " {{{ call s:EasyMotion('\(\(^\|\s\)\@<=\S\|^$\)', a:direction, a:visualmode ? visualmode() : '', 0) return s:EasyMotion_is_cancelled 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) " {{{ let s:current.is_operator = 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) return s:EasyMotion_is_cancelled 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 --------------------------- function! EasyMotion#JK(visualmode, direction) " {{{ let s:current.is_operator = mode(1) ==# 'no' ? 1: 0 diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index ac03064..5dec4ae 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -136,6 +136,15 @@ noremap (easymotion-bd-W) :call EasyMotion#WBW(0,2) xnoremap (easymotion-bd-W) :call EasyMotion#WBW(1,2) "}}} +" iskeyword {{{ +noremap (easymotion-iskeyword-w) :call EasyMotion#WBK(0,0) +xnoremap (easymotion-iskeyword-w) :call EasyMotion#WBK(1,0) +noremap (easymotion-iskeyword-b) :call EasyMotion#WBK(0,1) +xnoremap (easymotion-iskeyword-b) :call EasyMotion#WBK(1,1) +noremap (easymotion-iskeyword-bd-w) :call EasyMotion#WBK(0,2) +xnoremap (easymotion-iskeyword-bd-w) :call EasyMotion#WBK(1,2) +" }}} + " End Word: {{{ noremap (easymotion-e) :call EasyMotion#E(0,0) xnoremap (easymotion-e) :call EasyMotion#E(1,0) @@ -153,6 +162,15 @@ xnoremap (easymotion-gE) :call EasyMotion#EW(1,1) noremap (easymotion-bd-E) :call EasyMotion#EW(0,2) xnoremap (easymotion-bd-E) :call EasyMotion#EW(1,2) "}}} + +" iskeyword End: {{{ +noremap (easymotion-iskeyword-e) :call EasyMotion#EK(0,0) +xnoremap (easymotion-iskeyword-e) :call EasyMotion#EK(1,0) +noremap (easymotion-iskeyword-ge) :call EasyMotion#EK(0,1) +xnoremap (easymotion-iskeyword-ge) :call EasyMotion#EK(1,1) +noremap (easymotion-iskeyword-bd-e) :call EasyMotion#EK(0,2) +xnoremap (easymotion-iskeyword-bd-e) :call EasyMotion#EK(1,2) +"}}} "}}} " -- JK Motion {{{