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

Problem with C/C++ syntax folding

Expand Messages
  • Jay Atkinson
    I seem to be having a problem with the default syntax folding in Vim 7.0. The syntax folding seems to get confused whenever there is a statement like this: a =
    Message 1 of 2 , Feb 28, 2007
    • 0 Attachment
      I seem to be having a problem with the default syntax folding in Vim 7.0.
      The syntax folding seems to get confused whenever there is a statement like
      this:

      a = (b == 0) ? 1 : 2;

      After a statement like that, the folding just collapses everything after
      that statement into one fold. It normally highlights all the following
      curly braces in red as well. Has anyone stumbled across this problem and
      come up with a fix?

      Thanks
      J
    • Bram Moolenaar
      ... It appears to work fine for me. Try this: vim -u NONE yourfile.c source $VIMRUNTIME/syntax/c.vim set foldmethod=syntax Does it still happen then? If not
      Message 2 of 2 , Mar 3 3:23 AM
      • 0 Attachment
        Jay Atkinson wrote:

        > I seem to be having a problem with the default syntax folding in Vim 7.0.
        > The syntax folding seems to get confused whenever there is a statement like
        > this:
        >
        > a = (b == 0) ? 1 : 2;
        >
        > After a statement like that, the folding just collapses everything after
        > that statement into one fold. It normally highlights all the following
        > curly braces in red as well. Has anyone stumbled across this problem and
        > come up with a fix?

        It appears to work fine for me.

        Try this:
        vim -u NONE yourfile.c
        source $VIMRUNTIME/syntax/c.vim
        set foldmethod=syntax

        Does it still happen then? If not then you have something added to the
        C syntax that causes the problem.

        --
        hundred-and-one symptoms of being an internet addict:
        241. You try to look for Net Search even when you're in File Manager.

        /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
        /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
        \\\ download, build and distribute -- http://www.A-A-P.org ///
        \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
      Your message has been successfully submitted and would be delivered to recipients shortly.