Merge pull request #241 from somini/master

Introduce verbose option
This commit is contained in:
haya14busa 2016-01-18 03:16:52 +09:00
commit c9cc9ecd64
5 changed files with 58 additions and 3 deletions

View File

@ -391,7 +391,13 @@ endfunction " }}}
" Helper Functions: {{{
" -- Message -----------------------------
function! s:Message(message) " {{{
echo 'EasyMotion: ' . a:message
if g:EasyMotion_verbose
echo 'EasyMotion: ' . a:message
else
" Make the current message dissapear
echo ''
" redraw
endif
endfunction " }}}
function! s:Prompt(message) " {{{
echohl Question
@ -1517,7 +1523,8 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive, ...) " {{{
redraw
" Show exception message
if g:EasyMotion_ignore_exception != 1
" The verbose option will take precedence
if g:EasyMotion_verbose == 1 && g:EasyMotion_ignore_exception != 1
echo v:exception
endif

View File

@ -206,7 +206,9 @@ function! s:Cancell() " {{{
call EasyMotion#highlight#delete_highlight()
call EasyMotion#helper#VarReset('&scrolloff')
keepjumps call setpos('.', s:save_orig_pos)
echo 'EasyMotion: Cancelled'
if g:EasyMotion_verbose
echo 'EasyMotion: Cancelled'
endif
return ''
endfunction " }}}
function! s:getPromptMessage(num_strokes) "{{{

View File

@ -33,6 +33,7 @@ CONTENTS *easymotion-contents*
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|
EasyMotion_verbose .............. |EasyMotion_verbose|
Custom highlighting ............. |easymotion-custom-hl|
Custom mappings ................. |easymotion-custom-mappings|
Leader key .................. |easymotion-leader-key|
@ -938,6 +939,16 @@ EasyMotion_disable_two_key_combo *g:EasyMotion_disable_two_key_combo*
<
Default: 0
EasyMotion_verbose *g:EasyMotion_verbose*
If you set this option to 0, you can disable all the messages the plugin
creates, such as "EasyMotion: Jumping to [l,c]" and "EasyMotion:
Cancelled".
>
let g:EasyMotion_verbose = 0
<
Default: 1
------------------------------------------------------------------------------
Custom highlighting *easymotion-custom-hl*

View File

@ -44,6 +44,7 @@ let g:EasyMotion_add_search_history = get(g: , 'EasyMotion_add_search_history' ,
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_show_prompt = get(g: , 'EasyMotion_show_prompt' , 1)
let g:EasyMotion_verbose = get(g: , 'EasyMotion_verbose' , 1)
let g:EasyMotion_prompt =
\ get(g: , 'EasyMotion_prompt' , 'Search for {n} character(s): ')
let g:EasyMotion_command_line_key_mappings =

View File

@ -1432,6 +1432,40 @@ describe 'Word motion'
end
"}}}
end
describe 'Verbose'
before
new
map s <Plug>(easymotion-s)
map f <Plug>(easymotion-f)
map F <Plug>(easymotion-F)
map t <Plug>(easymotion-t)
map T <Plug>(easymotion-T)
call EasyMotion#init()
call AddLine('some words in the sentence')
end
after
close!
end
it 'Verbose global variable'
Expect g:EasyMotion_verbose ==# 1
end
it 'Turned On'
let g:EasyMotion_verbose = 1
let &verbosefile = tempname()
normal sa
" TODO: l:tmp_name_verbose should have one line
end
it 'Turned Off'
let g:EasyMotion_verbose = 0
let &verbosefile = &verbosefile
normal s_
" TODO: l:tmp_name_not_verbose should have no lines
end
end
"}}}
" vim: fdm=marker:et:ts=4:sw=4:sts=4