Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Bell sounds / screen flashes with every keystroke #10

Closed
xolox opened this Issue · 7 comments

3 participants

@xolox
Owner

I've now had two reports of users that Vim rings a bell or flashes the screen with every keystroke when editing a note in insert mode. The first report was in July and judging by the e-mail headers the user was running Vim on Windows. The second report I got a few days ago from @bioe007 who's running Linux and Vim 7.3.266 (I'm running the same version of Vim).

So far I have failed to reproduce the problem. When I got the first report I was actually worried that the notes plug-in was beeping at every user and I had never noticed because I've disabled my system speaker :-), however even when I enable Vim's errorbells and visualbell options I cannot get Vim to flash the screen using my notes plug-in (I did confirm that the screen flashes when I pressed Escape in normal mode).

I have tried running the notes plug-in in isolation (outside of my Vim profile) hoping the problem was being obscured by my vimrc or another one of my plug-ins, however this also doesn't help me reproduce the problem. I used the following shell commands to execute the notes plug-in isolation (and confirmed that no scripts from my Vim profile were being loaded by using the :scriptnames command):

cd vim-notes
PROFILE=/tmp/vim-test-$RANDOM
mkdir $PROFILE
echo set nocompatible > $PROFILE/.vimrc
ln -s $PWD $PROFILE/.vim
HOME=$PROFILE gvim

I now think the problem only manifests using a certain combination of settings and/or plug-ins, so my next step will be to try to find out what those settings and/or plug-ins are.

@bioe007

Ok, we lost some time but here is the explanation, and I think there is a very solid workaround.

First, this should only affect gvim, terminal vim does not have this issue.

The issue is created by setting:

set vb t_vb=

Usually done in vimrc. Which is recommended in vim's help for having no 'bell' (see :he visualbell)

However the help also states that if using gvim then it must be re-applied in gvimrc.

so, the easiest workaround:

echo 'set vb t_vb=' >> ~/.gvimrc

that should fix it.

@xolox
Owner

@bioe007: Thanks a lot for following up on this issue! I will document the problem and solution in the README to make sure others can easily find it.

@peplin

I recently had this issue in MacVim in a terminal (not gvim). I'm normally a Linux user and I've never encountered this issue before. I'll experiment with the workarounds and let you know if I find anything.

@peplin

I think I've found the root cause - commenting out this line in ftplugin/notes.vim stops the constant bells for me:

setlocal matchpairs=

Why this happens, I do not know. Is disabling matching pair highlighting critical for this plugin, or can we just delete that line (and the corresponding undo stuff)?

@xolox
Owner

Hi @bioe007 and @peplin,

Thanks to both of you for your input regarding the (visual) bell bug in vim-notes. I sincerely hope the suggestion by Peplin resolves this issue. I'm fine with the change itself although I suspect that if this change resolves the issue, we've actually uncovered a bug in Vim regarding the handling of the matchpairs option. If the issue is not resolved, feel free to get back to me of course!

- Peter

@bioe007

now works for me (without the gvimrc fix)

@xolox
Owner

Thanks for confirming that the fix works! I guess the culprit was indeed the matchpairs option. I'm closing this issue now. I'll also add a note to the to-do list reminding me to check whether this is a bug in Vim or simply user error (me being the user in this context, since I'm writing the Vim scripts).

@xolox xolox closed this
@xolox xolox referenced this issue from a commit
@xolox TODO: Find out why matchpairs manipulation causes constant harassment…
…* :-)

* where harassment is defined as Vim ringing a bell or flashing the screen
  for every key press in insert mode while editing notes (see issue #10)
0b06f72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.