From d67b689666100c4b8dacbef13175db6341ff23a2 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Wed, 20 Jun 2018 15:30:25 -0400 Subject: [PATCH 1/6] Cleanup some BSD specific variables. Linux and BSD pick up the ls colours variables under different circumstances now. --- tcshrc | 4 ---- tcshrc.aliases | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tcshrc b/tcshrc index f681726..d9ea307 100644 --- a/tcshrc +++ b/tcshrc @@ -83,10 +83,6 @@ else setenv LS_COLORS 'no=00:fi=00:di=01;34:ln=01;35:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=01;05;41;37:ex=00;31:*.tar=01;31:*.tgz=01;31:*.tbz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.png=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.cpp=32:*.cc=32:*.c=32:*.l=32:*.m=32:*.i=33:*.cxx=32:*.h=33:*.hpp=33:*.a=31:*.asm=31:*.bin=35:*.sec=36:*.ko=31' endif -#The LSCOLORS for *BSD is always working, so there's no need to versionify -#this. The environment variable's presence is trivial. -#For FreeBSD's ls(1), and derived utilities {Like MacOS X/Darwin's ls(1)} -setenv LSCOLORS 'ExFxcxdxbxegedabagacEB' setenv CLICOLOR_FORCE if( $?CSHENV_DEBUG ) then diff --git a/tcshrc.aliases b/tcshrc.aliases index f654ebc..517909a 100644 --- a/tcshrc.aliases +++ b/tcshrc.aliases @@ -55,6 +55,8 @@ switch( $CSHENV_SYSTEM_LS ) #FALLTHROUGH case FreeBSD: + #For FreeBSD's ls(1), and derived utilities {Like MacOS X/Darwin's ls(1)} + setenv LSCOLORS 'ExFxcxdxbxegedabagacEB' alias l ls -FG breaksw From 0f518cb3e0a5c164e3e4c3139d61dc563bcef858 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Wed, 20 Jun 2018 15:38:09 -0400 Subject: [PATCH 2/6] FreeBSD less options improvement. When less hits the end, I want it to not quit. But I also want less to not page at all on content which fits onto a single screen. --- tcshrc.system.FreeBSD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcshrc.system.FreeBSD b/tcshrc.system.FreeBSD index 8db8aa5..4117c9f 100644 --- a/tcshrc.system.FreeBSD +++ b/tcshrc.system.FreeBSD @@ -5,7 +5,7 @@ endif # Set the acknowledgement bit, essentially setenv CSHENV_SYSTEM_CONFIGURED FreeBSD -setenv LESS -er +setenv LESS -erF setenv PAGER less if( $?CSHENV_DEBUG ) then From 0dd3953f812dedd3622847b7d0b1d881f2780908 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Thu, 21 Jun 2018 00:05:42 -0400 Subject: [PATCH 3/6] Add mongo core syntax changes. Some of these I'll port into my new central file arrangements. --- vim/after/syntax/cpp.vim | 12 +++++++---- vim/after/syntax/doxygen.vim | 39 ++++++++++++++++++++++++++++++++++++ vim/colors/adam.vim | 4 ++++ vim/vimrc.fileprefs | 13 ++++++------ vim/vimrc.functions | 5 +++++ vim/vimrc.statusline | 26 ++++++++++++++---------- 6 files changed, 78 insertions(+), 21 deletions(-) diff --git a/vim/after/syntax/cpp.vim b/vim/after/syntax/cpp.vim index 6644ef3..3aa68a9 100644 --- a/vim/after/syntax/cpp.vim +++ b/vim/after/syntax/cpp.vim @@ -8,7 +8,7 @@ else endif syn match cxxObjects "\<[A-Z][A-Za-z0-9_]*[a-z][A-Za-z0-9_]*\>" -syn match cxxMetaFunction "\<[a-z][a-z0-9]*_[a-z0-9_]*[a-z0-9]\>" +"syn match cxxMetaFunction "\<[a-z][a-z0-9]*_[a-z0-9_]*[a-z0-9]\>" syn keyword cppType noexcept decltype @@ -19,8 +19,7 @@ syn keyword cppStatement static_assert syn keyword cxxConstants nullptr -syn match cxxConstants "\" -syn match cxxConstants "\" +syn match cxxConstants "\<\(C::[A-Za-z_]\|k[A-Z]\)[A-Z_a-z0-9]*\>" syn keyword cxxExceptionNames Exception Exceptions syn match cxxExceptionNames "\<[A-Z][A-Za-z0-9_]*Exception\>" @@ -44,13 +43,17 @@ syn match cxxStlConstant "\(std::\)\@<=\(endl\|flush\)\>" syn match cxxStlKeywords "\(\" syn match cxxStlKeywords "\(\" -syn match cxxStlKeywords "\(std::\)\@<=\(unique\|shared\|weak\)_ptr\(<\)\@=" +" syn match cxxStlTypes "\(std::\)\@<=\(vector\|array\|deque\|list\|pair\|\(priority_\)\?queue\|stack\|\(unordered_\)\?\(multi\)\?\(set\|map\)\)\(<\|;\| \)\@=" +syn match cxxStlKeywords "\(std::\)\@<=\(unique_ptr\)\(<\|;\| \|\>\)\@=" +syn match cxxStlKeywords "\(std::\)\@<=\(shared_ptr\)\(<\|;\| \|\>\)\@=" +syn match cxxStlKeywords "\(std::\)\@<=\(weak_ptr\)\(<\|;\| \|\>\)\@=" syn match cxxStlKeywords "\(std::\)\@<=nullptr_t\>" syn match cxxStlKeywords "\(std::\)\@<=function\>" syn match cxxStlFunctions "\(std::\)\@<=make_\(unique\|shared\)\(<\)\@=" syn match cxxStlFunctions "\(std::\)\@<=make_\(pair\|tuple\)\((\|<\)\@=" +syn match cxxStlFunctions "\(std::\)\@<=addressof\((\)\@=" syn match cxxStlFunctions "\(std::\)\@<=tie\((\)\@=" syn match cxxStlFunctions "\(std::\)\@<=copy\(_\(n\|backward\|if\)\)\?\((\)\@=" syn match cxxStlFunctions "\(std::\)\@<=find\(_\(if\|first_of\|end\)\?\)\((\)\@=" @@ -122,6 +125,7 @@ if version >= 508 || !exists("did_cxx_syntax_inits") HiLink cxxStlFunctions cppStatement HiLink cxxStlPrefix Caller HiLink cxxStlTraits MetaFunction + HiLink cxxMetaFunction MetaFunction HiLink cxxStlDangerousFunction Dangerous diff --git a/vim/after/syntax/doxygen.vim b/vim/after/syntax/doxygen.vim index ff7c6b9..bd349bf 100644 --- a/vim/after/syntax/doxygen.vim +++ b/vim/after/syntax/doxygen.vim @@ -1 +1,40 @@ 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 + +" Make all C++ code in a doxygen block look kinda like natural C++ +"syn match doxygenSpecialMultilineDesc "`" + +syn match doxygenCommentPreprocHighlight " \+\* " contained + +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 start=+`+ skip=+ * + end=+`+ contained contains=@cxx,@cpp + +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 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 match doxygenMagic + +" +\(\<[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/colors/adam.vim b/vim/colors/adam.vim index 0eea801..98b4bca 100644 --- a/vim/colors/adam.vim +++ b/vim/colors/adam.vim @@ -78,6 +78,10 @@ hi cIf0 ctermfg=gray " End of ron above. "set t_Co=8 +"hi StatusUnwrap ctermfg=236 ctermbg=none cterm=none +"hi StatusUnwrap ctermfg=brown ctermbg=none cterm=none +"hi StatusUnwrap ctermfg=236 ctermbg=none cterm=none +hi StatusUnwrap ctermfg=58 ctermbg=none cterm=none hi Comment ctermfg=darkgrey cterm=bold hi Identifier ctermfg=cyan hi Object ctermfg=red diff --git a/vim/vimrc.fileprefs b/vim/vimrc.fileprefs index 8eea182..b0b6be1 100644 --- a/vim/vimrc.fileprefs +++ b/vim/vimrc.fileprefs @@ -1,11 +1,10 @@ "au BufNewFile,BufRead *.i,*.l setf c -au BufNewFile,BufRead mk* setf make +au BufNewFile,BufRead mk* set filetype=make "au BufNewFile,BufRead *.slogo setf c au BufNewFile,BufRead *.tex map _ {!}fmt -p -s -w 70 au BufNewFile,BufRead *.tex set textwidth=78 au BufNewFile,BufRead *.java set tabstop=4 au BufNewFile,BufRead *.java set shiftwidth=4 -au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h setf cpp " Alephaish au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set sw=4 @@ -15,7 +14,7 @@ au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set sta au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set noet au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set tw=150 -au BufNewFile,BufRead */cshenv/tcshrc.* setf tcsh +au BufNewFile,BufRead */cshenv/tcshrc.* set filetype=tcsh " falcish "au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set ts=3 @@ -31,8 +30,10 @@ au BufNewFile,BufRead */cshenv/tcshrc.* setf tcsh "au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set et "au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set tw=100 +"au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h setf cpp + au FileType * setlocal formatoptions=tcq -if has("syntax") - syntax on -endif +"if has("syntax") +" syntax on +"endif diff --git a/vim/vimrc.functions b/vim/vimrc.functions index 54c1329..a9cc43d 100644 --- a/vim/vimrc.functions +++ b/vim/vimrc.functions @@ -15,3 +15,8 @@ function! MyFoldText() return v:folddashes . sub endif endfunction + +function! SyntaxItem() + return synIDattr(synID(line("."),col("."),1),"name") +endfunction + diff --git a/vim/vimrc.statusline b/vim/vimrc.statusline index 1ef5ddf..fcd2a0d 100644 --- a/vim/vimrc.statusline +++ b/vim/vimrc.statusline @@ -1,5 +1,5 @@ function! GetYearGlyph() - " TODO Write a full parser which adjusts for some "second centry" + " TODO Write a full parser which adjusts for some "second century" " point generates: " 00 - 09 as \`0 - \`9 " 10 - 19 as \'0 - \'9 @@ -36,16 +36,20 @@ endfunction " when I start. -set statusline= " reset the status line, for ADAM's colorful status line -set statusline+=%1*[%02.03n]%0* " max/min for buf #, in [] -set statusline+=Pos:\ %4*%3l/%3L%0* " Pos: '.'/'$', -set statusline+=\ %2*%c%2V%0* " Column # and tab detect -set statusline+=\ %5*@%0* " Colored @ for percent -set statusline+=\ %6*%P%0* " Percent thru file -set statusline+=\ File:\ %3*%<%-f%0* " File: Path left trim and align -set statusline+=%4*%(\ (%M%R%H)%)%0* " File editing mode (+/-,RO,HLP) -set statusline+=%= " Divider between left & right align -set statusline+=\ %9*X=%02B " Current char byte val in hex +set statusline= " reset the status line, for ADAM's colorful status line +set statusline+=%1*[%02.05n]%0* " max/min for buf #, in [] +set statusline+=Pos:\ %4*%3l/%3L%0* " Pos: '.'/'$', +set statusline+=\ %2*%c%2V%0* " Column # and tab detect +set statusline+=\ %5*@%0* " Colored @ for percent +set statusline+=\ %6*%P%0* " Percent thru file +set statusline+=\ File:\ %3*%<%-f%0* " File: Path left trim and align +set statusline+=%4*%(\ (%M%R%H)%)%0* " File editing mode (+/-,RO,HLP) + +set statusline+=%= " Divider between left & right align + +set statusline+=\ Syn:\ %2*%{SyntaxItem()}%0* " Setup syntax highlighting group display + +set statusline+=\ %9*X=%02B " Current char byte val in hex "Lastly put the time in classic Magenta, like my TCSH prompt: set statusline+=\ %8*%{GetYearGlyph()}-%{strftime('%m-%d\ %H:%M')} From 354fa0e33cff72acc0182867a24b4383defd48b4 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Thu, 21 Jun 2018 01:35:16 -0400 Subject: [PATCH 4/6] Migrate to a "cplusplus" filetype for C++ in vim. This "cplusplus" filetype permits the sourcing of `cpp.vim` and `doxygen.vim` as lower-level files from itself. This should permit `doxygen.vim` to source from `cpp.vim` and avoid endless recursion, when handling code-in-comments formatting. --- vim/after/syntax/cplusplus.vim | 15 +++++++++++++++ vim/after/syntax/cpp.vim | 7 ------- vim/filetype.vim | 35 ++++++++++++++++++++++++++++++++++ vim/vimrc.fileprefs | 2 +- 4 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 vim/after/syntax/cplusplus.vim create mode 100644 vim/filetype.vim diff --git a/vim/after/syntax/cplusplus.vim b/vim/after/syntax/cplusplus.vim new file mode 100644 index 0000000..b0109ae --- /dev/null +++ b/vim/after/syntax/cplusplus.vim @@ -0,0 +1,15 @@ + +" This enables Basic C++ support, with my extensions. +if version < 600 + so :p:h/cpp.vim +else + runtime! syntax/cpp.vim +endif + +" This enables doxygen simultaneous with C++. +if version < 600 + so :p:h/doxygen.vim +else + runtime! syntax/doxygen.vim +endif + diff --git a/vim/after/syntax/cpp.vim b/vim/after/syntax/cpp.vim index 6644ef3..d2b3c68 100644 --- a/vim/after/syntax/cpp.vim +++ b/vim/after/syntax/cpp.vim @@ -1,12 +1,5 @@ " ADAM C++ vim syntax after extensions -" This enables doxygen simultaneous with C++. -if version < 600 - so :p:h/doxygen.vim -else - runtime! syntax/doxygen.vim -endif - syn match cxxObjects "\<[A-Z][A-Za-z0-9_]*[a-z][A-Za-z0-9_]*\>" syn match cxxMetaFunction "\<[a-z][a-z0-9]*_[a-z0-9_]*[a-z0-9]\>" diff --git a/vim/filetype.vim b/vim/filetype.vim new file mode 100644 index 0000000..4161b1e --- /dev/null +++ b/vim/filetype.vim @@ -0,0 +1,35 @@ +" 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 +au BufNewFile,BufRead *.cpp + \ if exists("cynlib_syntax_for_cpp")|setf cynlib|else|setf cplusplus|endif + +" C++ +au BufNewFile,BufRead *.cxx,*.c++,*.hh,*.hxx,*.hpp,*.ipp,*.moc,*.tcc,*.inl setf cplusplus +if has("fname_case") + au BufNewFile,BufRead *.C,*.H setf cplusplus +endif + +function! CheckForADAM() + if match(getline(1, min([line("$"), 200])), '^@\(interface\|end\|class\)') > -1 + if exists("g:c_syntax_for_h") + setf objc + else + setf objcpp + endif + elseif exists("g:c_syntax_for_h") + setf c + elseif exists("g:ch_syntax_for_h") + setf ch + else + setf 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 + diff --git a/vim/vimrc.fileprefs b/vim/vimrc.fileprefs index 8eea182..c79a53b 100644 --- a/vim/vimrc.fileprefs +++ b/vim/vimrc.fileprefs @@ -5,7 +5,7 @@ au BufNewFile,BufRead *.tex map _ {!}fmt -p -s -w 70 au BufNewFile,BufRead *.tex set textwidth=78 au BufNewFile,BufRead *.java set tabstop=4 au BufNewFile,BufRead *.java set shiftwidth=4 -au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h setf cpp +"au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h setf cpp " Alephaish au BufNewFile,BufRead *.cpp,*.hpp,*.cc,*.h set sw=4 From 00585057898d1516db6e5ea76c92bee20e49a65d Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Fri, 22 Jun 2018 01:16:34 -0400 Subject: [PATCH 5/6] 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. --- vim/after/syntax/cplusplus.vim | 17 +++++++++++++++++ vim/after/syntax/doxygen.vim | 22 +++++++--------------- vim/filetype.vim | 14 +++++++------- 3 files changed, 31 insertions(+), 22 deletions(-) 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 From 3d32ed613fddec154ebe2d1986ca8830d2ec01d8 Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Mon, 2 Jul 2018 12:57:28 -0400 Subject: [PATCH 6/6] Update CPlusPlus and Doxygen formats to be better. Now the `'*'` characters in fixed-width blocks show up correctly, with respect to how I write code. (I think doxygen also swallows them anyhow, so the highlighting is more consistent with doxygen's parser.) Also on loading a file, everything looks better now. --- vim/after/syntax/cplusplus.vim | 14 +++++++------- vim/after/syntax/doxygen.vim | 13 ++++++++----- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/vim/after/syntax/cplusplus.vim b/vim/after/syntax/cplusplus.vim index e0aa757..68eb392 100644 --- a/vim/after/syntax/cplusplus.vim +++ b/vim/after/syntax/cplusplus.vim @@ -7,13 +7,13 @@ 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 +"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 diff --git a/vim/after/syntax/doxygen.vim b/vim/after/syntax/doxygen.vim index 7a22c1e..37fc54a 100644 --- a/vim/after/syntax/doxygen.vim +++ b/vim/after/syntax/doxygen.vim @@ -8,17 +8,19 @@ if exists("b:current_syntax") unlet b:current_syntax endif +syn match blueCommentStar "^[ ]*\*[ ]*" contained containedin=doxygenBriefLine,doxygenFixedWidth,@doxyNestedCxx + " Make all C++ code in a doxygen block look kinda like natural C++ "syn match doxygenSpecialMultilineDesc "`" -syn cluster doxyNestedCXX contains=@cxxInDoxygen,doxygenSpecialContinueComment,doxygenSpecialContinueCommentWhite +syn cluster doxyNestedCXX contains=@cxxInDoxygen,blueCommentStar +syn cluster doxyNeedsFixedWidth contains=doxygenBody,doxygenSpecialMultilineDesc,doxygenBriefLine,doxygenBrief -syn region doxygenFixedWidth containedin=doxygenBody matchgroup=Comment start=+^[ ]*\** *@code$+ skip=+^\n+ keepend end=+^[ ]*\** *@endcode$+ contains=@doxyNestedCXX +syn region doxygenFixedWidth containedin=@doxyNeedsFixedWidth matchgroup=Comment start=+@code+ skip=+^\n+ keepend end=+@endcode+ contains=@doxyNestedCXX -syn region doxygenFixedWidth containedin=doxygenBody matchgroup=Comment start=+^[ ]*\** *\~\~\~$+ skip=+^\n+ end=+^[ ]*\** *\~\~\~$+ contains=@doxyNestedCXX +syn region doxygenFixedWidth containedin=@doxyNeedsFixedWidth matchgroup=Comment start=+\~\~\~+ skip=+^\n+ end=+\~\~\~+ contains=@doxyNestedCXX - -syn region doxygenFixedWidth containedin=doxygenBody matchgroup=Comment start=+`+ end=+`+ keepend contains=@doxyNestedCXX +syn region doxygenFixedWidth containedin=@doxyNeedsFixedWidth matchgroup=Comment start=+`+ end=+`+ keepend contains=@doxyNestedCXX "syn match doxygenFixedWidth +`.\+`+ contained @@ -30,3 +32,4 @@ syn region doxygenFixedWidth containedin=doxygenBody matchgroup=Comment start=+` " +\(\<[npcbea]\>\|\\|\\>\|\#]\)\@!+ nextgroup=doxygenParam,doxygenRetval,doxygenBriefWord,doxygenBold,doxygenBOther,doxygenOther,doxygenOtherTODO,doxygenOtherWARN,doxygenOtherBUG,doxygenPage,doxygenGroupDefine,doxygenCodeRegion,doxygenVerbatimRegion,doxygenDotRegion hi link doxygenFixedWidth None +hi link blueCommentStar doxygenSpecialContinueComment