Loading ...
Sorry, an error occurred while loading the content.

15270Re: [vimdev] Block code highlighting

Expand Messages
  • Dr. Charles E. Campbell
    Sep 6, 2000
    • 0 Attachment
      Thus saith =?iso-8859-1?Q?Thomas_K=F6hler?=:
      > Now, in order to get _full_ highlightning-pass-thru (so, those keywords

      Just on a completely pedantic note (hey, I did write
      engspchk.vim!), its "highlighting", not "highlightning".
      ^

      Actually, the current syntax highlighting code can handle block
      highlighting. Its just that one would need to specify a bunch of unique
      colornames that aren't in the Standard List.

      Here's something that works with C files; I've also enclosed an example
      C file for illustration. Just gvim the C file and :so block.vim .

      -- <block.vim> ------------------------------------------------------
      syn cluster cCurlyGroup contains=cConditional,cConstant,cLabel,cOperator,cRepeat,cStatement,cStorageClass,cStructure,cType,cBitField,cCharacter,cCommentError,cInclude,cNumbers,cParenError,cPreCondit,cSpaceError,cSpecialCharacter,cSpecialError,cUserCont,cBracket,cComment,cCommentL,cCppOut,cCppString,cDefine,cMulti,cParen,cPreCondit,cPreProc,cString
      syn region cCurly1 matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" contains=@cCurlyGroup,cCurly2
      syn region cCurly2 contained matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" contains=@cCurlyGroup,cCurly3
      syn region cCurly3 contained matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" contains=@cCurlyGroup,cCurly4
      syn region cCurly4 contained matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" contains=@cCurlyGroup,cCurly5
      syn region cCurly5 contained matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" contains=@cCurlyGroup,cCurly6
      syn region cCurly6 contained matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" contains=@cCurlyGroup,cCurly7
      syn region cCurly7 contained matchgroup=Delimiter start="{" matchgroup=Delimiter end="}" contains=@cCurlyGroup,cCurly1

      hi cCurly1 term=NONE cterm=NONE gui=NONE guibg=grey10
      hi cCurly2 term=NONE cterm=NONE gui=NONE guibg=grey20
      hi cCurly3 term=NONE cterm=NONE gui=NONE guibg=grey25
      hi cCurly4 term=NONE cterm=NONE gui=NONE guibg=grey30
      hi cCurly5 term=NONE cterm=NONE gui=NONE guibg=grey35
      hi cCurly6 term=NONE cterm=NONE gui=NONE guibg=grey40
      hi cCurly7 term=NONE cterm=NONE gui=NONE guibg=grey45
      ---------------------------------------------------------------------
      /* an exmaple of sorts */
      int main()
      {
      if(a) {
      s=1;
      if(b) {
      t= 2;
      if(c) {
      u= 3;
      if(d) {
      v= 4;
      if(e) {
      w= 5;
      if(f) {
      x= 6;
      if(g) {
      y= 7;
      if(h) {
      z= 8;
      }
      }
      }
      }
      }
      }
      }
      }
      }
      ---------------------------------------------------------------------

      Regards,
      C Campbell

      --
      Charles E Campbell, Jr, PhD _ __ __
      Goddard Space Flight Center / /_/\_\_/ /
      cec@... /_/ \/_//_/
      PGP public key: http://www.erols.com/astronaut/pgp.html/
    • Show all 11 messages in this topic