Move syntax files for C and C++ to an after/ directory. #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These syntax files need to be loaded after the syntax files from the Vim runtimes. Otherwise, they break rules such as cParen, which no longer sees the right parenthesis and causes a block of curly braces that follows it to produce errors.
Tested with a very simple C source code buffer:
Before this commit, the curly braces would be highlighted in error background, being marked as Error. After this commit, they look and behave correctly.
This does disable syntax rules such as cParen from the Vim runtimes, which is unfortunate. Those rules don't normal produce highlighting, except for cases where there are unbalanced parentheses or brackets, in which case it can highlight some of them as errors. However, without these rules, the colors in
overwrite_c_highlight
will not work. It's a tradeoff, I guess.See also this question on Stack Overflow and my answer discussing the rationale for the change.