Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to stop vim beeping every time I enter > in PHP

Tags:

php

vim

Here's a PHP snippet

 $foo = array( 'bar' => 'baz' );

When I enter this in Vim, I will get a bell/beep on pressing >. This does not happen if I type <something>, so I think it's trying to be helpful in saying "ah, you've closed an angle bracket but you didn't open one!". But it's not helpful, it just seems not to understand the context: assignment to an associative array.

It also beeps/bells when I type $foo->bar.

I have set ft=php, which all seems to be working fine, other than this infuriating beep.

I know I can disable the beep altogether, but I'd rather keep the beep for things I really do need to be beeped at for. I know about visual bell, but I don't want a headache inducing flash every time I access a method, property or assign to a new array!

like image 707
artfulrobot Avatar asked Dec 20 '22 13:12

artfulrobot


1 Answers

You probably have the set showmatch line which, as you said, tries to be helpful and match open and closed brackets.

You can try to add the following line in your .vimrc:

au BufWinEnter *.php set mps-=<:>

or just

setlocal matchpairs-=<:>

in the PHP vim configuration.

like image 105
go2 Avatar answered Jan 01 '23 18:01

go2