Friday, June 28, 2013

Re: Slow Syntax Highlighting with Latex

at wrote:
> I am having problems with slow speeds when using syntax highlighting in GVim using the native latex syntax highlighting.
>
> By slow I mean the response time between keyboard and screen is lagged.
>
> I can confirm that it is due to syntax highlighting by turning off all highlighting--then the response time is quick as in other applications.
>
> I have read posts by others on this topic both in this group and elsewhere. Most suggest turning off cursor line (or column) highlighting. I do not have this on.
>
> The machine I have problems with is fairly new and fast. Moreover, I use the exact same Vim configuration files on two much slower machines and do not observe this problem with the same .tex files.
>
> Any other suggestions as to how I can fix this?
>
Hello!

With v79 of syntax/tex.vim (available at my website:
http://www.drchip.org/astronaut/vim/index.html#SYNTAX_TEX ), there's a
number of ways to speed up LaTeX highlighting. From the help (which
hasn't appeared at Merc yet, but Bram has accepted):

*tex-slow* *tex-sync*
Tex: Slow Syntax Highlighting? ~

If you have a slow computer, you may wish to reduce the values for >
:syn sync maxlines=200
:syn sync minlines=50
(especially the latter). If your computer is fast, you may wish to
increase them. This primarily affects synchronizing (i.e. just what
group,
if any, is the text at the top of the screen supposed to be in?).

Another cause of slow highlighting is due to syntax-driven folding; see
|tex-folding| for a way around this.

*g:tex_fast*

Finally, if syntax highlighting is still too slow, you may set >

:let g:tex_fast= ""

in your .vimrc. Used this way, the g:tex_fast variable causes the syntax
highlighting script to avoid defining any regions and associated
synchronization. The result will be much faster syntax highlighting; the
price: you will no longer have as much highlighting or any syntax-based
folding, and you will be missing syntax-based error checking.

You may decide that some syntax is acceptable; you may use the following
table
selectively to enable just some syntax highlighting: >

b : allow bold and italic syntax
c : allow texComment syntax
m : allow texMatcher syntax (ie. {...} and [...])
M : allow texMath syntax
p : allow parts, chapter, section, etc syntax
r : allow texRefZone syntax (nocite, bibliography, label, pageref,
eqref)
s : allow superscript/subscript regions
S : allow texStyle syntax
v : allow verbatim syntax
V : allow texNewEnv and texNewCmd syntax
<
As an example, let g:tex_fast= "M" will allow math-associated highlighting
but suppress all the other region-based syntax highlighting.

*tex-folding* *g:tex_fold_enabled*
Tex: Want Syntax Folding? ~

As of version 28 of <syntax/tex.vim>, syntax-based folding of parts,
chapters,
sections, subsections, etc are supported. Put >
let g:tex_fold_enabled=1
in your <.vimrc>, and :set fdm=syntax. I suggest doing the latter via a
modeline at the end of your LaTeX file: >
% vim: fdm=syntax
If your system becomes too slow, then you might wish to look into >
https://vimhelp.appspot.com/vim_faq.txt.html#faq-29.7

Regards,
C Campbell

--
--
You received this message from the "vim_use" 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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: