Skip to content

Commit c9cc9ec

Browse files
committed
Merge pull request easymotion#241 from somini/master
Introduce verbose option
2 parents 0ed4621 + 2d2dfa7 commit c9cc9ec

File tree

5 files changed

+58
-3
lines changed

5 files changed

+58
-3
lines changed

autoload/EasyMotion.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,13 @@ endfunction " }}}
391391
" Helper Functions: {{{
392392
" -- Message -----------------------------
393393
function! s:Message(message) " {{{
394-
echo 'EasyMotion: ' . a:message
394+
if g:EasyMotion_verbose
395+
echo 'EasyMotion: ' . a:message
396+
else
397+
" Make the current message dissapear
398+
echo ''
399+
" redraw
400+
endif
395401
endfunction " }}}
396402
function! s:Prompt(message) " {{{
397403
echohl Question
@@ -1517,7 +1523,8 @@ function! s:EasyMotion(regexp, direction, visualmode, is_inclusive, ...) " {{{
15171523
redraw
15181524

15191525
" Show exception message
1520-
if g:EasyMotion_ignore_exception != 1
1526+
" The verbose option will take precedence
1527+
if g:EasyMotion_verbose == 1 && g:EasyMotion_ignore_exception != 1
15211528
echo v:exception
15221529
endif
15231530

autoload/EasyMotion/command_line.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,9 @@ function! s:Cancell() " {{{
206206
call EasyMotion#highlight#delete_highlight()
207207
call EasyMotion#helper#VarReset('&scrolloff')
208208
keepjumps call setpos('.', s:save_orig_pos)
209-
echo 'EasyMotion: Cancelled'
209+
if g:EasyMotion_verbose
210+
echo 'EasyMotion: Cancelled'
211+
endif
210212
return ''
211213
endfunction " }}}
212214
function! s:getPromptMessage(num_strokes) "{{{

doc/easymotion.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CONTENTS *easymotion-contents*
3333
EasyMotion_add_search_history ... |EasyMotion_add_search_history|
3434
EasyMotion_off_screen_search .... |EasyMotion_off_screen_search|
3535
EasyMotion_disable_two_key_combo. |EasyMotion_disable_two_key_combo|
36+
EasyMotion_verbose .............. |EasyMotion_verbose|
3637
Custom highlighting ............. |easymotion-custom-hl|
3738
Custom mappings ................. |easymotion-custom-mappings|
3839
Leader key .................. |easymotion-leader-key|
@@ -938,6 +939,16 @@ EasyMotion_disable_two_key_combo *g:EasyMotion_disable_two_key_combo*
938939
<
939940
Default: 0
940941

942+
EasyMotion_verbose *g:EasyMotion_verbose*
943+
944+
If you set this option to 0, you can disable all the messages the plugin
945+
creates, such as "EasyMotion: Jumping to [l,c]" and "EasyMotion:
946+
Cancelled".
947+
>
948+
let g:EasyMotion_verbose = 0
949+
<
950+
Default: 1
951+
941952
------------------------------------------------------------------------------
942953
Custom highlighting *easymotion-custom-hl*
943954

plugin/EasyMotion.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ let g:EasyMotion_add_search_history = get(g: , 'EasyMotion_add_search_history' ,
4444
let g:EasyMotion_off_screen_search = get(g: , 'EasyMotion_off_screen_search' , 1)
4545
let g:EasyMotion_force_csapprox = get(g: , 'EasyMotion_force_csapprox' , 0)
4646
let g:EasyMotion_show_prompt = get(g: , 'EasyMotion_show_prompt' , 1)
47+
let g:EasyMotion_verbose = get(g: , 'EasyMotion_verbose' , 1)
4748
let g:EasyMotion_prompt =
4849
\ get(g: , 'EasyMotion_prompt' , 'Search for {n} character(s): ')
4950
let g:EasyMotion_command_line_key_mappings =

t/easymotion_spec.vim

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,40 @@ describe 'Word motion'
14321432
end
14331433
"}}}
14341434
end
1435+
1436+
describe 'Verbose'
1437+
before
1438+
new
1439+
map s <Plug>(easymotion-s)
1440+
map f <Plug>(easymotion-f)
1441+
map F <Plug>(easymotion-F)
1442+
map t <Plug>(easymotion-t)
1443+
map T <Plug>(easymotion-T)
1444+
call EasyMotion#init()
1445+
call AddLine('some words in the sentence')
1446+
end
1447+
1448+
after
1449+
close!
1450+
end
1451+
1452+
it 'Verbose global variable'
1453+
Expect g:EasyMotion_verbose ==# 1
1454+
end
1455+
1456+
it 'Turned On'
1457+
let g:EasyMotion_verbose = 1
1458+
let &verbosefile = tempname()
1459+
normal sa
1460+
" TODO: l:tmp_name_verbose should have one line
1461+
end
1462+
it 'Turned Off'
1463+
let g:EasyMotion_verbose = 0
1464+
let &verbosefile = &verbosefile
1465+
normal s_
1466+
" TODO: l:tmp_name_not_verbose should have no lines
1467+
end
1468+
end
14351469
"}}}
14361470

14371471
" vim: fdm=marker:et:ts=4:sw=4:sts=4

0 commit comments

Comments
 (0)