Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



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


As the link shows, the syntax section of the Vim manual offers suggestions to increase speed on slow computers for all syntax categories, tex being one of them. That does not mean all those categories are a problem in Vim itself.

However, I do not mean to deny your actual experiences; I have seen all sorts of performance-related craziness that doesn't make sense, and I fully believe you when you say you had slow editing with near-empty .vimrc. I just find it baffling; for instance, here is a sample of my using vim in an older tablet, with latex syntax highlighting, UltiSnips, builtin terminal and w3m browser without any lag:

https://i.redd.it/p5h7ongm51541.jpg

So, baffling discrepancies; I wish software performance was more predictable.


> As the link shows, the syntax section of the Vim manual offers suggestions to increase speed on slow computers for all syntax categories, tex being one of them. That does not mean all those categories are a problem in Vim itself.

Oh, absolutely! I should have said before that I edited many file types in Vim on that netbook and syntax highlighting was lighting fast on all types except LaTeX. Sorry if I gave the wrong impression. Unfortunately for me, LaTeX is by far what I most wrote at the time, so it was an annoying problem.

> So, baffling discrepancies; I wish software performance was more predictable.

Amen to that! I've even been on the other side of this issue, with some Emacs packages I've written. I've received reports of some operations being very slow that I've been unable to reproduce (even though I continue to use underpowered hardware because I value battery life more than speed —I'm typing this, in Emacs, on a 10 year old Chromebook!).


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.


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!


Just be aware that the marker based folding can be annoying to collaborators if you are working on documents with other authors. With a plugin like FastFold [0] you should be able to have fast folding with the expr foldtype.

[0]: https://github.com/Konfekt/FastFold




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: