Made vim highlighting work mostly how I want now.
I made `cpp.cplusplus` a hybrid filetype which tricks the vim highlighting into believing that we're really in raw C++ for the purposes of the core vim highlighting rules. My `cplusplus` type adds more bits to the core stuff, but mostly exists to let doxygen slip in the way that I want it to.
This commit is contained in:
@ -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.
|
" This enables Basic C++ support, with my extensions.
|
||||||
|
let c_no_bracket_error=1
|
||||||
|
let c_no_curly_error=1
|
||||||
if version < 600
|
if version < 600
|
||||||
so <sfile>:p:h/cpp.vim
|
so <sfile>:p:h/cpp.vim
|
||||||
else
|
else
|
||||||
runtime! syntax/cpp.vim
|
runtime! syntax/cpp.vim
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if exists("b:current_syntax")
|
||||||
|
unlet b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
" This enables doxygen simultaneous with C++.
|
" This enables doxygen simultaneous with C++.
|
||||||
if version < 600
|
if version < 600
|
||||||
so <sfile>:p:h/doxygen.vim
|
so <sfile>:p:h/doxygen.vim
|
||||||
@ -13,3 +26,7 @@ else
|
|||||||
runtime! syntax/doxygen.vim
|
runtime! syntax/doxygen.vim
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
let b:current_syntax = "cplusplus"
|
||||||
|
syn sync clear
|
||||||
|
syn sync fromstart
|
||||||
|
|||||||
@ -1,32 +1,27 @@
|
|||||||
syn keyword doxygenParam contained tparam nextgroup=doxygenParamName,doxygenParamDirection skipwhite
|
syn keyword doxygenParam contained tparam nextgroup=doxygenParamName,doxygenParamDirection skipwhite
|
||||||
|
|
||||||
syn region doxygenBody contained start=+\(/\*[*!]\)\@<!<\|[^<]\|$+ matchgroup=doxygenEndComment end=+\*/+re=e-2,me=e-2 contains=doxygenContinueCommentWhite,doxygenTODO,doxygenSpecial,doxygenOtherTags,doxygenSmallSpecial,doxygenHyperLink,doxygenHashLink,@doxygenHtmlGroup,@Spell,doxygenFixedWidth
|
|
||||||
|
|
||||||
syn region doxygenBriefLine contained start=+\<\k+ skip=+^\s*\(\*/\@!\s*\)\=\(\<\|[@\\]\<\([npcbea]\>\|em\>\|ref\|link\>\>\|f\$\|[$\\&<>#]\)\|[^ \t\\@*]\)+ end=+^+ contains=doxygenFixedWidth skipwhite keepend matchgroup=xxx
|
|
||||||
|
|
||||||
" Permit Ticked parameters
|
" Permit Ticked parameters
|
||||||
syn match doxygenParamName contained +`[A-Za-z0-9_:]\+`+ nextgroup=doxygenSpecialMultilineDesc,doxygenSpecialSingleLineDesc
|
|
||||||
|
|
||||||
" Too Recursive
|
if exists("b:current_syntax")
|
||||||
" syn al @cxxInDoxygen syntax/cpp.vim
|
unlet b:current_syntax
|
||||||
|
endif
|
||||||
|
|
||||||
" Make all C++ code in a doxygen block look kinda like natural C++
|
" Make all C++ code in a doxygen block look kinda like natural C++
|
||||||
"syn match doxygenSpecialMultilineDesc "`"
|
"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 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
|
"syn keyword doxygenOther contained : nextgroup=doxygenSpecialMultilineDesc skipwhite
|
||||||
|
|
||||||
@ -35,6 +30,3 @@ syn region doxygenSpecialSingleLineDesc start=+.\++ skip=+^\s*\(\*/\@!\s*\)\=\(
|
|||||||
" +\(\<[npcbea]\>\|\<em\>\|\<ref\|\<link\>\>\|\<f\$\|[$\\&<>#]\)\@!+ nextgroup=doxygenParam,doxygenRetval,doxygenBriefWord,doxygenBold,doxygenBOther,doxygenOther,doxygenOtherTODO,doxygenOtherWARN,doxygenOtherBUG,doxygenPage,doxygenGroupDefine,doxygenCodeRegion,doxygenVerbatimRegion,doxygenDotRegion
|
" +\(\<[npcbea]\>\|\<em\>\|\<ref\|\<link\>\>\|\<f\$\|[$\\&<>#]\)\@!+ nextgroup=doxygenParam,doxygenRetval,doxygenBriefWord,doxygenBold,doxygenBOther,doxygenOther,doxygenOtherTODO,doxygenOtherWARN,doxygenOtherBUG,doxygenPage,doxygenGroupDefine,doxygenCodeRegion,doxygenVerbatimRegion,doxygenDotRegion
|
||||||
|
|
||||||
hi link doxygenFixedWidth None
|
hi link doxygenFixedWidth None
|
||||||
hi link doxygenOtherTags doxygenOther
|
|
||||||
hi link doxygenSpecialSingleLineDesc doxygenSpecialMultilineDesc
|
|
||||||
hi link doxygenCommentPreprocHighlight PreProc
|
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
" Cynlib
|
" Cynlib
|
||||||
" .cc and .cpp files can be C++ or Cynlib.
|
" .cc and .cpp files can be C++ or Cynlib.
|
||||||
au BufNewFile,BufRead *.cc
|
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
|
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++
|
" 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")
|
if has("fname_case")
|
||||||
au BufNewFile,BufRead *.C,*.H setf cplusplus
|
au BufNewFile,BufRead *.C,*.H set filetype=cpp.cplusplus
|
||||||
endif
|
endif
|
||||||
|
|
||||||
function! CheckForADAM()
|
function! CheckForADAM()
|
||||||
@ -23,13 +23,13 @@ function! CheckForADAM()
|
|||||||
elseif exists("g:ch_syntax_for_h")
|
elseif exists("g:ch_syntax_for_h")
|
||||||
setf ch
|
setf ch
|
||||||
else
|
else
|
||||||
setf cplusplus
|
setf cpp.cplusplus
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" .h files can be C, Ch C++, ObjC or ObjC++.
|
" .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
|
" Set c_syntax_for_h if you want C, ch_syntax_for_h if you want Ch. ObjC is
|
||||||
" detected automatically.
|
" detected automatically.
|
||||||
au BufNewFile,BufRead *.h setf cplusplus "call CheckForADAM()
|
au BufNewFile,BufRead *.h setf cpp.cplusplus "call CheckForADAM()
|
||||||
au BufNewFile,BufRead *.cxx,*.cpp,*.hpp,*.cc,*.h setf cplusplus
|
au BufNewFile,BufRead *.cxx,*.cpp,*.hpp,*.cc,*.h setf cpp.cplusplus
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user