summaryrefslogtreecommitdiff
path: root/runtime/syntax/c.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-07-05 21:01:22 +0200
committerBram Moolenaar <Bram@vim.org>2013-07-05 21:01:22 +0200
commitbc488a76ccd7473d87f935b7db75bb6f3b55ac36 (patch)
tree255d1e17d3d84efb85baa85ce94fbbac24c038d0 /runtime/syntax/c.vim
parent2c6f3dca4e632c810a007244bbd367ecfccca522 (diff)
downloadvim-git-bc488a76ccd7473d87f935b7db75bb6f3b55ac36.tar.gz
A few updated runtime files.
Diffstat (limited to 'runtime/syntax/c.vim')
-rw-r--r--runtime/syntax/c.vim16
1 files changed, 10 insertions, 6 deletions
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim
index 6a62fe376..7a58ae712 100644
--- a/runtime/syntax/c.vim
+++ b/runtime/syntax/c.vim
@@ -1,7 +1,7 @@
" Vim syntax file
" Language: C
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2013 Jun 06
+" Last Change: 2013 Jul 05
" Quit when a (custom) syntax file was already loaded
if exists("b:current_syntax")
@@ -11,6 +11,8 @@ endif
let s:cpo_save = &cpo
set cpo&vim
+let s:ft = matchstr(&ft, '^\([^.]\)\+')
+
" A bunch of useful C keywords
syn keyword cStatement goto break return continue asm
syn keyword cLabel case default
@@ -110,7 +112,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 &filetype ==# 'cpp' && !exists("cpp_no_cpp11")
+ if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@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
@@ -124,7 +126,7 @@ if exists("c_no_curly_error")
syn match cErrInParen display contained "^[{}]\|^<%\|^%>"
endif
elseif exists("c_no_bracket_error")
- if &filetype ==# 'cpp' && !exists("cpp_no_cpp11")
+ if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cCppString,@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
@@ -138,7 +140,7 @@ elseif exists("c_no_bracket_error")
syn match cErrInParen display contained "[{}]\|<%\|%>"
endif
else
- if &filetype ==# 'cpp' && !exists("cpp_no_cpp11")
+ if s:ft ==# 'cpp' && !exists("cpp_no_cpp11")
syn region cParen transparent start='(' end=')' contains=ALLBUT,@cParenGroup,cCppParen,cErrInBracket,cCppBracket,cCppString,@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
@@ -158,7 +160,7 @@ else
syn match cErrInBracket display contained "[);{}]\|<%\|%>"
endif
-if &filetype ==# 'c' || exists("cpp_no_cpp11")
+if s:ft ==# 'c' || exists("cpp_no_cpp11")
syn region cBadBlock keepend start="{" end="}" contained containedin=cParen,cBracket,cBadBlock transparent fold
endif
@@ -370,7 +372,7 @@ syn region cPreProc start="^\s*\(%:\|#\)\s*\(pragma\>\|line\>\|warning\>\|warn\>
" Highlight User Labels
syn cluster cMultiGroup contains=cIncluded,cSpecial,cCommentSkip,cCommentString,cComment2String,@cCommentGroup,cCommentStartError,cUserCont,cUserLabel,cBitField,cOctalZero,cCppOutWrapper,cCppInWrapper,@cCppOutInGroup,cFormat,cNumber,cFloat,cOctal,cOctalError,cNumbersCom,cCppParen,cCppBracket,cCppString
-if &filetype ==# 'c' || exists("cpp_no_cpp11")
+if s:ft ==# 'c' || exists("cpp_no_cpp11")
syn region cMulti transparent start='?' skip='::' end=':' contains=ALLBUT,@cMultiGroup,@Spell
endif
" Avoid matching foo::bar() in C++ by requiring that the next char is not ':'
@@ -457,6 +459,8 @@ hi def link cCppOut Comment
let b:current_syntax = "c"
+unlet s:ft
+
let &cpo = s:cpo_save
unlet s:cpo_save
" vim: ts=8