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
 17 let php_folding=2
 18 let php_asp_tags=0
 20 colorscheme desert

Is there any way to alleviate this slowdown?


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!

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.

  • 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 Nov 11 '09 at 0:14

Type this to turn it off per-instance:


(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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.