Quantcast

disable visual bell in insert mode for PHP file

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

disable visual bell in insert mode for PHP file

Jon Trelfa
PHP's OOP style uses the "arrow" (dash + greater-than symbol) to point to methods/properties of objects.  *Something* triggers an event whenever the > is typed while I'm in insert mode - which makes my screen flash (visual bell).  Even when I *tried* to disable the visual bell using this in my .vimrc:

set vb
set t_vb=

Any ideas how/why I get a visual bell when I type that particular character when editing a PHP file?  The flashing is going to fry my brain or give me a seizure.

Thanks,

Jon

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disable visual bell in insert mode for PHP file

Jon Trelfa
On Fri, Dec 4, 2009 at 10:52 PM, Jon Trelfa <[hidden email]> wrote:
PHP's OOP style uses the "arrow" (dash + greater-than symbol) to point to methods/properties of objects.  *Something* triggers an event whenever the > is typed while I'm in insert mode - which makes my screen flash (visual bell).  Even when I *tried* to disable the visual bell using this in my .vimrc:

set vb
set t_vb=

Any ideas how/why I get a visual bell when I type that particular character when editing a PHP file?  The flashing is going to fry my brain or give me a seizure.


To answer my own question - it turns out that the bell was a result of this line in my vimrc:

set showmatch

Apparently, showmatch looks for a matching < whenever > is typed - then briefly tries to move to the match, blink on it, then move the cursor back to where you're typing.

Now I just need to figure out how to disable showmatch for the <> characters in PHP files (there's a matchpairs in the help files, but I'm still figuring out what I can do to change it only for PHP files)

Jon

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disable visual bell in insert mode for PHP file

Nat Williams-2
On Fri, Dec 4, 2009 at 10:09 PM, Jon Trelfa <[hidden email]> wrote:
>
> On Fri, Dec 4, 2009 at 10:52 PM, Jon Trelfa <[hidden email]> wrote:
>>
>> PHP's OOP style uses the "arrow" (dash + greater-than symbol) to point to methods/properties of objects.  *Something* triggers an event whenever the > is typed while I'm in insert mode - which makes my screen flash (visual bell).  Even when I *tried* to disable the visual bell using this in my .vimrc:
>> set vb

I'm pretty sure this turns visualbell ON.  Try 'set novb' or 'set novisualbell'.

>>
>> set t_vb=
>> Any ideas how/why I get a visual bell when I type that particular character when editing a PHP file?  The flashing is going to fry my brain or give me a seizure.
>
> To answer my own question - it turns out that the bell was a result of this line in my vimrc:
> set showmatch
> Apparently, showmatch looks for a matching < whenever > is typed - then briefly tries to move to the match, blink on it, then move the cursor back to where you're typing.
> Now I just need to figure out how to disable showmatch for the <> characters in PHP files (there's a matchpairs in the help files, but I'm still figuring out what I can do to change it only for PHP files)
> Jon


Nat

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disable visual bell in insert mode for PHP file

Gary Johnson-4
In reply to this post by Jon Trelfa
On 2009-12-04, Jon Trelfa wrote:

> On Fri, Dec 4, 2009 at 10:52 PM, Jon Trelfa <[hidden email]> wrote:
>
>     PHP's OOP style uses the "arrow" (dash + greater-than symbol) to point to
>     methods/properties of objects.  *Something* triggers an event whenever the
>     > is typed while I'm in insert mode - which makes my screen flash (visual
>     bell).  Even when I *tried* to disable the visual bell using this in my
>     .vimrc:
>
>     set vb
>     set t_vb=
>
>     Any ideas how/why I get a visual bell when I type that particular character
>     when editing a PHP file?  The flashing is going to fry my brain or give me
>     a seizure.

Setting t_vb= in your .vimrc won't do any good if you're using gvim.
See the note under

    :help vb

You need to set it either in your .gvimrc or set it using an
autocommand in your .vimrc, like this:

    set visualbell t_vb=      " Turn off beep and disable visual bell.
    au GuiEnter * set t_vb=   " Disable visual bell again when GUI starts.

> Now I just need to figure out how to disable showmatch for the <>
> characters in PHP files (there's a matchpairs in the help files,
> but I'm still figuring out what I can do to change it only for PHP
> files)

If you want to change some setting for just PHP files, put the
changes in ~/.vim/after/ftplugin/php.vim for Unix or
~/vimfiles/after/ftplugin/php.vin for Windows.  You can remove the
<> pair from 'matchpairs' with

    setlocal matchpairs-=<:>

in that file.  Alternatively, you could disable 'showmatch'
altogether for PHP files with this:

    setlocal noshowmatch

HTH,
Gary


--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disable visual bell in insert mode for PHP file

Spencer Collyer
In reply to this post by Nat Williams-2
On Fri, 4 Dec 2009 23:40:01 -0600, Nat Williams wrote:

> On Fri, Dec 4, 2009 at 10:09 PM, Jon Trelfa <[hidden email]> wrote:
> >
> > On Fri, Dec 4, 2009 at 10:52 PM, Jon Trelfa <[hidden email]>
> > wrote:
> >>
> >> PHP's OOP style uses the "arrow" (dash + greater-than symbol) to
> >> point to methods/properties of objects.  *Something* triggers an
> >> event whenever the > is typed while I'm in insert mode - which
> >> makes my screen flash (visual bell).  Even when I *tried* to
> >> disable the visual bell using this in my .vimrc: set vb
>
> I'm pretty sure this turns visualbell ON.  Try 'set novb' or 'set
> novisualbell'.
>

It does, but this following line from the OP:

> >> set t_vb=

then sets the terminal visualbell to off. If you use 'novisualbell' you
get the terminal beep, which is likely why the OP uses 'set vb' in the
first place. I suspect it's a common idiom to use something like what
the OP has done in order to turn off both visual and audio bells.

Spencer

--
<<< Eagles may soar, but weasels don't get sucked into jet engines >>>
8:59am up 99 days 15:58, 1 user, load average: 1.29, 1.37, 2.69
Registered Linux User #232457 | LFS ID 11703

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: disable visual bell in insert mode for PHP file

Jon Trelfa
In reply to this post by Gary Johnson-4
On Sat, Dec 5, 2009 at 3:37 AM, Gary Johnson <[hidden email]> wrote:

If you want to change some setting for just PHP files, put the
changes in ~/.vim/after/ftplugin/php.vim for Unix or
~/vimfiles/after/ftplugin/php.vin for Windows.  You can remove the
<> pair from 'matchpairs' with

   setlocal matchpairs-=<:>

in that file.  Alternatively, you could disable 'showmatch'
altogether for PHP files with this:

   setlocal noshowmatch

HTH,
Gary


I used your suggestion - with a slightly different implementation.  I added this line to my .vimrc:

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


Seems to have done the trick

--
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
Loading...