5

I am calling vim from the terminal on Lion OS X. I want to get rid of the audio bell and use only a visual bell. The documentation seems to indicate that I can accomplish this with :set vb. Once I issue :set vb the following settings result:

:set vb? t_vb?

gives

visualbell
t_vb=

and the flash obviously does not work. The documentation indicates that t_vb should be <Esc>|f by default. It is not. I have tried to set t_vb directly, but I cannot figure out what it should be to produce the flash.

Also note that it does not work with mvim either. But in the case of mvim it defaults to t_vb=^[|f to no avail.

Does anyone have a visual bell working on Mac? If so how was this accomplished?

dda
  • 6,030
  • 2
  • 25
  • 34
Rocketman
  • 3,464
  • 5
  • 27
  • 30

2 Answers2

6

If you're willing to do without the alert sound throughout OS X, which I certainly am, do the following:

  1. Open System Preferences -> Accessibility -> Audio
  2. Check the box next to Flash the screen when an alert occurs
  3. Click the Open Sound Preferences… button.
  4. Slide the alert volume down to silence.

I just found this on Mountain Lion 10.8.3. I'm not sure how long the feature's been in there.

codelahoma
  • 895
  • 8
  • 14
5

Do you use the MacVim GUI or Vim in the Terminal?

If you run Vim in a terminal, you don't have to do anything in Vim. It's strictly a terminal emulator setting:

  • iTerm2.app

    In iTerm > Preferences… > Profiles > Terminal, uncheck Silence Bell and check Flash Visual Bell

    With this setting, you get a nice, big and quickly fading bell over your terminal window.

  • Terminal.app

    In Terminal > Preferences… > Settings > Advanced, check Visual Bell

    With this setting, you get a… flashing terminal window.

I don't know how to get a bell, visual or audio, in the MacVim GUI.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • Yes. I agree. I had confirmed getting the visual bell in the manner you outlined here. But since I really want it for MacVim. I was surprised to find that the standard method as documented for vim does not work in Terminal.app and you need to do the workaround as you suggest. – Rocketman Jul 27 '12 at 01:06
  • I've tried all the method I could find without success. My opinion at this point is that it can't be done. – romainl Jul 27 '12 at 05:56
  • With the absence of any additional response to this question ... I'm staring to think so too. I will attempt to make a feature request to the keepers of mvim ... – Rocketman Jul 29 '12 at 20:16
  • * I had to restart terminal for preferences to take effect. Thanks, this is the only place I found an answer that worked. – hidden-username Aug 31 '15 at 21:09