Issue 319 in vim: New option to not beep with 'showmatch'

190 views
Skip to first unread message

v...@googlecode.com

unread,
Jan 18, 2015, 8:26:59 PM1/18/15
to vim...@vim.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 319 by dha...@gmail.com: New option to not beep with 'showmatch'
https://code.google.com/p/vim/issues/detail?id=319

The 'showmatch' option is useful, but it's distracting that it beeps, if no
matching pair is found, e.g. when typing a smiley: :)

I think a new option like 'showmatch_silent' would be nice.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

v...@googlecode.com

unread,
Jan 18, 2015, 8:36:46 PM1/18/15
to vim...@vim.org

Comment #1 on issue 319 by dha...@gmail.com: New option to not beep
with 'showmatch'
https://code.google.com/p/vim/issues/detail?id=319

For reference, here is some question/answer about this on StackOverflow:
http://stackoverflow.com/a/24242434/15690

v...@googlecode.com

unread,
Jan 20, 2015, 4:58:01 PM1/20/15
to vim...@vim.org

Comment #2 on issue 319 by chrisbr...@googlemail.com: New option to not
Is there a problem to disable the bell altogether?

v...@googlecode.com

unread,
Jan 21, 2015, 11:38:49 AM1/21/15
to vim...@vim.org

Comment #3 on issue 319 by dha...@gmail.com: New option to not beep
with 'showmatch'
https://code.google.com/p/vim/issues/detail?id=319

The bell serves its purpose in general and disabling it altogether because
of
this seems to be overkill.

I have it disabled in my terminal (but mostly because it does not work with
pulseaudio-module-x11 there), and got confused when gvim rang it on a
smiley.

For my local setup it's ok to just comment it, but it appears to be a
common issue.

For reference, here's a patch to disable it:

diff --git i/src/search.c w/src/search.c
index 3276a77..881382c 100644
--- i/src/search.c
+++ w/src/search.c
@@ -2454,7 +2454,7 @@ showmatch(c)
}

if ((lpos = findmatch(NULL, NUL)) == NULL) /* no match, so
beep */
- vim_beep();
+ /* vim_beep(); */ ;
else if (lpos->lnum >= curwin->w_topline && lpos->lnum <
curwin->w_botline)
{
if (!curwin->w_p_wrap)


There's a setting 'errorbells' already, maybe the new setting should be
named
'showmatchbells' then?

v...@googlecode.com

unread,
Jan 21, 2015, 1:56:52 PM1/21/15
to vim...@vim.org

Comment #4 on issue 319 by chrisbr...@googlemail.com: New option to not
Anything wrong with this approach? Simply reset the bell setting when
Entering Insert mode and reset it when returning. I don't think, we want to
add another setting for that...

augroup NoError
au!
au InsertEnter * :call SetBell(1)
au InsertLeave * :call SetBell(0)
augroup END


func! SetBell(disable)
if a:disable
let s:mybell = [&eb, &vb, &t_vb]
" need to set visualbell, else bell will still be called.
set noeb vb t_vb=
else
let [&eb, &vb, &t_vb] = s:mybell
endif
endfu

v...@googlecode.com

unread,
Jan 24, 2015, 7:32:42 AM1/24/15
to vim...@vim.org

Comment #5 on issue 319 by dha...@gmail.com: New option to not beep
with 'showmatch'
https://code.google.com/p/vim/issues/detail?id=319

Thanks for your example config!

Maybe it could be added to the documentation for 'showmatch'?

Feel free to close the issue if a new option is not wanted (which I can
understand).

v...@googlecode.com

unread,
Jan 24, 2015, 7:41:51 AM1/24/15
to vim...@vim.org

Comment #6 on issue 319 by dha...@gmail.com: New option to not beep
with 'showmatch'
https://code.google.com/p/vim/issues/detail?id=319

Some drawbacks of this approach:
- there are other bell events during insert mode, e.g. pressing '<del>' at
the end of a line
- it adds some overhead to entering/leaving insert mode

v...@googlecode.com

unread,
Jan 24, 2015, 8:17:08 AM1/24/15
to vim...@vim.org

Comment #7 on issue 319 by sw...@ingo-karkat.de: New option to not beep
with 'showmatch'
https://code.google.com/p/vim/issues/detail?id=319

I agree that a native option would have advantages over this rather crude
workaround.

BTW, the beep also happens when the first candidate of a custom insert-mode
completion contains an unmatched parenthesis. Since once hasn't explicitly
types this, this is very unexpected and annoying.

v...@googlecode.com

unread,
Jan 25, 2015, 7:35:36 AM1/25/15
to vim...@vim.org

Comment #8 on issue 319 by chrisbr...@googlemail.com: New option to not
Well, perhaps we can have an option like 'beepon' that takes a list of
flags to specify when to beep. That would allow us to selectively turn off
the bell for e.g. showmatch.

v...@googlecode.com

unread,
Jan 26, 2015, 11:39:14 AM1/26/15
to vim...@vim.org

Comment #9 on issue 319 by benjamin...@rockwellcollins.com: New option to
Perhaps instead of InsertEnter/InsertLeave to disable the beep, one could
use InsertCharPre to disable specifically when entering a few choice
characters, and InsertLeave to re-enable? Oddly enough I've never noticed a
beep or flash with showmatch set.

v...@googlecode.com

unread,
Jan 27, 2015, 5:58:18 PM1/27/15
to vim...@vim.org
Updates:
Labels: patch

Comment #10 on issue 319 by chrisbr...@googlemail.com: New option to not
Here is a patch, that implements the 'bellon' option. If anybody has a
better name, I am all ear ;)
Anyway, Documentation like this:
*'bellon'* *'bo'*
'bellon' 'bo' string (default "bCceEghiLmoqrsSwy<")
global
{not in Vi}
This option lets you finetune, whenn a bell (visual or accustic) will
occur.

