19

So for me this is very annoying

I am at the first/last line of the file and when I hit k/j all text screen blinks. I know this is stupid but it is possible to disable this.

PaulP
  • 1,925
  • 2
  • 20
  • 25

4 Answers4

25

To disable visual bell completely: set t_vb= in vimrc or gvimrc (if you use gvim, you must put it into gvimrc because &t_vb option is reset after vimrc is sourced).

To turn visual bell into beep: set novisualbell. I find it more annoying, but it also answers the question: disabling screen blinking.

To turn off visual bell for j/k commands you will have to remap them:

noremap <expr> k ((line('.')==1)?'':'k')
noremap <expr> j ((line('.')==line('$'))?'':'j')
Shahbaz
  • 46,337
  • 19
  • 116
  • 182
ZyX
  • 52,536
  • 7
  • 114
  • 135
17

You can add the line below to your .vimrc:

autocmd GUIEnter * set vb t_vb= " for your GUI
autocmd VimEnter * set vb t_vb=

It will disable both the bell and the visual flash.

Michael Foukarakis
  • 39,737
  • 6
  • 87
  • 123
11

A useful command (that also works in the vimrc files) is

set belloff=all

This should turn off flashing in all cases, including esc. Requires a recent version of Vim (7.4+)

See other discussion at https://stackoverflow.com/a/41524053/423033 https://vi.stackexchange.com/questions/4653/vim-still-flashing-when-it-shouldnt-be

Community
  • 1
  • 1
Iain Ballard
  • 4,433
  • 34
  • 39
8

This is counterintuitive, but in order to disable the visual bell completely you have to:

  • enable vim's internal visual bell with set visualbell
  • set t_vb=

that is, set the effect of visual bell to empty after enabling it.

If visualbell is not set for you (by default mine wasn't), setting t_vb to empty only will not disable the flashing.

Watcom
  • 2,359
  • 1
  • 17
  • 15