Implement g:Easymotion_add_search_history option
This commit is contained in:
parent
33bf1de0f8
commit
c6a01fe473
@ -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
|
||||
|
||||
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) "{{{
|
||||
|
@ -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): ')
|
||||
|
@ -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 ==# {}
|
||||
" }}}
|
||||
|
Loading…
Reference in New Issue
Block a user