Last active
August 29, 2015 14:16
-
-
Save mattn/7565b18ed8474ac82682 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/syntax/c.vim b/syntax/c.vim | |
index 128e1a2..7e90360 100644 | |
--- a/syntax/c.vim | |
+++ b/syntax/c.vim | |
@@ -1,7 +1,7 @@ | |
" Vim syntax file | |
" Language: C | |
" Maintainer: Bram Moolenaar <Bram@vim.org> | |
-" Last Change: 2014 Nov 13 | |
+" Last Change: 2015 Mar 1 | |
" Quit when a (custom) syntax file was already loaded | |
if exists("b:current_syntax") | |
@@ -47,16 +47,17 @@ if !exists("c_no_cformat") | |
endif | |
" cCppString: same as cString, but ends at end of line | |
-if s:ft ==# "cpp" && !exists("cpp_no_cpp11") | |
+if s:ft ==# "cpp" && !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 | |
-elseif s:ft ==# "c" && !exists("c_no_c11") | |
+elseif s:ft ==# "c" && !exists("c_no_c11") && !exists("c_no_cformat") | |
" ISO C99 | |
syn region cString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend | |
syn region cCppString start=+\%(L\|U\|u8\)\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell | |
else | |
" older C or C++ | |
+ syn match cFormat display "%%" contained | |
syn region cString start=+L\="+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend | |
syn region cCppString start=+L\="+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end='$' contains=cSpecial,cFormat,@Spell | |
endif | |
@@ -80,7 +81,11 @@ syn match cSpecialCharacter display "L'\\x\x\+'" | |
if (s:ft ==# "c" && !exists("c_no_c11")) || (s:ft ==# "cpp" && !exists("cpp_no_cpp11")) | |
" ISO C11 or ISO C++ 11 | |
- syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend | |
+ if exists("c_no_cformat") | |
+ syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,@Spell extend | |
+ else | |
+ syn region cString start=+\%(U\|u8\=\)"+ skip=+\\\\\|\\"+ end=+"+ contains=cSpecial,cFormat,@Spell extend | |
+ endif | |
syn match cCharacter "[Uu]'[^\\]'" | |
syn match cCharacter "[Uu]'[^']*'" contains=cSpecial | |
if exists("c_gnu") | |
@@ -387,8 +392,13 @@ endif | |
syn cluster cLabelGroup contains=cUserLabel | |
syn match cUserCont display "^\s*\I\i*\s*:$" contains=@cLabelGroup | |
syn match cUserCont display ";\s*\I\i*\s*:$" contains=@cLabelGroup | |
-syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup | |
-syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup | |
+if s:ft ==# 'cpp' | |
+ syn match cUserCont display "^\s*\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup | |
+ syn match cUserCont display ";\s*\%(class\|struct\|enum\)\@!\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup | |
+else | |
+ syn match cUserCont display "^\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup | |
+ syn match cUserCont display ";\s*\I\i*\s*:[^:]"me=e-1 contains=@cLabelGroup | |
+endif | |
syn match cUserLabel display "\I\i*" contained | |
diff --git a/syntax/cpp.vim b/syntax/cpp.vim | |
index 04fc733..a92d4ea 100644 | |
--- a/syntax/cpp.vim | |
+++ b/syntax/cpp.vim | |
@@ -1,8 +1,8 @@ | |
" Vim syntax file | |
" Language: C++ | |
-" Current Maintainer: vim-jp (https://github.com/vim-jp/cpp-vim) | |
+" Current Maintainer: vim-jp (https://github.com/vim-jp/vim-cpp) | |
" Previous Maintainer: Ken Shan <ccshan@post.harvard.edu> | |
-" Last Change: 2014 May 14 | |
+" Last Change: 2015 Mar 1 | |
" For version 5.x: Clear all syntax items | |
" For version 6.x: Quit when a syntax file was already loaded |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment