Add prompt option

This commit is contained in:
haya14busa 2014-01-14 06:29:36 +09:00
parent 008498ae4b
commit 7ab69a7dc2
2 changed files with 8 additions and 4 deletions

View File

@ -411,15 +411,17 @@ function! s:GetChar() " {{{
endfunction " }}} endfunction " }}}
function! s:InputPrompt(message, input) "{{{ function! s:InputPrompt(message, input) "{{{
redraw redraw
echohl Question echohl Question | echon a:message | echohl None
echo a:message ': ' . a:input echon a:input
echohl None
endfunction "}}} endfunction "}}}
function! s:GetInput(num_strokes) "{{{ function! s:GetInput(num_strokes) "{{{
let input = '' let input = ''
" repeat a:num_strokes times " repeat a:num_strokes times
while s:strchars(input) < a:num_strokes while s:strchars(input) < a:num_strokes
call s:InputPrompt('Input', input) " if a:num_strokes > 1 && g:EasyMotion_show_prompt
if g:EasyMotion_show_prompt
call s:InputPrompt(g:EasyMotion_prompt, input)
endif
let c = getchar() let c = getchar()
let char = type(c) == type(0) ? nr2char(c) : c let char = type(c) == type(0) ? nr2char(c) : c
if char ==# "\<Esc>" || char2nr(char) == 128 if char ==# "\<Esc>" || char2nr(char) == 128

View File

@ -31,6 +31,8 @@ let g:EasyMotion_skipfoldedline = get(g: , 'EasyMotion_skipfoldedline' ,
let g:EasyMotion_use_migemo = get(g: , 'EasyMotion_use_migemo' , 0) let g:EasyMotion_use_migemo = get(g: , 'EasyMotion_use_migemo' , 0)
let g:EasyMotion_use_upper = get(g: , 'EasyMotion_use_upper' , 0) 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_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' , '> ')
"}}} "}}}
" -- Default highlighting ---------------- {{{ " -- Default highlighting ---------------- {{{