aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-01-24 10:01:27 +0100
committerChristian Clason <c.clason@uni-graz.at>2024-01-24 11:05:25 +0100
commit0c1119ac7581e99d970b194d969b8776255cff44 (patch)
treef0769ea99bb44f3c0d2dcd7ca806b7ecde3d633c
parent9808a781d36b22f442eb7cb7e1246f405caa7255 (diff)
downloadrneovim-0c1119ac7581e99d970b194d969b8776255cff44.tar.gz
rneovim-0c1119ac7581e99d970b194d969b8776255cff44.tar.bz2
rneovim-0c1119ac7581e99d970b194d969b8776255cff44.zip
vim-patch:ca0e9823a1df
runtime(c): Highlight user defined functions closes: vim/vim#13763 https://github.com/vim/vim/commit/ca0e9823a1dfd71a17c0f08cb7973d413bf98999 Co-authored-by: Luca Saccarola <github.e41mv@aleeas.com>
-rw-r--r--runtime/doc/syntax.txt2
-rw-r--r--runtime/syntax/c.vim10
2 files changed, 12 insertions, 0 deletions
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 9164171152..afcf568a81 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -989,6 +989,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: >
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index 5ed8fdc847..a593bd26c2 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -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"