Home Explore Blog CI



neovim

8th chunk of `runtime/doc/syntax.txt`
b29a68b3a9a71e24b811f8c8e4fbf5cd0702c8f84c59bba20000000100000fa7
 disable them use `:unlet`.  Example: >
	:unlet c_comment_strings
Setting the value to zero doesn't work!

An alternative is to switch to the C++ highlighting: >
	:set filetype=cpp

Variable		Highlight ~
*c_gnu*			GNU gcc specific items
*c_comment_strings*	strings and numbers inside a comment
*c_space_errors*	trailing white space and spaces before a <Tab>
*c_no_trail_space_error*   ... but no trailing spaces
*c_no_tab_space_error*	 ... but no spaces before a <Tab>
*c_no_bracket_error*	don't highlight {}; inside [] as errors
*c_no_curly_error*	don't highlight {}; inside [] and () as errors;
			 ...except { and } in first column
			Default is to highlight them, otherwise you
			can't spot a missing ")".
*c_curly_error*		highlight a missing } by finding all pairs; this
			forces syncing from the start of the file, can be slow
*c_no_ansi*		don't do standard ANSI types and constants
*c_ansi_typedefs*	 ... but do standard ANSI types
*c_ansi_constants*	 ... but do standard ANSI constants
*c_no_utf*		don't highlight \u and \U in strings
*c_syntax_for_h*	for `*.h` files use C syntax instead of C++ and use objc
			syntax instead of objcpp
*c_no_if0*		don't highlight "#if 0" blocks as comments
*c_no_cformat*		don't highlight %-formats in strings
*c_no_c99*		don't highlight C99 standard items
*c_no_c11*		don't highlight C11 standard items
*c_no_c23*		don't highlight C23 standard items
*c_no_bsd*		don't highlight BSD specific types
*c_functions*		highlight function calls and definitions
*c_function_pointers*	highlight function pointers definitions

When 'foldmethod' is set to "syntax" then `/* */` comments and { } blocks will
become a fold.  If you don't want comments to become a fold use: >
	:let c_no_comment_fold = 1
"#if 0" blocks are also folded, unless: >
	:let c_no_if0_fold = 1

If you notice highlighting errors while scrolling backwards, which are fixed
when redrawing with CTRL-L, try setting the "c_minlines" internal variable
to a larger number: >
	:let c_minlines = 100
This will make the syntax synchronization start 100 lines before the first
displayed line.  The default value is 50 (15 when c_no_if0 is set).  The
disadvantage of using a larger number is that redrawing can become slow.

When using the "#if 0" / "#endif" comment highlighting, notice that this only
works when the "#if 0" is within "c_minlines" from the top of the window.  If
you have a long "#if 0" construct it will not be highlighted correctly.

To match extra items in comments, use the cCommentGroup cluster.
Example: >
   :au Syntax c call MyCadd()
   :function MyCadd()
   :  syn keyword cMyItem contained Ni
   :  syn cluster cCommentGroup add=cMyItem
   :  hi link cMyItem Title
   :endfun

ANSI constants will be highlighted with the "cConstant" group.	This includes
"NULL", "SIG_IGN" and others.  But not "TRUE", for example, because this is
not in the ANSI standard.  If you find this confusing, remove the cConstant
highlighting: >
	:hi link cConstant NONE

If you see '{' and '}' highlighted as an error where they are OK, reset the
highlighting for cErrInParen and cErrInBracket.

If you want to use folding in your C files, you can add these lines in a file
in the "after" directory in 'runtimepath'.  For Unix this would be
~/.config/nvim/after/syntax/c.vim. >
    syn sync fromstart
    set foldmethod=syntax

CH						*ch.vim* *ft-ch-syntax*

C/C++ interpreter.  Ch has similar syntax highlighting to C and builds upon
the C syntax file.  See |c.vim| for all the settings that are available for C.

By setting a variable you can tell Vim to use Ch syntax for `*.h` files, instead
of C or C++: >
	:let ch_syntax_for_h = 1


CHILL						*chill.vim* *ft-chill-syntax*

Chill syntax highlighting is similar to C.  See |c.vim| for all the settings
that are available.  Additionally there is:

chill_space_errors	like c_space_errors
chill_comment_string	like c_comment_strings
chill_minlines		like c_minlines


CHANGELOG				*changelog.vim* *ft-changelog-syntax*

ChangeLog supports highlighting

Title: More Details on C, CH, CHILL, and CHANGELOG Syntax Highlighting
Summary
This section continues detailing syntax highlighting in Vim. It lists further optional highlighting features for C, including options for UTF characters, using C syntax for `.h` files, hiding #if 0 blocks, format specifiers, C99/C11/C23 standard items, BSD-specific types, function calls/definitions, and function pointers. It also covers folding options and addresses potential highlighting errors during backward scrolling. The section explains how to match extra items in comments and customize ANSI constant highlighting. Furthermore, it describes CH syntax highlighting, which builds upon C syntax. CHILL syntax highlighting is also similar to C, with additional options. Finally, CHANGELOG syntax highlighting is mentioned.