1

Since Vim 8, I've noticed that the bell can sound at most once per half a second. This annoys me. I have this solved by recompiling, but am still looking for a way to do it without.

I've searched the documentation and found, in a semi-related option:

                        *'visualbell'* *'vb'* *'novisualbell'* *'novb'* *beep*
'visualbell' 'vb'        boolean        (default off)
                        global
                        {not in Vi}
        Use a visual bell instead of beeping.  The terminal code to display the
        visual bell is given with 't_vb'.  When no beep or flash is wanted,
        use: >
                :set vb t_vb=
<        If you want a short flash, you can use this on many terminals: >
                :set vb t_vb=[?5h$<100>[?5l
<        Here $<100> specifies the time, you can use a smaller or bigger value
        to get a shorter or longer flash.

        Note: Vim will limit the bell to once per half a second.  This avoids
        having to wait for the flashing to finish when there are lots of
        bells, e.g. on key repeat.  This also happens without 'visualbell'
        set.

        In the GUI, 't_vb' defaults to "<Esc>|f", which inverts the display
        for 20 msec.  If you want to use a different time, use "<Esc>|40f",
        where 40 is the time in msec.

        Note: When the GUI starts, 't_vb' is reset to its default value.  You
        might want to set it again in your |gvimrc|.

        Does not work on the Amiga, you always get a screen flash.
        Also see 'errorbells'.

The paragraph in the middle is the problem:

        Note: Vim will limit the bell to once per half a second.  This avoids
        having to wait for the flashing to finish when there are lots of
        bells, e.g. on key repeat.  This also happens without 'visualbell'
        set.

I understand that in the case of visual bell, this would be inconvenient, but I use audible bell and sending one \a over SSH, even on EDGE (2G mobile internet) is really not an issue. So, I want to disable this "feature". It doesn't give any option of disabling it though. Reading the release notes of Vim 8, I found:

Patch 8.0.0683
Problem:    When using a visual bell there is no delay, causing the flash to
            be very short, possibly unnoticeable.  Also, the flash and the
            beep can lockup the UI when repeated often.
Solution:   Do the delay in Vim or flush the output before the delay. Limit the
            bell to once per half a second. (Ozaki Kiichi, closes #1789)
Files:      src/misc1.c, src/proto/term.pro, src/term.c

Is it possible to change (in vimrc, probably) this without recompiling? I have this solved by recompiling, but am still looking for a way to do it without.

For the people who are willing to recompile:

  • get the Vim source
  • search misc1.c for "500"
  • go back in the file until you see #ifdef ELAPSED_FUNC
  • change the ELAPSED_FUNC to something else so it doesn't exist and the code is skipped
  • search for the next ELAPSED_FUNC and repeat
  • ./configure && make && make install

Again—I am searching for a way without recompiling.

  • 1
    Do you want to disable the bell, or disable the "throttle limit"? – D. Ben Knoble Jul 26 '19 at 0:38
  • I want to disable the throttle limit. It is solved already, by recompiling, but there could be an option which is so well hidden that it's not in the docs. – fghsgh Jul 27 '19 at 6:17
1

I looked at the source and I don't see any user-facing way to disable the bell limit. You'd have to build your own version as you mentioned. Think twice about that, though...

Rather than being a killjoy "feature" this apparently was implemented for the sake of Vim stability. I saw a couple comments indicating that rapid bell sequences can hang Vim. Here's one of them..

    /* Only beep once per half a second, otherwise a sequence of beeps
     * would freeze Vim. */

Guess you have to live with it. :)

| improve this answer | |
  • It was in the misc1.c source file. Search that for 500. There are some #ifdefs there. If you remove them (as if the macro which is checked had not been defined), it works like it did before Vim 8. – fghsgh Jul 27 '19 at 6:15
  • I've read the issue conversation on GitHub, and they were only solving the visual bell (the audoble bell worked just fine) and they thought that no one would care if they did it on audible too. Well, I do care. I've been typing with this for over a year and I am still not used to it. – fghsgh Jul 27 '19 at 6:23
  • Search msic1.c? I looked at the source already. That's what my answer says. That's how I know there are no user facing backdoors. If you already looked at the source why didn't you say so in your question? Seems like I've wasted my valuable time. – B Layer Jul 28 '19 at 1:24
  • I said, I was looking for a solution without modifying the source code. Maybe I should have said that more than just in the last sentence. I am sorry. – fghsgh Jul 29 '19 at 6:56
  • @fghsgh I suggest you file a new issue requesting a way to tweak this behavior. It shouldn't be too hard to get it exposed and you might get to successfully advocate for it. I suggest you bring up a compelling use case of why that is important to you, otherwise it's likely to get dismissed as unclear why anyone would want that... Good luck! – filbranden Jul 29 '19 at 23:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.