I'm using Vim with a bunch of plugins (pathogen, ctags, snipmate, supertab, ...), and everything works fine for all kinds of file extensions.
However, when I'm try to edit .tex files it presents two problems which seem related. First, Vim starts to work really slow, and second, when I press "any letter + Tab", it tries to auto-complete with words previously written in the text.
One way which I tried to solve those issues, is by removing the supertab plugin from my bundle folder, but it's a not satisfactory solution.
Folding is another common source of slowdown. It is normally disabled by default, but perhaps you have enabled it. You can just disable it again:
Note that folding must be enabled/disabled before TeX syntax is loaded in the buffer. Also, Vim option
'foldenable'
(toggled by the normal-mode commandzi
) does not actually clear folding, it just hides it but it’s still there).However, if you don’t want to give up on folding altogether, I found a single bottleneck in the builtin TeX folding that was responsible for most of the slowdown in my case: the
document
environment. Simple test: typing stuff just before\begin{document}
is reasonably fast, but typing right after it is amazingly laggy. I guess it happens because that environment commonly spans hundreds of lines.If you use the builtin TeX folding, you can prevent the folding of just the
document
environment by disabling thetexDocZone
matchgroup¹. Anyway, why would you want to fold the toplevel contents?Alternatively, if you have VimTeX, you can replace the builtin TeX folding with the VimTeX’ one. I find it generally better, and it carefully avoids folding the
document
environment.VimTeX’ folding is nicely customizable, see
:help vimtex-folding
.¹ As of version 121 (April 2022) of the builtin TeX syntax.