AW: Synchronize syntax highlighting

46 views
Skip to first unread message

Janis Papanagnou

unread,
Aug 9, 2026, 9:52:46 AM (3 days ago) Aug 9
to 'John Jackson' via vim_use
Sorry, John, somehow my mail-client sent my email to you instead of the mailing list.

________________________________________
Von: Janis Papanagnou <janis_pa...@hotmail.com>
Gesendet: Sonntag, 9. August 2026 12:48
An: 'John Jackson' via vim_use
Betreff: Synchronize syntax highlighting

Sometimes, for some files, the sync of syntax-highlighting fails
(i.e. all text gets uniformly colored).

In the past, to tackle that, I've adjusted some vim parameter,
increased a value from something like 3000 to 10000, or so.
On my new system that setting got lost, unfortunately, and I
cannot find it.

Can someone point me to the name of that parameter, please,
so that I can re-establish a better highlighting-sync behavior.

Thanks!

Janis

Janis Papanagnou

unread,
Aug 9, 2026, 9:53:55 AM (3 days ago) Aug 9
to 'John Jackson' via vim_use

Tim Chase

unread,
Aug 9, 2026, 9:57:10 AM (3 days ago) Aug 9
to vim...@googlegroups.com
On 2026-08-09 10:48, Janis Papanagnou wrote:
> Sometimes, for some files, the sync of syntax-highlighting fails
> (i.e. all text gets uniformly colored).
>
> In the past, to tackle that, I've adjusted some vim parameter,
> increased a value from something like 3000 to 10000, or so.
> On my new system that setting got lost, unfortunately, and I
> cannot find it.

I think you're looking for the minlines= and maxlines= values described
here:

:help syn-sync-maxlines
:help syn-sync-third

-tim
--





Christian Brabandt

unread,
Aug 9, 2026, 11:17:41 AM (3 days ago) Aug 9
to vim...@googlegroups.com
:h 'synmaxcol'

Best,
Christian
--
QOTD:
"I drive my car quietly, for it goes without saying."

Janis Papanagnou

unread,
Aug 10, 2026, 11:30:14 AM (2 days ago) Aug 10
to vim...@googlegroups.com
I've tried various suggestions (minlines, synmaxcol, etc.),
read the manual for information about possible tweaks
searched the web, ... - to no avail!

Trying with various numbers in configs like
set smc=9000
syntax sync minlines=1000 maxlines=1000

I'm still getting no sync in a (even non-demanding) test case:
opening a 476 line file, max. columns 84 => highlighting okay,
searching for a text that appears in line 438 => NO SYNC here!
(After scrolling 3 pages up the sync was okay again.)

More testing...
Opened a 80x25 terminal window.
Same testcase as above. => highlighting okay!!!
Resized the terminal window to 120x50.
Opened the file again, same testcase => NO SYNC !
Resized the terminal window back to 80x25.
Opened the file again, same testcase => highlighting okay

This is strange!!!
Highlighting depends on the terminal size, not on the actual text!

$ vi --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jul 13 2026 17:17:48)
Included patches: 1-16, 647, 678, 697
Modified by team...@tracker.debian.org


If you have some more config options to try out I'd be keen to hear.
Thanks!

Janis

________________________________________
Von: vim...@googlegroups.com <vim...@googlegroups.com> im Auftrag von Christian Brabandt <cbl...@256bit.org>
Gesendet: Sonntag, 9. August 2026 17:17
An: vim...@googlegroups.com
Betreff: Re: Synchronize syntax highlighting

:h 'synmaxcol'

--
--
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+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/aniZ/O7l6XfNFoal%40256bit.org.

Christian Brabandt

unread,
Aug 10, 2026, 2:55:32 PM (2 days ago) Aug 10
to vim...@googlegroups.com

On Mo, 10 Aug 2026, Janis Papanagnou wrote:

> I've tried various suggestions (minlines, synmaxcol, etc.),
> read the manual for information about possible tweaks
> searched the web, ... - to no avail!
>
> Trying with various numbers in configs like
> set smc=9000
> syntax sync minlines=1000 maxlines=1000
>
> I'm still getting no sync in a (even non-demanding) test case:
> opening a 476 line file, max. columns 84 => highlighting okay,
> searching for a text that appears in line 438 => NO SYNC here!
> (After scrolling 3 pages up the sync was okay again.)
>
> More testing...
> Opened a 80x25 terminal window.
> Same testcase as above. => highlighting okay!!!
> Resized the terminal window to 120x50.
> Opened the file again, same testcase => NO SYNC !
> Resized the terminal window back to 80x25.
> Opened the file again, same testcase => highlighting okay
>
> This is strange!!!
> Highlighting depends on the terminal size, not on the actual text!

does
:syn sync fromstart

help?

This depends on the current syntax script and file being used, but it is
worth a try when this happens. I suppose this happens with algol68
files? This has a hard-coded limit of 500 lines.

It is not generally recommended to use syn sync fromstart in syntax
script, because it comes with a performance penalty, but in cases when
you notice syntax being off, it is worth a try.

Best,
Christian
--

Janis Papanagnou

unread,
Aug 11, 2026, 1:12:32 PM (16 hours ago) Aug 11
to vim...@googlegroups.com
Hi Christian!

