Modify prompt message and make it more configurable
This commit is contained in:
parent
4728a9dcbd
commit
9c0183faa7
@ -40,14 +40,30 @@ function! s:Cancell() " {{{
|
||||
return ''
|
||||
endfunction " }}}
|
||||
|
||||
function! s:getPromptMessage(num_strokes)
|
||||
if a:num_strokes == 1
|
||||
let prompt = substitute(
|
||||
\ substitute(g:EasyMotion_prompt,'{n}', a:num_strokes, 'g'),
|
||||
\ '(s)', '', 'g')
|
||||
elseif a:num_strokes == -1
|
||||
let prompt = substitute(
|
||||
\ substitute(g:EasyMotion_prompt, '{n}\s\{0,1}', '', 'g'),
|
||||
\ '(s)', 's', 'g')
|
||||
else
|
||||
let prompt = substitute(
|
||||
\ substitute(g:EasyMotion_prompt,'{n}', a:num_strokes, 'g'),
|
||||
\ '(s)', 's', 'g')
|
||||
endif
|
||||
return prompt
|
||||
endfunction
|
||||
|
||||
function! EasyMotion#command_line#GetInput(num_strokes, ...) "{{{
|
||||
let previous_input = a:0 == 1 ? a:1 : ''
|
||||
let input = ''
|
||||
" repeat a:num_strokes times
|
||||
let prompt_num = a:num_strokes != -1 ? a:num_strokes : ''
|
||||
let prompt = prompt_num . g:EasyMotion_prompt
|
||||
let prompt = s:getPromptMessage(a:num_strokes)
|
||||
|
||||
while EasyMotion#helper#strchars(input) < a:num_strokes ||
|
||||
\ a:num_strokes == -1
|
||||
\ a:num_strokes == -1
|
||||
if g:EasyMotion_show_prompt
|
||||
call s:InputPrompt(prompt, input)
|
||||
endif
|
||||
|
@ -32,7 +32,8 @@ let g:EasyMotion_use_migemo = get(g: , 'EasyMotion_use_migemo' ,
|
||||
let g:EasyMotion_use_upper = get(g: , 'EasyMotion_use_upper' , 0)
|
||||
let g:EasyMotion_enter_jump_first = get(g: , 'EasyMotion_enter_jump_first' , 0)
|
||||
let g:EasyMotion_show_prompt = get(g: , 'EasyMotion_show_prompt' , 1)
|
||||
let g:EasyMotion_prompt = get(g: , 'EasyMotion_prompt' , '> ')
|
||||
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' , {})
|
||||
|
||||
|
@ -425,7 +425,7 @@ describe 'Default settings'
|
||||
Expect g:EasyMotion_use_upper ==# 0
|
||||
Expect g:EasyMotion_enter_jump_first ==# 0
|
||||
Expect g:EasyMotion_show_prompt ==# 1
|
||||
Expect g:EasyMotion_prompt ==# '> '
|
||||
Expect g:EasyMotion_prompt ==# 'Search for {n} character(s): '
|
||||
Expect g:EasyMotion_command_line_key_mappings ==# {}
|
||||
" }}}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user