How to really disable the bell in Vimperator

Yesterday I started trying out Vimperator, and so far I’m impressed. It’s a Firefox extension that puts a vim-like keyboard interface on top of Firefox.

After using it for a while, I wanted to turn the bell off, because I find it to be distracting. I turned to the documentation. I quickly found a visual bell option, but I find visual bells to be even more distracting. Then I saw the visual bell CSS style option, which can be set to an empty string for no bell at all. Bingo! Or so I thought.

It turns out that the page flickers when the bell is triggered. This is not the desired effect. So after searching the docs one more time, I unpacked a jar and poked around in the source code of Vimperator.

There’s a beep function in there. I changed the beep function to return false and Voila! It did nothing when you scrolled past the bottom or top of the page.

Rather than keep the code patched, though, I figured out how to implement my change in my ~/.vimperatorrc file. There’s a javascript command for executing a line of javascript. Vimperator’s beep function is in a global “liberator” object. Combining these two bits of knowledge, I came up with the following line which can be added to ~/.vimperatorrc:

javascript liberator.beep = function() { return false; }

It’s simple but it works. It would be nice if completely disabling the bell (including any visual artifacts) were built into Vimperator, but being able to fix it with a one-liner in the configuration file is the next best thing! Kudos to the Vimperator developers for writing code that’s easy to modify.

I’m not sure how often I’ll use Vimperator. I need to learn how easy it is to pass the input through to the current web page first. But it certainly seems to do a difficult job remarkably well!

Update: I started a Silencing and Disabling Bells WikiBook and put instructions for disabling bells in Vimperator, MacVim, and iTerm in it. Contributions welcome!

This entry was posted in uncategorized and tagged , , , . Bookmark the permalink.

6 Responses to How to really disable the bell in Vimperator

  1. actionshrimp says:

    Thanks so much for this, the beep was infuriating! Found a few sites that suggested changing the accessibility.typeaheadfind.enablesound setting to false in about:config, but firefox didnt seem to let this stick. Had no idea it was to do with vimperator, but this was a lifesaver :)

  2. Ben Atkin says:

    You’re welcome. I’ve figured out how to shut off most beeps on my system, and put all of the instructions in a Silencing and Disabling Bells WikiBook. I hope other people find it useful and add instructions for disabling bells in applications that they use.

  3. LOL, what bell?! I never heard any bell!
    Perhaps i’ll notice it as soon as i put earplugs in, and i’ll immediately be back here to find out how to switch it off! :)

  4. Silas Barta says:

    I will add my thanks. I had just installed Linux for the first time (Ubuntu 8.10) and tried Vimperator for the first time in six months. (I had blogged about it previously.) I noticed the beeps and also noticed some of the instructions mentioned a “visualbell” option. I googled that, which took me to your priceless advice on how to turn off the beep.

    What bothers me is how an otherwise great plugin makes some very questionable user interface decisions. I just spend a few hours figuring out how to find the $HOME\.vimperator path so I could add in the javascript file that lets you use the old, non-numerial hint commands. What on earth led Herr Stubenschrott to decide that number keys are easier to type if my hands are on the keyboard? Or that it’s easier to type up the first few letters of the link when hitting f obscures those letters and you usually have to cycle through similar links?

    *sigh*…

  5. vimmer says:

    You should use :hi Bell display: none; in Vimperator 2.x

  6. spearbearer says:

    I typed this command into the .rc file, and it indeed disabled the bell for the scrolling functions. However, the search function still beeps, if no string is found. Thoughts?