From 93de27f7bde75b85f009e7d34d9fa8bb687b9b23 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Tue, 18 Feb 2014 17:41:32 +0900 Subject: [PATCH 1/2] 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 {{{ From 78c0f4a1b51a7e1bcf903d608929575fe1644c37 Mon Sep 17 00:00:00 2001 From: haya14busa Date: Tue, 18 Feb 2014 17:52:12 +0900 Subject: [PATCH 2/2] Update doc: g:Easymotion_disable_two_key_combo --- doc/easymotion.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/easymotion.txt b/doc/easymotion.txt index f5160ac..a64b2ca 100644 --- a/doc/easymotion.txt +++ b/doc/easymotion.txt @@ -30,7 +30,9 @@ CONTENTS *easymotion-contents* EasyMotion_enter_jump_first ..... |EasyMotion_enter_jump_first| EasyMotion_prompt ............... |EasyMotion_prompt| EasyMotion_highlight ............ |EasyMotion_highlight| - EasyMotion_add_search_history.... |EasyMotion_add_search_history| + EasyMotion_add_search_history ... |EasyMotion_add_search_history| + EasyMotion_off_screen_search .... |EasyMotion_off_screen_search| + EasyMotion_disable_two_key_combo. |EasyMotion_disable_two_key_combo| Custom highlighting ............. |easymotion-custom-hl| Custom mappings ................. |easymotion-custom-mappings| Leader key .................. |easymotion-leader-key| @@ -938,6 +940,14 @@ EasyMotion_off_screen_search *g:EasyMotion_off_screen_search* < Default: 0 +EasyMotion_disable_two_key_combo *g:EasyMotion_disable_two_key_combo* + + If you set this option to 1, you can disable two key combo feature. +> + let g:EasyMotion_disable_two_key_combo = 1 +< + Default: 0 + ------------------------------------------------------------------------------ Custom highlighting *easymotion-custom-hl*