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

Vim 7 Java syntax folding

Expand Messages
  • Halim, Salman
    Hello, I propose the following changes to syntax/java.vim to enable folding by syntax: syn region javaBraces start= { end= } transparent fold syn
    Message 1 of 1 , Feb 24, 2006
      Hello,

      I propose the following changes to syntax/java.vim to enable folding by
      syntax:

      syn region javaBraces start="{" end="}" transparent fold
      syn region javaDocComment start="/\*\*" end="\*/" keepend
      contains=javaCommentTitle,@javaHtml,javaDocTags,javaDocSeeTag,javaTodo,@
      Spell fold

      Basically, replace the current javaBraces:

      syn match javaBraces "[{}]"

      And add the word 'fold' to the javaDocComment.

      The c.vim version that already has commenting by syntax does contain
      variable checks that allow the comment-based folding variation to be
      turned off.

      Up till now, I was forcing this behaviour using a function (with
      fdm=expr), but this is so much easier.

      Right now, I have the following in my after/syntax/java.vim:

      syntax clear javaBraces
      syntax clear javaDocComment

      syn region javaBraces start="{" end="}" transparent fold
      syn region javaDocComment start="/\*\*" end="\*/" keepend
      contains=javaCommentTitle,@javaHtml,javaDocTags,javaDocSeeTag,javaTodo,@
      Spell fold

      This clears the default settings from the main syntax/java.vim and sets
      it up the fold-savvy way.

      Thanks very much!

      Regards,

      Salman.
    Your message has been successfully submitted and would be delivered to recipients shortly.