top | item 39452840

(no title)

omaranto | 2 years ago

Taking notes in math courses in Vim on a netbook (remember those?) is what made me switch to Emacs! I tried taking notes both in LaTeX and in Markdown with syntax highlighting for embedded LaTeX math formulas, and Vim just lagged behind my typing —and I'm not that fast a typist. In the case of LaTeX this is a well-known problem that's addressed in the manual (see :help tex-slow). I tried all the tips the manual suggested and Vim still lagged, the only thing that fixed it was turning off syntax-highlighting completely. On a whim I tried Emacs, saw it was perfectly snappy (like Vim with non-LaTeX files) and switched.

https://vimhelp.org/syntax.txt.html#tex-slow

discuss

order

ykonstant|2 years ago

This is a serious problem with some Vim plugins and plugin interactions; the user doesn't feel like they've done anything wrong, and yet text insertion is absolutely sluggish. Tex plugins in particular combined with text folding seem prone to this problem.

For the record though, this slowness has nothing to do with Vim itself, or the low power of the netbook; it is purely due to inauspicious interaction between specific plugins and can be fixed at the .vimrc level if you are willing to debug.

omaranto|2 years ago

I was using a third-party plugin for markdown (I think it was called pandoc.vim), but for LaTeX files I was using only plugins that come with Vim. The documentation in :help tex-slow did suggest things to put in .vimrc to help make syntax-highlighting faster and I did try all of them. The only thing that solved the lag was disabling syntax highlighting for LaTeX completely.

The slowness I experienced for LaTeX files happened even without any third-party plugins installed, using a one-line .vimrc that only turned on syntax highlighting. So I think it is unfair to say "the slowness has nothing to do with Vim itself". Probably also "or the low power of the netbook" is unjustified, in the sense that the tips in :help tex-slow do likely solve the problem on computers a little beefier than my old netbook (which is probably more than 15 years old at this point). I mean, those suggestions are in the official Vim documentation presumably because they did work for someone.

Think of it this way: if the slowness of LaTeX syntax-highlighting were not a problem in Vim itself (where by "Vim itself" I'm including the vimscript files that ship with Vim, not just the executable), would it be documented in the official Vim documentation?

https://vimhelp.org/syntax.txt.html#tex-slow

lervag|2 years ago

I don't think this is a big problem with VimTeX; I've worked quite a lot on these things, and my personal experience is that VimTeX is now quite fast both with syntax highlighting and with folding; although for folding, you do want to use the various "hacks" like the manual fold option or a plugin like FastFold.

pletnes|2 years ago

I started using manual folds with latex. Works fine esp if you have a hotkey/snip for inserting these. % {{{ and % }}} for begin/end for instance. Much faster!

lervag|2 years ago

I believe syntax highlighting with VimTeX (which is suggested in the blog post) should be quite fast and generally feel snappy.

Disclaimer: I'm the author of VimTeX.