> > I've tried various suggestions (minlines, synmaxcol, etc.),
> > read the manual for information about possible tweaks
> > searched the web, ... - to no avail!
> >
> > Trying with various numbers in configs like
> > set smc=9000
> > syntax sync minlines=1000 maxlines=1000
> >
> > I'm still getting no sync in a (even non-demanding) test case:
> > opening a 476 line file, max. columns 84 => highlighting okay,
> > searching for a text that appears in line 438 => NO SYNC here!
> > (After scrolling 3 pages up the sync was okay again.)
> >
> > More testing...
> > Opened a 80x25 terminal window.
> > Same testcase as above. => highlighting okay!!!
> > Resized the terminal window to 120x50.
> > Opened the file again, same testcase => NO SYNC !
> > Resized the terminal window back to 80x25.
> > Opened the file again, same testcase => highlighting okay
> >
> > This is strange!!!
> > Highlighting depends on the terminal size, not on the actual text!
>
> does
> :syn sync fromstart
>
> help?

I've meanwhile extended my file and the effect wasn't seen then any more,
but with an old version this trick indeed re-established the sync. - Thanks!

>
> This depends on the current syntax script and file being used, but it is
> worth a try when this happens. I suppose this happens with algol68
> files? This has a hard-coded limit of 500 lines.

While I had observed this effect in the past also with other languages or
text data in this case it's indeed an Algol 68 source.

After your hint I've meanwhile also noticed the hard-coded limit.
Do these limits make sense? (They appear to be quite small anyway!)
Would it hurt to remove those limits? (Or define higher values?)

The parameters are defined as: syn sync minlines=250 maxlines=500 which
I think means a context of +/- 250 lines considered for syncing? - That's not
much given that the sync is obviously not done on language-specific syntax
sync points. - I've now changed my local ~/.vim/syntax/algol68.vim and
adjusted these values to 1000 each[*]; this solved the issue - at least locally,
and for this specific source; let's see how far I get with those values.

[*] Is that sensible or should 'maxvalue' be twice as large to to obtain the
+/- 1000 context range? (The parameter names are a bit confusing to me;
a "sync-lines-before" and "sync-lines-after" semantics might be clearer.)

Though I'm wondering that a user-specific setting (in .vimrc) cannot override
the system setting here. (But that may be an effect of this syntax file is in my
system also locally below ~/.vim/syntax, and therefore it takes precedence?)

And the dependency of the effect on the window size is still a mystery to
me! (To me that smells like a bug or design problem in this specific case.)

> It is not generally recommended to use syn sync fromstart in syntax
> script, because it comes with a performance penalty, but in cases when
> you notice syntax being off, it is worth a try.

Yes, that's certainly useful and good to know!

With Vim I've never had any performance problem editing program's text.
(Only on *very* large textual data there's regularly a performance issue.)
I'd think an increase of (hard-coded) sync values for program texts would
generally not hurt. (Or are people really writing _monolithic code_ of tens
of thousands line of code in one file without structuring it in files?)

There's a couple questions raised in this post; can you tell me whether you
think some of these needs attention to be changed?

Thanks again!

Regards,
Janis

aro...@vex.net

unread,
Aug 11, 2026, 3:08:01 PM (14 hours ago) Aug 11
to vim...@googlegroups.com

I'm curious to know why anyone is editing Algol 68 code in 2026. Are there
even functioning compilers available any more?

Piotr Kolasiński

unread,
Aug 11, 2026, 3:11:00 PM (14 hours ago) Aug 11
to vim...@googlegroups.com
See:




W dniu wt., 11 sie 2026 o 21:07 <aro...@vex.net> napisał(a):

I'm curious to know why anyone is editing Algol 68 code in 2026. Are there
even functioning compilers available any more?

--
--
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+u...@googlegroups.com.

Janis Papanagnou

unread,
Aug 11, 2026, 8:08:31 PM (9 hours ago) Aug 11
to vim...@googlegroups.com
I'll answer your question but suggest to continue this topic in
Usenet (comp.lang.misc) if you're interested in more details.

Von: vim...@googlegroups.com <vim...@googlegroups.com> im Auftrag von aro...@Vex.Net <aro...@Vex.Net>
Gesendet: Dienstag, 11. August 2026 21:07
An: vim...@googlegroups.com

> I'm curious to know why anyone is editing Algol 68 code in 2026.

Simply; I'm *editing* it because I am _writing programs_ in Algol 68.

The question was probably meant as why one would write programs
in an old (legacy) language like Algol 68. - The answer is not simple.
In the past 50 years I've programmed in a lot of languages, Algol 68
was amongst the cleanest, yet very powerful, and safe! It was not my
first and certainly not my last language, but other languages with all
these properties were long rare, even non-existing. When I found a
high-quality Algol 68 interpreter lately I was glad to refresh my old
programming skills in a language that was by far more enjoyable to
program in than, say, in "C" (or similar), or in one of the many more
languages (that are sometimes even hyped, for reasons beyond me).

> Are there even functioning compilers available any more?

The "Genie" compiler "a68g" is the one that I found, and used since
then. It's of very high quality (as I said), and effectively a "complete"
implementation of that very large language. In addition it has quite
some powerful extensions (for math, plotting, databases, functions
and methods we know Unix systems, etc.). I think it was developed
in the 1990's and made public (with source code) for free use in the
late 1990's (IIRC). A 700-pages PDF documentation comes with it.
It is still maintained by its original author, Marcel van der Veer, and
releases are still published.

In addition there's a much more recent GNU project to release an
Algol 68 compiler, "ga68", as part of the GNU Compiler Collection.
It's probably too fresh - maybe even incomplete, can't tell - to say
anything about it. But its recent development is an indication that
there seems to be still some interest in the Algol 68 language.

The Vim syntax file is a small contribution to support that interest.

Janis

Reply all
Reply to author
Forward
0 new messages