[vim/vim] C++ Syntax randomly turned off partially (#1210)

21 views
Skip to first unread message

Yan Zhou

unread,
Oct 29, 2016, 1:53:19 PM10/29/16
to vim/vim

After some recent update, (not sure when), c++ syntax sometime randomly turn off partially. I have difficulty to find out the condition under which the issue happens. I removed my vimrc file. So I will try my best to describe what I am experiencing, and perhaps someone else also had it.

In either gvim in Linux or Macvim on MacOS, after sometime of use, some of c++ syntax highlighting are off, such as size_t. In addition, normally when moving from word to word with w etc, words seperared by :: are treated as seperared words. For example, say the curse is at the s of std::vector, press w will move to :. However, when the syntax partial off happens, it moves to after vector.

I suspect I accidentally pressed some keys that tuned off some setting. However after long time searching through the doc, I can't find anything.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub

lacygoill

unread,
Jun 15, 2020, 6:34:10 AM6/15/20
to vim/vim, Subscribed

However, when the syntax partial off happens, it moves to after vector.

w should not be affected by the syntax highlighting. But it can be affected by 'iskeyword'. For example, you can reproduce this behavior by including : inside the option:

:setl isk+=:

If that's what happens, and you have a syntax plugin which uses the atom \k in some rule(s), it could explain why your syntax highlighting gets broken.

I suspect I accidentally pressed some keys that tuned off some setting.

Yes, that's probably what happens. You may have some plugin which resets 'isk'.
I had a look at the filetype and syntax plugins for c++ in $VIMRUNTIME, and I couldn't find one which tweaked the option; aside from the C filetype plugin (which is sourced by the c++ filetype plugin):
https://github.com/vim/vim/blob/47a519a933e8bcaf703a5feaac5c01491a658ee3/runtime/ftplugin/c.vim#L36-L39

But it's only done on OpenVMS, and it doesn't include : in 'isk', but $.

However after long time searching through the doc, I can't find anything.

Next time it happens, run this command:

:verb setl isk?

If it was reset by a plugin, you should see its path in the output:

iskeyword=...,:,...
      Last set from /path/to/some/script.vim line 123
                    ^^^^^^^^^^^^^^^^^^^^^^^^

You could also have a look at :h ft-cpp-syntax and :h ft-c-syntax. Maybe some option documented there could help you...

In any case, without a minimal working example, I doubt you'll get much more help.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

lacygoill

unread,
Jun 15, 2020, 6:38:39 AM6/15/20
to vim/vim, Subscribed

See also :h 06.2; in particular this paragraph:

  • The colors are wrong when scrolling bottom to top.
    Vim doesn't read the whole file to parse the text. It starts parsing
    wherever you are viewing the file. That saves a lot of time, but
    sometimes the colors are wrong. A simple fix is hitting CTRL-L. Or
    scroll back a bit and then forward again.
    For a real fix, see |:syn-sync|. Some syntax files have a way to make
    it look further back, see the help for the specific syntax file. For
    example, |tex.vim| for the TeX syntax.

As well as :h :syn-sync. Check out whether :syn sync fromstart helps.


You are receiving this because you are subscribed to this thread.

Reply to this email directly, view it on GitHub, or unsubscribe.

Egbert

unread,
May 13, 2026, 3:33:48 PMMay 13
to vim/vim, Subscribed
egberts left a comment (vim/vim#1210)

I have something that is easily and consistently repeatable that such 'syntax sync' get randomly turned off, except it is for nftables firewall rules and its syntax highlighting of 2,400 keywords, 29,000 Vimscript lines.

git clone https://github.com/egberts/vim-script-nftables
cd vim-script-nftables
make install
vim test/passing-syntax.nft

All it takes to lose the syntax capability is to page down as fast as you can.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1210/4444575285@github.com>

h_east

unread,
May 16, 2026, 9:41:39 AMMay 16
to vim/vim, Subscribed
h-east left a comment (vim/vim#1210)

@egberts https://github.com/egberts/vim-script-nftables is 404 not found.
Could you please check the URL?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1210/4467020511@github.com>

Christian Brabandt

unread,
May 16, 2026, 10:34:25 AMMay 16
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#1210)

I am guessing this is https://github.com/egberts/vim-syntax-nftables


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1210/4467138756@github.com>

h_east

unread,
May 16, 2026, 10:45:29 AMMay 16
to vim/vim, Subscribed
h-east left a comment (vim/vim#1210)

@egberts
Please run :mes and check if the following message is displayed:

'redrawtime' exceeded, syntax highlighting disabled

If you see this message, increasing the value of 'redrawtime' should resolve the issue:

set redrawtime=10000

For more details, please refer to :h 'redrawtime'.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1210/4467164754@github.com>

Egbert

unread,
May 16, 2026, 10:06:11 PMMay 16
to vim/vim, Subscribed
egberts left a comment (vim/vim#1210)

Good guess. Also fixed link


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1210/4468844387@github.com>

Egbert

unread,
Jun 4, 2026, 9:04:33 PM (7 hours ago) Jun 4
to vim/vim, Subscribed
egberts left a comment (vim/vim#1210)

Executed your :mes

Got

NORMAL<< passing-syntax.nft >>  ~/work/github/vim-syntax-nftables/test/passing-syntax.nft:850:1/8570
'redrawtime' exceeded, syntax highlighting disabled   

== WORKAROUND ==
This is a workaround only to the github/egberts/vim-syntax-nftables which is rather large.

:set redrawtime=10000

Fixes my issue of jumping into middle of large file and fast pagination.

Not closing this as it's not C++ (it is applicable only to netfilter nftables)


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1210/4627248489@github.com>

Egbert

unread,
Jun 4, 2026, 9:06:41 PM (7 hours ago) Jun 4
to vim/vim, Subscribed
egberts left a comment (vim/vim#1210)

set redrawtime=10000

Ummm, @h-east east, is this something that a specific vim syntax highlighter can include execute within their script, such as vim-syntax-nftables?


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1210/4627257198@github.com>

h_east

unread,
12:27 AM (3 hours ago) 12:27 AM
to vim/vim, Subscribed
h-east left a comment (vim/vim#1210)

While it's possible to specify this in the plugin, I think it's usually not necessary.
It's something the user might set themselves if their PC's specifications are too low.
However, for extremely resource-intensive syntax highlighting plugins, setting a larger value in the plugin itself might be acceptable.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1210/4628151726@github.com>

Christian Brabandt

unread,
3:09 AM (30 minutes ago) 3:09 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#1210)

Have you tried :syntime report to see which syntax atoms are slow? Also, I believe syntax sync might be able to help, especially when jumping around, as long as you don't use syn sync fromstart


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/1210/4629058646@github.com>

Reply all
Reply to author
Forward
0 new messages