It is a list of flags, when the flag is set, on those occasions a bell
will b rung.
flag meaning when present ~
b error when pressing <BS> or <Del> in insert mode and the char
can't be deleted.
c Error occured when using |i_CTRL-X_CTRL-K| or |i_CTRL-X_CTRL-T|
C Fail to move around using the cursor keys or
<PageUp>/<PageDown> in insert mode.
e other Error occured (e.g. try to join last line)
E hitting <Esc> in normal mode
g unknown Char after <C-G> in insert mode
h error occued when using hangul input
i pressing <Esc> in 'insertmode'
L calling the beep module for Lua/Mzschem/TCL
m 'showmatch' error
o empty region error |cpo-E|
q In Visual mode, Hitting |Q|
r Unknown register after <C-R> in insert mode.
s Bell from shell output |:!|
S Error on spell suggest
w More matches in wild mode available
y can't copy char from insert mode using i_CTRL-Y or i_CTRL-E
< can't |g<|

This is most usefule, to finetune when in insert mode the bell should
be rung. For normal mode and ex commands, the bell is often rung to
indicate that an error occured. It can be silenced by removing the 'E'
flag then.

Build passed: https://travis-ci.org/chrisbra/vim-ci/builds/48553540

Attachments:
beep_issue319 13.9 KB

Bram Moolenaar

unread,
Jan 28, 2015, 4:39:31 PM1/28/15
to vim...@vim.org
Thanks for the idea and the patch.

Although single-character flags are not uncommon in Vim, they are hard
to read back. Newer options have short names, using a comma separated
list. This would also allow a value such as "all" or "most".

I think the default value should be empty, meaning no bell is
suppressed. Then when users find the bell annoying in some situations
they can add an entry to the option. This does imply that the name
should be reversed: 'belloff'. Or perhaps 'shutup' ? :-)

For the implementation, I would pass an argument to vim_beep() to
specify when to not use the bell, then the handling of the option value
only needs to be inside vim_beep().

--
hundred-and-one symptoms of being an internet addict:
135. You cut classes or miss work so you can stay home and browse the web.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Jan 28, 2015, 4:58:12 PM1/28/15
to vim...@vim.org
Hi Bram!
Okay, will do.

Best,
Christian
--
Monogamie läßt viel zu Wünschen übrig.

Christian Brabandt

unread,
Jan 30, 2015, 3:14:15 PM1/30/15
to vim...@vim.org
Here is an update

Best,
Christian
--
Ein religiöser Mensch denkt nur an sich.
-- Friedrich Wilhelm Nietzsche
beep_issue319.diff

Bram Moolenaar

unread,
Jan 31, 2015, 9:28:05 AM1/31/15
to Christian Brabandt, vim...@vim.org

Christian Brabandt wrote:

> On Mi, 28 Jan 2015, Christian Brabandt wrote:
> > On Mi, 28 Jan 2015, Bram Moolenaar wrote:
> > > Christian wrote:
> > > Thanks for the idea and the patch.
> > >
> > > Although single-character flags are not uncommon in Vim, they are hard
> > > to read back. Newer options have short names, using a comma separated
> > > list. This would also allow a value such as "all" or "most".
> > >
> > > I think the default value should be empty, meaning no bell is
> > > suppressed. Then when users find the bell annoying in some situations
> > > they can add an entry to the option. This does imply that the name
> > > should be reversed: 'belloff'. Or perhaps 'shutup' ? :-)
> > >
> > > For the implementation, I would pass an argument to vim_beep() to
> > > specify when to not use the bell, then the handling of the option value
> > > only needs to be inside vim_beep().
> >
> > Okay, will do.
>
> Here is an update

Thanks!

Everybody: please review the list of items.

Note: the "E" here should be something else:
indicate that an error occured. It can be silenced by removing the 'E'
flag then.

