mirror of
https://github.com/vim/vim
synced 2025-07-16 09:12:00 +00:00
Update runtime files.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
" Vim syntax file
|
||||
" Language: C
|
||||
" Maintainer: Bram Moolenaar <Bram@vim.org>
|
||||
" Last Change: 2020 Aug 28
|
||||
" Last Change: 2021 Jan 11
|
||||
|
||||
" Quit when a (custom) syntax file was already loaded
|
||||
if exists("b:current_syntax")
|
||||
@ -13,6 +13,9 @@ set cpo&vim
|
||||
|
||||
let s:ft = matchstr(&ft, '^\([^.]\)\+')
|
||||
|
||||
" check if this was included from cpp.vim
|
||||
let s:in_cpp_family = exists("b:filetype_in_cpp_family")
|
||||
|
||||
" Optional embedded Autodoc parsing
|
||||
" To enable it add: let g:c_autodoc = 1
|
||||
" to your .vimrc
|
||||
@ -55,7 +58,7 @@ if !exists("c_no_cformat")
|
||||
endif
|
||||
|
||||
" cCppString: same as cString, but ends at end of line
|
||||
if s:ft ==# "cpp" && !exists("cpp_no_cpp11") && !exists("c_no_cformat")
|
||||
if s:in_cpp_family && !exists("cpp_no_cpp11") && !exists("c_no_cformat")
|
||||
" ISO C++11
|
||||
syn region cString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend
|
||||
syn region cCppString start=+\(L\|u\|u8\|U\|R\|LR\|u8R\|uR\|UR\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell
|
||||
@ -87,7 +90,7 @@ syn match cSpecialCharacter display "L\='\\\o\{1,3}'"
|
||||
syn match cSpecialCharacter display "'\\x\x\{1,2}'"
|
||||
syn match cSpecialCharacter display "L'\\x\x\+'"
|
||||
|
||||
if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11"))
|
||||
if (s:ft ==# "c" && !exists("c_no_c11")) || (s:in_cpp_family && !exists("cpp_no_cpp11"))
|
||||
" ISO C11 or ISO C++ 11
|
||||
if exists("c_no_cformat")
|
||||
syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend
|
||||
@ -130,7 +133,7 @@ endif
|
||||
" But avoid matching <::.
|
||||
syn cluster cParenGroup contains=cParenError,cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserLabel,cBitField,cOctalZero,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom
|
||||
if exists("c_no_curly_error")
|
||||
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||
if s:in_cpp_family && !exists("cpp_no_cpp11")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
@ -144,7 +147,7 @@ if exists("c_no_curly_error")
|
||||
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
|
||||
endif
|
||||
elseif exists("c_no_bracket_error")
|
||||
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||
if s:in_cpp_family && !exists("cpp_no_cpp11")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell
|
||||
@ -158,7 +161,7 @@ elseif exists("c_no_bracket_error")
|
||||
syn match cErrInParen display contained "[{}]\|<%\|%>"
|
||||
endif
|
||||
else
|
||||
if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
|
||||
if s:in_cpp_family && !exists("cpp_no_cpp11")
|
||||
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,@cStringGroup,@Spell
|
||||
" cCppParen: same as cParen but ends at end-of-line; used in cDefine
|
||||
syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell
|
||||
@ -278,7 +281,7 @@ syn keyword cStorageClass static register auto volatile extern const
|
||||
if exists("c_gnu")
|
||||
syn keyword cStorageClass inline __attribute__
|
||||
endif
|
||||
if !exists("c_no_c99") && s:ft !=# 'cpp'
|
||||
if !exists("c_no_c99") && !s:in_cpp_family
|
||||
syn keyword cStorageClass inline restrict
|
||||
endif
|
||||
if !exists("c_no_c11")
|
||||
@ -420,7 +423,7 @@ endif
|
||||
syn cluster cLabelGroup contains=cUserLabel
|
||||
syn match cUserCont display "^\s*\zs\I\i*\s*:$" contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\zs\I\i*\s*:$" contains=@cLabelGroup
|
||||
if s:ft ==# 'cpp'
|
||||
if s:in_cpp_family
|
||||
syn match cUserCont display "^\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
syn match cUserCont display ";\s*\zs\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup
|
||||
else
|
||||
|
Reference in New Issue
Block a user