diff --git a/vim/after/syntax/cplusplus.vim b/vim/after/syntax/cplusplus.vim index b0109ae..e0aa757 100644 --- a/vim/after/syntax/cplusplus.vim +++ b/vim/after/syntax/cplusplus.vim @@ -1,11 +1,24 @@ +if exists("b:current_syntax") + unlet b:current_syntax +endif + +syn include @cxxInDoxygen syntax/cpp.vim + +unlet b:current_syntax " This enables Basic C++ support, with my extensions. +let c_no_bracket_error=1 +let c_no_curly_error=1 if version < 600 so :p:h/cpp.vim else runtime! syntax/cpp.vim endif +if exists("b:current_syntax") + unlet b:current_syntax +endif + " This enables doxygen simultaneous with C++. if version < 600 so :p:h/doxygen.vim @@ -13,3 +26,7 @@ else runtime! syntax/doxygen.vim endif + +let b:current_syntax = "cplusplus" +syn sync clear +syn sync fromstart diff --git a/vim/after/syntax/doxygen.vim b/vim/after/syntax/doxygen.vim index bd349bf..7a22c1e 100644 --- a/vim/after/syntax/doxygen.vim +++ b/vim/after/syntax/doxygen.vim @@ -1,32 +1,27 @@ syn keyword doxygenParam contained tparam nextgroup=doxygenParamName,doxygenParamDirection skipwhite -syn region doxygenBody contained start=+\(/\*[*!]\)\@\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contains=doxygenFixedWidth skipwhite keepend matchgroup=xxx " Permit Ticked parameters -syn match doxygenParamName contained +`[A-Za-z0-9_:]\+`+ nextgroup=doxygenSpecialMultilineDesc,doxygenSpecialSingleLineDesc -" Too Recursive -" syn al @cxxInDoxygen syntax/cpp.vim +if exists("b:current_syntax") + unlet b:current_syntax +endif " Make all C++ code in a doxygen block look kinda like natural C++ "syn match doxygenSpecialMultilineDesc "`" -syn match doxygenCommentPreprocHighlight " \+\* " contained +syn cluster doxyNestedCXX contains=@cxxInDoxygen,doxygenSpecialContinueComment,doxygenSpecialContinueCommentWhite -syn region doxygenFixedWidth matchgroup=Comment start=+`+ skip=+ * + end=+`+ contained contains=cxxObjects,cxxMetaFunction,cxxConstants,cppStatement,cxxExceptionNames,cxxErrorNames,cxxCast,cxxStlPrefix,cxxStlTypes,cxxStlService,cxxStlKeywords,cxxStlFunctions,cxxStlTraits,cxxStlExceptionNames,cxxStlDangerousFunction,cppAccess,cppModifier,cppType,cppExceptions,cppOperator,cppCast,cppStorageClass,cppStructure,cppBoolean,cppConstant,cppModifier,cppRawString,cppNumber,cppRawStringDelimiter,cStatement,cLabel,cRepeat,cTodo,cBadContinuation,cSpecial,cFormat,cString,cCppString,cCppSkip,cStringGroup,cCharacter,cSpecialCharacter,cBlock,cParenGroup,cParen,cCppParen,cBadBlock,cNumber,cNumbers,cNumbersCom,cOctal,cOctalZero,cFloat,cOctalError,cCommentSkip,cCommentL,cCommentString,cComment2String,cComment,cOperator,cStatement,cStructure,cStorageClass,cConstant,cBitField,cUserCont,cPreProcGroup,doxygenCommentPreprocHighlight,cDefine,cNamedConstant +syn region doxygenFixedWidth containedin=doxygenBody matchgroup=Comment start=+^[ ]*\** *@code$+ skip=+^\n+ keepend end=+^[ ]*\** *@endcode$+ contains=@doxyNestedCXX -"syn region doxygenFixedWidth start=+`+ skip=+ * + end=+`+ contained contains=@cxx,@cpp +syn region doxygenFixedWidth containedin=doxygenBody matchgroup=Comment start=+^[ ]*\** *\~\~\~$+ skip=+^\n+ end=+^[ ]*\** *\~\~\~$+ contains=@doxyNestedCXX -syn region doxygenFixedWidth start=+\~\~\~+ skip=+ * + end=+\~\~\~+ contained contains=cxxObjects,cxxMetaFunction,cxxConstants,cppStatement,cxxExceptionNames,cxxErrorNames,cxxCast,cxxStlPrefix,cxxStlTypes,cxxStlService,cxxStlKeywords,cxxStlFunctions,cxxStlTraits,cxxStlExceptionNames,cxxStlDangerousFunction,cppAccess,cppModifier,cppType,cppExceptions,cppOperator,cppCast,cppStorageClass,cppStructure,cppBoolean,cppConstant,cppModifier,cppRawString,cppNumber,cppRawStringDelimiter,cStatement,cLabel,cRepeat,cTodo,cBadContinuation,cSpecial,cFormat,cString,cCppString,cCppSkip,cStringGroup,cCharacter,cSpecialCharacter,cBlock,cParenGroup,cParen,cCppParen,cBadBlock,cNumber,cNumbers,cNumbersCom,cOctal,cOctalZero,cFloat,cOctalError,cCommentSkip,cCommentL,cCommentString,cComment2String,cComment,cOperator,cStatement,cStructure,cStorageClass,cConstant,cBitField,cUserCont,cPreProc,cPreProcGroup,doxygenCommentPreprocHighlight,cDefine,cNamedConstant -"syn region doxygenFixedWidth start=+\~\~\~+ skip=+ * + end=+\~\~\~+ contained contains=@cxx,@cpp +syn region doxygenFixedWidth containedin=doxygenBody matchgroup=Comment start=+`+ end=+`+ keepend contains=@doxyNestedCXX "syn match doxygenFixedWidth +`.\+`+ contained -syn region doxygenSpecialMultilineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contained contains=doxygenSpecialContinueCommentWhite,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,doxygenFixedWidth,@doxygenHtmlGroup,@Spell skipwhite keepend -syn region doxygenSpecialSingleLineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contained contains=doxygenOtherTags,doxygenSpecialContinueCommentWhite,doxygenSmallSpecial,doxygenHyperLink,doxygenFixedWidth,doxygenHashLink,@doxygenHtmlGroup,doxygenTODO,@Spell skipwhite keepend "syn keyword doxygenOther contained : nextgroup=doxygenSpecialMultilineDesc skipwhite @@ -35,6 +30,3 @@ syn region doxygenSpecialSingleLineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\( " +\(\<[npcbea]\>\|\\|\\>\|\#]\)\@!+ nextgroup=doxygenParam,doxygenRetval,doxygenBriefWord,doxygenBold,doxygenBOther,doxygenOther,doxygenOtherTODO,doxygenOtherWARN,doxygenOtherBUG,doxygenPage,doxygenGroupDefine,doxygenCodeRegion,doxygenVerbatimRegion,doxygenDotRegion hi link doxygenFixedWidth None -hi link doxygenOtherTags doxygenOther -hi link doxygenSpecialSingleLineDesc doxygenSpecialMultilineDesc -hi link doxygenCommentPreprocHighlight PreProc diff --git a/vim/filetype.vim b/vim/filetype.vim index 4161b1e..bcc95bb 100644 --- a/vim/filetype.vim +++ b/vim/filetype.vim @@ -1,14 +1,14 @@ " Cynlib " .cc and .cpp files can be C++ or Cynlib. au BufNewFile,BufRead *.cc - \ if exists("cynlib_syntax_for_cc")|setf cynlib|else|setf cplusplus|endif + \ if exists("cynlib_syntax_for_cc")|setf cynlib|else|set filetype=cpp.cplusplus|endif au BufNewFile,BufRead *.cpp - \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cplusplus|endif + \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|set filetype=cpp.cplusplus|endif " C++ -au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.ipp,*.moc,*.tcc,*.inl setf cplusplus +au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.ipp,*.moc,*.tcc,*.inl set filetype=cpp.cplusplus if has("fname_case") - au BufNewFile,BufRead *.C,*.H setf cplusplus + au BufNewFile,BufRead *.C,*.H set filetype=cpp.cplusplus endif function! CheckForADAM() @@ -23,13 +23,13 @@ function! CheckForADAM() elseif exists("g:ch_syntax_for_h") setf ch else - setf cplusplus + setf cpp.cplusplus endif endfunction " .h files can be C, Ch C++, ObjC or ObjC++. " Set c_syntax_for_h if you want C, ch_syntax_for_h if you want Ch. ObjC is " detected automatically. -au BufNewFile,BufRead *.h setf cplusplus "call CheckForADAM() -au BufNewFile,BufRead *.cxx,*.cpp,*.hpp,*.cc,*.h setf cplusplus +au BufNewFile,BufRead *.h setf cpp.cplusplus "call CheckForADAM() +au BufNewFile,BufRead *.cxx,*.cpp,*.hpp,*.cc,*.h setf cpp.cplusplus