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

vim: folding feature request

Expand Messages
  • David Bustos
    Shouldn t zO recursively open folds even in already-open folds? David
    Message 1 of 4 , Sep 5, 2002
    • 0 Attachment
      Shouldn't "zO" recursively open folds even in already-open folds?


      David
    • Benji Fisher
      ... I just tried, and it seems to. Maybe I do not understand what you mean. Please give an example of what happens and what you think should be different.
      Message 2 of 4 , Sep 5, 2002
      • 0 Attachment
        On Thursday, September 5, 2002, at 03:37 AM, David Bustos wrote:

        > Shouldn't "zO" recursively open folds even in already-open folds?

        I just tried, and it seems to. Maybe I do not understand what you
        mean. Please give an example of what happens and what you think should
        be different. If I keep typing, I can probably give you enough lines of
        text
        for
        your
        example.
        ;)

        HTH --Benji Fisher
      • David Bustos
        ... Suppose my file is line 1 line 2 line 3 line 4 and I create two folds (shown as though fdc=3): - line 1 ... With the cursor on line 1, I want zO to open
        Message 3 of 4 , Sep 5, 2002
        • 0 Attachment
          Quoth Benji Fisher on Thu, Sep 05, 2002 at 01:08:04PM -0400:
          > On Thursday, September 5, 2002, at 03:37 AM, David Bustos wrote:
          > >Shouldn't "zO" recursively open folds even in already-open folds?
          >
          > I just tried, and it seems to. Maybe I do not understand what you
          > mean. Please give an example of what happens and what you think should
          > be different. If I keep typing, I can probably give you enough lines of

          Suppose my file is

          line 1
          line 2
          line 3
          line 4

          and I create two folds (shown as though fdc=3):

          - line 1
          |+ +--- 2 lines: line 2------------------------------------------------
          | line 4

          With the cursor on line 1, I want "zO" to open the line 2 fold and any
          other folds that the line 1 fold contains. This would be useful when I
          open a fold, discover nested folds, and want to open them, too. Right
          now I have to reclose the fold so I can do zO, but I think this
          alteration would be useful and not in conflict with the documentation.

          I tracked this behavior to fold.c:setManualFold(), where the call to
          foldOpenNested(fp) is skipped over if the current fold is not FD_CLOSED,
          but I'm not sure how this should be changed to produce the behavior I
          desire.


          David
        • Benji Fisher
          ... The docs refer to folds under the cursor, which I read as a pretty good description of the current behavior. If you want the behavior you describe, I
          Message 4 of 4 , Sep 5, 2002
          • 0 Attachment
            David Bustos wrote:
            >
            > Quoth Benji Fisher on Thu, Sep 05, 2002 at 01:08:04PM -0400:
            > > On Thursday, September 5, 2002, at 03:37 AM, David Bustos wrote:
            > > >Shouldn't "zO" recursively open folds even in already-open folds?
            > >
            > > I just tried, and it seems to. Maybe I do not understand what you
            > > mean. Please give an example of what happens and what you think should
            > > be different. If I keep typing, I can probably give you enough lines of
            >
            > Suppose my file is
            >
            > line 1
            > line 2
            > line 3
            > line 4
            >
            > and I create two folds (shown as though fdc=3):
            >
            > - line 1
            > |+ +--- 2 lines: line 2------------------------------------------------
            > | line 4
            >
            > With the cursor on line 1, I want "zO" to open the line 2 fold and any
            > other folds that the line 1 fold contains. This would be useful when I
            > open a fold, discover nested folds, and want to open them, too. Right
            > now I have to reclose the fold so I can do zO, but I think this
            > alteration would be useful and not in conflict with the documentation.

            The docs refer to "folds under the cursor," which I read as a pretty good
            description of the current behavior. If you want the behavior you describe, I
            think a simple work-around is to add

            :nnoremap zO zCzO

            to your vimrc file.

            HTH --Benji Fisher
          Your message has been successfully submitted and would be delivered to recipients shortly.