--
hundred-and-one symptoms of being an internet addict:
145. You e-mail your boss, informing him you'll be late.

Christian Brabandt

unread,
Jan 31, 2015, 3:22:38 PM1/31/15
to vim...@vim.org
Hi Bram!

On Sa, 31 Jan 2015, Bram Moolenaar wrote:

> Note: the "E" here should be something else:
> indicate that an error occured. It can be silenced by removing the 'E'
> flag then.

What 'E'?

Best,
Christian
--
Aus Murphy's Gesetze:
Beurteilung hat mit Erfahrung zu tun. Erfahrung entsteht aus schwacher
Beurteilung.

Bram Moolenaar

unread,
Jan 31, 2015, 3:35:59 PM1/31/15
to Christian Brabandt, vim...@vim.org

Christian wrote:

> On Sa, 31 Jan 2015, Bram Moolenaar wrote:
>
> > Note: the "E" here should be something else:
> > indicate that an error occured. It can be silenced by removing the 'E'
> > flag then.
>
> What 'E'?

I think this was a single letter flag in the first implementation, it
should now be a word.

--
hundred-and-one symptoms of being an internet addict:
151. You find yourself engaged to someone you've never actually met,
except through e-mail.

Christian Brabandt

unread,
Jan 31, 2015, 3:49:35 PM1/31/15
to vim...@vim.org
Hi Bram!

On Sa, 31 Jan 2015, Bram Moolenaar wrote:

>
> Christian wrote:
>
> > On Sa, 31 Jan 2015, Bram Moolenaar wrote:
> >
> > > Note: the "E" here should be something else:
> > > indicate that an error occured. It can be silenced by removing the 'E'
> > > flag then.
> >
> > What 'E'?
>
> I think this was a single letter flag in the first implementation, it
> should now be a word.

Yes, this is fixed now with the last patch.

Best,
Christian
--
Ich konsumiere also bin ich.

Christ van Willegen

unread,
Jan 31, 2015, 5:09:32 PM1/31/15
to vim...@googlegroups.com, vim...@vim.org
On Sat, Jan 31, 2015 at 9:49 PM, Christian Brabandt <cbl...@256bit.org> wrote:
> Hi Bram!
>
> On Sa, 31 Jan 2015, Bram Moolenaar wrote:
>> I think this was a single letter flag in the first implementation, it
>> should now be a word.
>
> Yes, this is fixed now with the last patch.

But not yet in the documentation at the top of the diff...

Also I'd suggest:

- This is most usefule, to finetune
- This is most useful to finetune

Christ van Willegen

Christian Brabandt

unread,
Jan 31, 2015, 5:14:17 PM1/31/15
to vim...@googlegroups.com, vim...@vim.org
Hi Christ!
Thanks. Updated patch attached.

Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Chris Baum-Kugel
beep_issue319.diff

Daniel Hahler

unread,
Feb 5, 2015, 3:55:30 PM2/5/15
to vim...@googlegroups.com, vim...@vim.org
Thanks a lot for this patch, Christian!

Some remarks for the documentation:

1. s/occued/occured/
2. Inconsistent punctuation and capitalization in the list; I suggest adding a dot after each item, and upper-casing the first word.
3. s/can't/cannot/


Regards,
Daniel.

v...@googlecode.com

unread,
Feb 5, 2015, 4:03:28 PM2/5/15
to vim...@vim.org

Comment #11 on issue 319 by dha...@gmail.com: New option to not beep
with 'showmatch'
https://code.google.com/p/vim/issues/detail?id=319

For reference, there's an updated patch on the vim_dev mailinglist:
https://groups.google.com/d/msg/vim_dev/-jN4_nsSls0/Nbjbrh4jXYEJ

Christian Brabandt

unread,
Feb 6, 2015, 7:33:57 AM2/6/15
to vim...@googlegroups.com, vim...@vim.org
Hi Daniel!

On Do, 05 Feb 2015, Daniel Hahler wrote:

> Thanks a lot for this patch, Christian!
>
> Some remarks for the documentation:
>
> 1. s/occued/occured/
> 2. Inconsistent punctuation and capitalization in the list; I suggest adding a dot after each item, and upper-casing the first word.
> 3. s/can't/cannot/

Thanks for the feedback. Here is an updated patch.

Best,
Christian
--
Es ereignet sich nichts Neues. Es sind immer dieselben alten
Geschichten, die von immer neuen Menschen erlebt werden.
-- William Faulkner
beep_issue319.diff

v...@googlecode.com

unread,
Jul 21, 2015, 4:56:12 PM7/21/15
to vim...@vim.org
Updates:
Status: Fixed

Comment #12 on issue 319 by chrisbr...@googlemail.com: New option to not
fixed with 7.4.793 and the new 'belloff' option
Reply all
Reply to author
Forward
0 new messages