Closed GoogleCodeExporter closed 9 years ago
For reference, here is some question/answer about this on StackOverflow:
http://stackoverflow.com/a/24242434/15690
Original comment by dhahler@gmail.com
on 19 Jan 2015 at 1:36
Is there a problem to disable the bell altogether?
Original comment by chrisbr...@googlemail.com
on 20 Jan 2015 at 9:57
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?
Original comment by dhahler@gmail.com
on 21 Jan 2015 at 4:38
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
Original comment by chrisbr...@googlemail.com
on 21 Jan 2015 at 6:56
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).
Original comment by dhahler@gmail.com
on 24 Jan 2015 at 12:32
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
Original comment by dhahler@gmail.com
on 24 Jan 2015 at 12:41
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.
Original comment by sw...@ingo-karkat.de
on 24 Jan 2015 at 1:16
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.
Original comment by chrisbr...@googlemail.com
on 25 Jan 2015 at 12:35
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.
Original comment by benjamin...@rockwellcollins.com
on 26 Jan 2015 at 4:38
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
Original comment by chrisbr...@googlemail.com
on 27 Jan 2015 at 10:57
Attachments:
For reference, there's an updated patch on the vim_dev mailinglist:
https://groups.google.com/d/msg/vim_dev/-jN4_nsSls0/Nbjbrh4jXYEJ
Original comment by dhahler@gmail.com
on 5 Feb 2015 at 9:03
fixed with 7.4.793 and the new 'belloff' option
Original comment by chrisbr...@googlemail.com
on 21 Jul 2015 at 8:55
Original issue reported on code.google.com by
dhahler@gmail.com
on 19 Jan 2015 at 1:26