diff --git a/autoload/EasyMotion.vim b/autoload/EasyMotion.vim index 3505065..53b83d1 100644 --- a/autoload/EasyMotion.vim +++ b/autoload/EasyMotion.vim @@ -552,7 +552,11 @@ function! s:findMotion(num_strokes) "{{{ let s:current.is_operator = mode(1) ==# 'no' ? 1: 0 let s:flag.regexp = a:num_strokes == -1 ? 1 : 0 - let s:previous['input'] = get(s:previous, 'input', '') + if g:EasyMotion_add_search_history && a:num_strokes == -1 + let s:previous['input'] = @/ + else + let s:previous['input'] = get(s:previous, 'input', '') + endif let input = EasyMotion#command_line#GetInput(a:num_strokes, s:previous.input) let s:previous['input'] = input @@ -562,6 +566,11 @@ function! s:findMotion(num_strokes) "{{{ endif let re = s:convertRegep(input) + + if g:EasyMotion_add_search_history && a:num_strokes == -1 + let @/ = re + endif + return re endfunction "}}} function! s:convertRegep(input) "{{{ diff --git a/plugin/EasyMotion.vim b/plugin/EasyMotion.vim index 377e965..9694dfe 100644 --- a/plugin/EasyMotion.vim +++ b/plugin/EasyMotion.vim @@ -40,6 +40,7 @@ let g:EasyMotion_inc_highlight = get(g: , 'EasyMotion_inc_highlight' , let g:EasyMotion_move_highlight = get(g: , 'EasyMotion_move_highlight' , 1) let g:EasyMotion_landing_highlight = get(g: , 'EasyMotion_landing_highlight' , 0) let g:EasyMotion_cursor_highlight = get(g: , 'EasyMotion_cursor_highlight' , 0) +let g:EasyMotion_add_search_history = get(g: , 'EasyMotion_add_search_history' , 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): ') diff --git a/t/easymotion_spec.vim b/t/easymotion_spec.vim index ee28fb1..7cd57c3 100644 --- a/t/easymotion_spec.vim +++ b/t/easymotion_spec.vim @@ -462,6 +462,7 @@ describe 'Default settings' Expect g:EasyMotion_move_highlight ==# 1 Expect g:EasyMotion_landing_highlight ==# 0 Expect g:EasyMotion_cursor_highlight ==# 0 + Expect g:EasyMotion_add_search_history ==# 0 Expect g:EasyMotion_prompt ==# 'Search for {n} character(s): ' Expect g:EasyMotion_command_line_key_mappings ==# {} " }}}