From 93de27f7bde75b85f009e7d34d9fa8bb687b9b23 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Tue, 18 Feb 2014 17:41:32 +0900 Subject: [PATCH] Add g:EasyMotion_disable_two_key_combo Set this value 1 if you want to disable two key combo close #106 --- autoload/EasyMotion.vim | 12 ++++++++---- plugin/EasyMotion.vim | 6 ++++-- t/easymotion_spec.vim | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index a931387..02420e4 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -887,7 +887,9 @@ function! s:PromptUser(groups) "{{{ if strlen(lines[line_num]['marker']) > 0 " Substitute marker character if line length > 0 let c = 0 - while c < target_key_len && c < 2 + let marker_max_length = g:EasyMotion_disable_two_key_combo == 1 + \ ? 1 : 2 + while c < target_key_len && c < marker_max_length if strlen(lines[line_num]['marker']) >= col_num + c " Substitute marker character if line length > 0 if c == 0 @@ -922,9 +924,11 @@ function! s:PromptUser(groups) "{{{ call EasyMotion#highlight#add_highlight( \ '\%' . line_num . 'l\%' . col_num . 'c', \ g:EasyMotion_hl2_first_group_target) - call EasyMotion#highlight#add_highlight( - \ '\%' . line_num . 'l\%' . (col_num + 1) . 'c', - \ g:EasyMotion_hl2_second_group_target) + if g:EasyMotion_disable_two_key_combo == 1 + call EasyMotion#highlight#add_highlight( + \ '\%' . line_num . 'l\%' . (col_num + 1) . 'c', + \ g:EasyMotion_hl2_second_group_target) + endif endif "}}} diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index 5dec4ae..146eb41 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: 13 Feb 2014. +" Last Change: 18 Feb 2014. " == Script initialization {{{ if expand("%:p") ==# expand(":p") unlet! g:EasyMotion_loaded @@ -42,12 +42,14 @@ let g:EasyMotion_cursor_highlight = get(g: , 'EasyMotion_cursor_highlight' , let g:EasyMotion_use_regexp = get(g: , 'EasyMotion_use_regexp' , 1) let g:EasyMotion_add_search_history = get(g: , 'EasyMotion_add_search_history' , 1) let g:EasyMotion_off_screen_search = get(g: , 'EasyMotion_off_screen_search' , 1) -let g:EasyMotion_force_csapprox = get(g: , 'EasyMotion_force_csapprox' , 0) +let g:EasyMotion_force_csapprox = get(g: , 'EasyMotion_force_csapprox' , 0) let g:EasyMotion_show_prompt = get(g: , 'EasyMotion_show_prompt' , 1) let g:EasyMotion_prompt = \ get(g: , 'EasyMotion_prompt' , 'Search for {n} character(s): ') let g:EasyMotion_command_line_key_mappings = \ get(g: , 'EasyMotion_command_line_key_mappings' , {}) +let g:EasyMotion_disable_two_key_combo = + \ get(g: , 'EasyMotion_disable_two_key_combo' , 0) "}}} diff --git a/t/easymotion_spec.vim b/t/easymotion_spec.vim index a1d233d..175c544 100644 --- a/t/easymotion_spec.vim +++ b/t/easymotion_spec.vim @@ -487,6 +487,7 @@ describe 'Default settings' Expect g:EasyMotion_prompt ==# 'Search for {n} character(s): ' Expect g:EasyMotion_command_line_key_mappings ==# {} Expect g:EasyMotion_force_csapprox ==# 0 + Expect g:EasyMotion_disable_two_key_combo ==# 0 " }}} " highlight {{{