Vim Tips Wiki
Advertisement

Previous TipNext Tip

Tip: #898 - Disable beeping and flashing

Created: March 20, 2005 5:54 Complexity: basic Author: Gerald Lai Version: 5.7 Karma: 61/19 Imported from: Tip#898

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. After all, some of us have a habit of hitting the Esc key one too many times ;)


Add the line below to the vimrc file:

autocmd VimEnter * set vb t_vb=


Note:

Just adding the line:

set vb t_vb=

to the vimrc file somehow does not work. It works if entered manually with ":set vb t_vb=" from within Vim.

Comments

In .vimrc, you can use set vb t_vb=""

Anonymous , March 20, 2005 20:35


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.

Daniel Kullmann , March 21, 2005 2:54


The first thing I do on a new PC 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).

On Unix:

5. In .Xdefaults: *alarm.visible: false (all Xwindows).



Sunita.indorian--AT--gm , March 21, 2005 12:23


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.


Gerald Lai , March 21, 2005 15:17


It might be better to use GuiEnter instead of VimEnter, as au! GuiEnter * set t_vb=

maxiangjiang--AT--hotmail.com , March 22, 2005 15:23


This is a life-saver. Thanks.


nospam--AT--yahoo.com , August 14, 2006 11:57


Advertisement