From cd63e50838b4615ad121be10683e5e62a51e70a1 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Thu, 12 Jun 2014 11:50:33 +0900 Subject: [PATCH] Fix dotrepeat with count - s:EasyMotion always reset s:flag, s:current - use for instead of while --- autoload/EasyMotion.vim | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 35f9864..f9b962e 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -281,6 +281,8 @@ function! EasyMotion#Repeat(visualmode) " {{{ return s:EasyMotion_is_cancelled endfunction " }}} function! EasyMotion#DotRepeat(visualmode) " {{{ + let cnt = v:count1 " avoid overwriting + " Repeat previous '.' motion with previous targets and operator if !has_key(s:dot_repeat, 'regexp') call s:Message("Previous motion doesn't exist") @@ -291,16 +293,16 @@ function! EasyMotion#DotRepeat(visualmode) " {{{ let re = s:dot_repeat.regexp let direction = s:dot_repeat.direction let is_inclusive = s:dot_repeat.is_inclusive - let s:flag.within_line = s:dot_repeat.line_flag - let s:flag.bd_t = s:dot_repeat.bd_t_flag - let s:current.is_operator = 1 - let i = 0 - while i < v:count1 - let s:flag.dot_repeat = 1 " s:EasyMotion() always call reset + for i in range(cnt) + " s:EasyMotion() always call reset s:flag & s:current + let s:flag.dot_repeat = 1 + let s:flag.within_line = s:dot_repeat.line_flag + let s:flag.bd_t = s:dot_repeat.bd_t_flag + let s:current.is_operator = 1 + silent call s:EasyMotion(re, direction, 0, is_inclusive) - let i += 1 - endwhile + endfor return s:EasyMotion_is_cancelled endfunction " }}} function! EasyMotion#NextPrevious(visualmode, direction) " {{{