Slowness in Vim's bracket-matching with the default PHP syntax

8

3

I am experiencing a noticeable slowness in Vim's bracket-matching and -highlighting feature. When the cursor is placed over a parenthesis or bracket, there is a delay of about 300ms on the console's responsiveness. As stated, this only seems to occur when working with PHP files. I am running Vim 7.2 on Debian Squeeze with a .vimrc file:

  1 set autoindent
  2 set smarttab
  3 set ruler
  4 set expandtab
  5 set termencoding=utf-8
  6 set fileformat=unix
  7 set number
  8 set tabstop=4
  9 set encoding=utf-8
 10 set shiftwidth=4
 11 set noswapfile
 12 set backspace=indent,eol,start
 13 set shortmess=lrwxI
 14 set history=50
 15 set background=dark
 16
 17 let php_folding=2
 18 let php_asp_tags=0
 19
 20 colorscheme desert

Is there any way to alleviate this slowdown?

moo

Posted 2009-11-02T15:12:39.913

Reputation: 897

Answers

2

I don't see this locally; the matching parens is instantly highlighted. Try this:

:set filetype=txt

...and see if things improve. If so, something in vim's PHP handling configuration may be a bit out of whack. Do you see the same behaviour on very small PHP files? I'm on 7.2 on ubuntu and not seeing what you're seeing.

Hope this helps!
-Paul

UPDATE: thanks for updating your question to include your .vimrc - this leads to another thing for you to test. Please see if this doesn't help the situation - change php_folding to 1 rather than 2. 2 folds all { } regions so this may be somehow interacting with the parens-matching logic and causing the delay.

pbr

Posted 2009-11-02T15:12:39.913

Reputation: 1 285

Also you say "on the consoles responsiveness" - are you running vim in a terminal emulator, or on a virtual console (ctrl-alt-F1 for example)? – pbr – 2009-11-11T00:14:44.160

7

Type this to turn it off per-instance:

:NoMatchParen

(capitalization is important)

Add this to your ~/.vimrc to disable it before the module loads:

let loaded_matchparen = 1

You only need one. With the first, you have to type it every time you open a PHP file, but you can turn it on again at any time. With the second, it's always off, but you can't simply turn it on again.

quack quixote

Posted 2009-11-02T15:12:39.913

Reputation: 37 382