Like Ingo I'm sorry I can't get more specific, but that's kind of the
problem: This issue is really hard to diagnose properly because it basically…
seems like syntax folding has some horrible worst case performance which
only shows once in a while, in large buffers, but once it manifests you can
basically give up on using Vim properly.

When I disable syntax folding and reload the buffer using :edit Vim is
instantly fast again. Strange enough it seems that changing the text folding
options does not have the same effect...

That reminds me of a "bug" I found last week after *years* of painful
latex edition.
Sometimes, for a reason, editing would get really slow. It'd take a
second or two to just go into insert mode.
I would solve (temporarily) the issue with :syntax sync minlines=200,
until I trigger it again.

Here's the fix:

" Ok, so the one below *kills* LaTeX edition! Let's never do that damn mistake
" again. Do not uncomment!
"autocmd BufEnter * :syntax sync fromstart " ensure every file does
syntax highlighting (full)

The trigger was a shell script doing a remote call to vim and which,
in some cases, would reload the file and jump at a given line.
A sufficiently big latex file (500 lines) would often be enough to
start the slow-down…

Since syntax based folding seems to be, well, syntax, I wonder whether
you have the same issue as me before…

Thanks for the suggestion. I wasn't sure whether this affected me so I looked through the code and documentation. The slow down happens for me in Python scripts and I'm using the script $VIMRUNTIME/syntax/python.vim from Vim 7.3 except that my customized file type plug-in also defines several syntax fold rules (but doesn't change syncing). The Python syntax script contains the following lines:

if exists("python_slow_sync") && python_slow_sync != 0
  syn sync minlines=2000
else
  " This is fast but code inside triple quoted strings screws it up. It
  " is impossible to fix because the only way to know if you are inside
  " a triple quoted string is to start from the beginning of the file.
  syn sync match pythonSync grouphere NONE "):$"
  syn sync maxlines=200
endif

I don't have python_slow_sync defined so it's executing the else block. The code there is not exactly equivalent to "syntax sync fromstart" but of course it can still perform badly.

 - Peter

--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Raspunde prin e-mail lui