From bfaf71533c5dca06a80388655b6468bcc06286ad Mon Sep 17 00:00:00 2001 From: haya14busa Date: Thu, 20 Feb 2014 06:18:11 +0900 Subject: [PATCH 1/3] Fix unused variable cnt in DotRepeat --- autoload/EasyMotion.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index fdfd261..0af1abf 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -291,10 +291,12 @@ function! EasyMotion#DotRepeat(visualmode) " {{{ let s:flag.bd_t = s:dot_repeat.bd_t_flag let s:current.is_operator = 1 - for cnt in range(v:count1) + let i = 0 + while i < v:count1 let s:flag.dot_repeat = 1 " s:EasyMotion() always call reset silent call s:EasyMotion(re, direction, 0, is_inclusive) - endfor + let i += 1 + endwhile return s:EasyMotion_is_cancelled endfunction " }}} function! EasyMotion#NextPrevious(visualmode, direction) " {{{ From 278028761c883b16ae1e742d3fb590b295afa8cf Mon Sep 17 00:00:00 2001 From: haya14busa Date: Thu, 20 Feb 2014 06:29:39 +0900 Subject: [PATCH 2/3] Improve by vimlint --- autoload/EasyMotion.vim | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 0af1abf..f902c64 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -3,7 +3,7 @@ " Author: Kim Silkebækken " haya14busa " Source: https://github.com/Lokaltog/vim-easymotion -" Last Change: 19 Feb 2014. +" Last Change: 20 Feb 2014. "============================================================================= " Saving 'cpoptions' {{{ scriptencoding utf-8 @@ -756,7 +756,7 @@ endfunction "}}} function! s:GroupingAlgorithmOriginal(targets, keys) " Split targets into groups (1 level) let targets_len = len(a:targets) - let keys_len = len(a:keys) + " let keys_len = len(a:keys) let groups = {} @@ -882,9 +882,9 @@ function! s:PromptUser(groups) "{{{ let target_line_byte_len = strlen(lines[line_num]['marker']) - let target_char_byte_len = strlen(matchstr( - \ lines[line_num]['marker'], - \ '\%' . col_num . 'c.')) + " let target_char_byte_len = strlen(matchstr( + " \ lines[line_num]['marker'], + " \ '\%' . col_num . 'c.')) if strlen(lines[line_num]['marker']) > 0 " Substitute marker character if line length > 0 @@ -1234,7 +1234,7 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive) " {{{ elseif a:direction == 0 " Forward let shade_hl_re = '\%#\_.*\%'. win_last_line .'l' - elseif a:direction == 2 + else " Both directions" let shade_hl_re = '\_.*' endif From 21783232a608950cfdfd1caa5ee11663cfe59a3d Mon Sep 17 00:00:00 2001 From: haya14busa Date: Thu, 20 Feb 2014 06:47:11 +0900 Subject: [PATCH 3/3] Improve default mapping helper func performance --- plugin/EasyMotion.vim | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index 146eb41..c1b74fc 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -3,7 +3,7 @@ " Author: Kim Silkebækken " haya14busa " Source: https://github.com/Lokaltog/vim-easymotion -" Last Change: 18 Feb 2014. +" Last Change: 20 Feb 2014. " == Script initialization {{{ if expand("%:p") ==# expand(":p") unlet! g:EasyMotion_loaded @@ -299,7 +299,7 @@ if g:EasyMotion_do_mapping == 1 "}}} function! s:default_mapping(motions, do_mapping) "{{{ - for [motion, fn] in items(a:motions) + for motion in a:motions " Mapping {{{ if exists('g:EasyMotion_mapping_' . motion) " Backward compatible mapping [deprecated] @@ -317,25 +317,10 @@ if g:EasyMotion_do_mapping == 1 endfunction "}}} " Default Mapping: - call s:default_mapping({ - \ 'f' : { 'name': 'S' , 'dir': 0 } - \ , 'F' : { 'name': 'S' , 'dir': 1 } - \ , 's' : { 'name': 'S' , 'dir': 2 } - \ , 't' : { 'name': 'T' , 'dir': 0 } - \ , 'T' : { 'name': 'T' , 'dir': 1 } - \ , 'w' : { 'name': 'WB' , 'dir': 0 } - \ , 'W' : { 'name': 'WBW' , 'dir': 0 } - \ , 'b' : { 'name': 'WB' , 'dir': 1 } - \ , 'B' : { 'name': 'WBW' , 'dir': 1 } - \ , 'e' : { 'name': 'E' , 'dir': 0 } - \ , 'E' : { 'name': 'EW' , 'dir': 0 } - \ , 'ge': { 'name': 'E' , 'dir': 1 } - \ , 'gE': { 'name': 'EW' , 'dir': 1 } - \ , 'j' : { 'name': 'JK' , 'dir': 0 } - \ , 'k' : { 'name': 'JK' , 'dir': 1 } - \ , 'n' : { 'name': 'Search' , 'dir': 0 } - \ , 'N' : { 'name': 'Search' , 'dir': 1 } - \ }, g:EasyMotion_do_mapping) + call s:default_mapping( + \ ['f', 'F', 's', 't', 'T', + \ 'w', 'W', 'b', 'B', 'e', 'E', 'ge', 'gE', + \ 'j', 'k', 'n', 'N'], g:EasyMotion_do_mapping) endif "}}} " == CommandLine Mapping {{{