开发者

Disable blinking at the first/last line of the file

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 blink开发者_开发知识库s. I know this is stupid but it is possible to disable this.


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')


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