How to disable Vim bells sounds?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 10:37:02

问题


I am trying to disable the error bells on vim, both visual and audio. However I cannot get them to stay off.

I have the following in my vimrc:

" Disable annoying beeping
set noerrorbells
set vb t_vb=

That doesn't work, I figured some plugin or another setting was resetting it so I added it again to the end of my vimrc, still no luck.

The only way I can get it to turn off is if I manually call set vb t_vb= after everything has loaded. I guess I could emulate this by adding a script to the plugin/after folder but I am trying to avoid that as it means it's another thing I have to set up whenever I switch to another machine.

You can see my full vimrc here: https://github.com/lerp/dotfiles/blob/master/vimrc


回答1:


Assuming you have that problem in GVim, adding the following line

autocmd GUIEnter * set vb t_vb=

in your if has("gui_running") conditional block should help.

From :help 'visualbell':

Note: When the GUI starts, 't_vb' is reset to its default value.
You might want to set it again in your gvimrc.



回答2:


Try to use the following line in your .vimrc, .gvimrc files:

set belloff=all



回答3:


For me with gVim it works if I put

set noerrorbells
set vb t_vb=

in ~/.gvimrc, not ~/.vimrc.




回答4:


I tried several times with different configurations but none worked. It seems that gVim resets the visual bell when the GUI starts. The only way it works for me is this snippet at the end of your .vimrc (or _vimrc if you are using Windows):

set visualbell t_vb=
if has("autocmd") && has("gui")
    au GUIEnter * set t_vb=
endif


来源:https://stackoverflow.com/questions/18589352/how-to-disable-vim-bells-sounds

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!