Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a visual bell in vim on Mac?

Tags:

vim

macvim

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?

like image 763
Rocketman Avatar asked Jul 25 '12 19:07

Rocketman


2 Answers

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.

like image 183
codelahoma Avatar answered Nov 13 '22 00:11

codelahoma


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.

like image 41
romainl Avatar answered Nov 12 '22 23:11

romainl