From 7a03e86471151abe1ba2d5a5e5764600c0a260ed Mon Sep 17 00:00:00 2001 From: haya14busa Date: Wed, 11 Jun 2014 02:34:44 +0900 Subject: [PATCH 1/2] Support count of next/previous in visual mode --- autoload/EasyMotion.vim | 3 ++- plugin/EasyMotion.vim | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 083f23d..2fee738 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -305,6 +305,7 @@ function! EasyMotion#DotRepeat(visualmode) " {{{ endfunction " }}} function! EasyMotion#NextPrevious(visualmode, direction) " {{{ " Move next/previous destination using previous motion regexp + let cnt = v:count1 " avoid overwriting if !has_key(s:previous, 'regexp') call s:Message("Previous targets doesn't exist") let s:EasyMotion_is_cancelled = 1 @@ -322,7 +323,7 @@ function! EasyMotion#NextPrevious(visualmode, direction) " {{{ " FIXME: blink highlight silent exec 'normal! gv' endif - for i in range(v:count1) + for i in range(cnt) " Do not treat this motion as 'jump' motion keepjumps call searchpos(re, search_direction) endfor diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index a807f4a..506fb86 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -237,12 +237,12 @@ xnoremap (easymotion-dotrepeat) noremap (easymotion-next) \ :call EasyMotion#NextPrevious(0,0) xnoremap (easymotion-next) - \ :call EasyMotion#NextPrevious(1,0) + \ :call EasyMotion#NextPrevious(1,0) noremap (easymotion-prev) \ :call EasyMotion#NextPrevious(0,1) xnoremap (easymotion-prev) - \ :call EasyMotion#NextPrevious(1,1) + \ :call EasyMotion#NextPrevious(1,1) "}}} " -- Line Motion {{{ From 28236c3d47a9e194f376c09bd78969c9aace83e7 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Thu, 12 Jun 2014 10:32:06 +0900 Subject: [PATCH 2/2] Next/Previous motions with counts are now jump motions --- autoload/EasyMotion.vim | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 2fee738..c83e1a0 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -323,10 +323,22 @@ function! EasyMotion#NextPrevious(visualmode, direction) " {{{ " FIXME: blink highlight silent exec 'normal! gv' endif + + " Mark jump-list + if cnt > 1 + " Consider Next/Previous motions as jump motion :h jump-motion + " Note: It should add jumplist even if the count isn't given + " considering vim's default behavior of `n` & `N`, but just + " I don't want to do it without the count. Should I add a + " option? + normal! m` + endif + + " Jump for i in range(cnt) - " Do not treat this motion as 'jump' motion keepjumps call searchpos(re, search_direction) endfor + call EasyMotion#reset() " -- Activate EasyMotion ----------------- {{{ let s:EasyMotion_is_active = 1