]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
runtime(c): Highlight user defined functions
authorLuca Saccarola <github.e41mv@aleeas.com>
Sun, 24 Dec 2023 17:57:02 +0000 (18:57 +0100)
committerChristian Brabandt <cb@256bit.org>
Tue, 23 Jan 2024 20:34:09 +0000 (21:34 +0100)
closes: #13763

Signed-off-by: Luca Saccarola <github.e41mv@aleeas.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/syntax.txt
runtime/syntax/c.vim

index 5abc4e95b85c238f1e1c9d12491607bf5bc4ce73..a2377b5671c29ed9254090ae3956b8e3e4d3084f 100644 (file)
@@ -1,4 +1,4 @@
-*syntax.txt*   For Vim version 9.1.  Last change: 2024 Jan 06
+*syntax.txt*   For Vim version 9.1.  Last change: 2024 Jan 23
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -1026,6 +1026,8 @@ Variable          Highlight ~
 *c_no_c99*             don't highlight C99 standard items
 *c_no_c11*             don't highlight C11 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: >
index 5ed8fdc8472cce345dd057de913852cc3f4b5618..a593bd26c2cfd46d8600d6cd17f80fae7ca31b8c 100644 (file)
@@ -444,6 +444,14 @@ syn match  cUserLabel      display "\I\i*" contained
 syn match      cBitField       display "^\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
 syn match      cBitField       display ";\s*\zs\I\i*\s*:\s*[1-9]"me=e-1 contains=cType
 
+if exists("c_functions")
+  syn match cFunction "\<\h\w*\ze\_s*("
+ endif
+
+if exists("c_function_pointers")
+  syn match cFunctionPointer "\%((\s*\*\s*\)\@<=\h\w*\ze\s*)\_s*(.*)"
+endif
+
 if exists("c_minlines")
   let b:c_minlines = c_minlines
 else
@@ -513,6 +521,8 @@ hi def link cCppOutSkip             cCppOutIf2
 hi def link cCppInElse2                cCppOutIf2
 hi def link cCppOutIf2         cCppOut
 hi def link cCppOut            Comment
+hi def link cFunction          Function
+hi def link cFunctionPointer   Function
 
 let b:current_syntax = "c"