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!

10 thoughts on “How to really disable the bell in Vimperator

  1. 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 :)

    • Screen is good, but tmux is better! Wow, you can say that again! I can FINALLY dectah and reattach without losing my window splits (not to mention the splitting behavior is much better) and the keybindings can be easily set to match screen .GENIUS!~jtriley

      • I agree. I switched to tmux a while back myself, and just this week started using console vim more (I’d been using gvim and MacVim most of the time before).

  2. 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*…

  3. 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?

  4. Almost a decade later, this post helped me to desperately cling to Vimperator on a FF54 install just a bit longer…

Comments are closed.