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
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.![]()
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.![]()
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.![]()
@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.![]()
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.![]()
@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.![]()
I am guessing this is https://github.com/egberts/vim-syntax-nftables
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.![]()
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=10000Fixes 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.![]()
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.![]()
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.![]()
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.![]()