Vim Tips Wiki
Advertisement
Tip 898 Printable Monobook Previous Next

created March 20, 2005 · complexity basic · author Gerald Lai · version 5.7


For those of you who despise both the bell and the visual flash, but cannot seem to get it set automatically on startup, you're in luck. Add the line below to the vimrc file:

autocmd VimEnter * set vb t_vb=

Comments

In vimrc, you can use

set vb t_vb=""

If I recall correctly, I had to put the "set vb t_vb=" line into the gvimrc to activate it, because gvim somehow resets the variable.


autocmd VimEnter * set vb t_vb=

works for all OSes and all vimrc-type files ("_vimrc" and "_gvimrc" for Windows, ".vimrc" and ".gvimrc" for Unix/Linux).

autocmd is a way of telling Vim to "type" a command in, like you would, depending on the event given (VimEnter, in this case).

I tried the line:

set vb t_vb=""

on my Windows _vimrc but the visual flash was still on (t_vb was not properly set). It should work fine on Unix/Linux .vimrc.

A double-quote is treated as an escape character for comments within vimrc files. Hence, "" does not signify no-string. Instead, it signifies a comment of a double-quote character.

In summary, having only:

set vb t_vb=

works for Unix/Linux vimrc but not for Windows vimrc.


It might be better to use GuiEnter instead of VimEnter, as

au! GuiEnter * set t_vb=

The first thing I do on a new computer is:

  1. control panel, sound, select silent scheme (all apps on Windows).
  2. unplug the internal speaker if it is my pc (all apps, all os).
  3. bashrc: set -o noerrorbells (unix).
  4. In vimrc: set noeb (all os, vim only).
  5. In .Xdefaults: *alarm.visible: false (all Xwindows).

Advertisement