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

Folding

Expand Messages
  • Scott LaBounty
    Is there an easy way (i.e. without going to each method and folding it individually) to fold a Java file so that just the method headers are showing? For
    Message 1 of 24 , Sep 5, 2001
      Is there an easy way (i.e. without going to each method and folding it
      individually) to fold a Java file so that just the method headers are
      showing? For example given

      class X
      {
      public int a(int a1)
      {
      // stuff
      }

      public float b(float b1)
      {
      // More stuff
      }
      }

      show something like:

      class X
      {
      public int a(int a1)

      public float b(float b1)
      }


      Thanks

      Scott LaBounty
      Netaphor Software, Inc.
    • Pavel Tavoda
      If you use standard syntax it s easy. At first write sources like class X { public int a(int a1) { ..... } public int b(int b1) { ... } } some people dislike
      Message 2 of 24 , Sep 6, 2001
        If you use 'standard' syntax it's easy. At first write sources like
        class X {
        public int a(int a1) {
        .....
        }

        public int b(int b1) {
        ...
        }
        }

        some people dislike it but it's way how Sun propose it and it's
        part of java coding style standard (same as naming convention
        like 'don't use underscore', 'use camel naming', 'variables and
        functions start with small caps', 'class names start with big caps'.

        And I'm using this im .vimrc file:
        --------------------------------
        set foldmethod=syntax

        set foldcolumn=2
        set foldtext=v:folddashes.getline(v:foldstart)
        set fillchars=fold:\
        set foldlevel=1
        --------------------------------

        behind \ is space in definition of fillchars.
        This I include in java.vim (with version 6 possible via custom syntax):
        --------------------------------
        syn region myFold start="{" end="}" transparent fold
        --------------------------------

        If you continue with your type of indentation you have to use
        foldmethod=expr and write expression which will parse and
        recognise your indentation.

        Hope this help

        Pavel

        Scott LaBounty wrote:

        >Is there an easy way (i.e. without going to each method and folding it
        >individually) to fold a Java file so that just the method headers are
        >showing? For example given
        >
        >class X
        >{
        > public int a(int a1)
        > {
        > // stuff
        > }
        >
        > public float b(float b1)
        > {
        > // More stuff
        > }
        >}
        >
        >show something like:
        >
        >class X
        >{
        > public int a(int a1)
        >
        > public float b(float b1)
        >}
        >
        >
        >Thanks
        >
        >Scott LaBounty
        >Netaphor Software, Inc.
        >
      • Julien Myette
        Hi, I ve just installed Vim 6.0ax, and I m experimenting with folds. It s really cool. However, from what I understand, we can use only one fold method at a
        Message 3 of 24 , Sep 21, 2001
          Hi,

          I've just installed Vim 6.0ax, and I'm experimenting with folds. It's really
          cool. However, from what I understand, we can use only one fold method at a
          time. As stated in the reference manual: "When setting 'foldmethod' to a
          value other than "manual", all folds are deleted and new ones created.
          Switching to the "manual" method doesn't remove the existing folds."

          What I would like to do is using syntax folds in C source file, and also
          marker folds for the function descriptions, which are surrounded by the
          following line.

          //==SDOC====================================================================
          =
          ...
          //==EDOC====================================================================
          =

          Is there a way to do that?

          Thanks,
          Julien Myette
        • Doug Kearns
          ... Why not just make this a syntax group ? Regards, Doug
          Message 4 of 24 , Sep 22, 2001
            On Fri, Sep 21, 2001 at 02:42:15PM -0400, Julien Myette wrote:
            > Hi,
            >
            > I've just installed Vim 6.0ax, and I'm experimenting with folds. It's really
            > cool. However, from what I understand, we can use only one fold method at a
            > time. As stated in the reference manual: "When setting 'foldmethod' to a
            > value other than "manual", all folds are deleted and new ones created.
            > Switching to the "manual" method doesn't remove the existing folds."
            >
            > What I would like to do is using syntax folds in C source file, and also
            > marker folds for the function descriptions, which are surrounded by the
            > following line.
            >
            > //==SDOC====================================================================
            > =
            > ...
            > //==EDOC====================================================================
            > =
            >
            > Is there a way to do that?

            Why not just make this a syntax group ?

            Regards,
            Doug
          • Julien Myette
            Well, that s what I ll do! Thanks for the hint!
            Message 5 of 24 , Sep 22, 2001
              Well, that's what I'll do! Thanks for the hint!


              Doug Kearns wrote:
              >
              > On Fri, Sep 21, 2001 at 02:42:15PM -0400, Julien Myette wrote:
              > > Hi,
              > >
              > > I've just installed Vim 6.0ax, and I'm experimenting with folds. It's really
              > > cool. However, from what I understand, we can use only one fold method at a
              > > time. As stated in the reference manual: "When setting 'foldmethod' to a
              > > value other than "manual", all folds are deleted and new ones created.
              > > Switching to the "manual" method doesn't remove the existing folds."
              > >
              > > What I would like to do is using syntax folds in C source file, and also
              > > marker folds for the function descriptions, which are surrounded by the
              > > following line.
              > >
              > > //==SDOC====================================================================
              > > =
              > > ...
              > > //==EDOC====================================================================
              > > =
              > >
              > > Is there a way to do that?
              >
              > Why not just make this a syntax group ?
              >
              > Regards,
              > Doug
            • Julien Myette
              OK, so I tried it and it almost works, but not exactly. I added the lines syn region cFctDesc start= ^//==SDOC=* end= $ contains=cComment syn match cFctDesc
              Message 6 of 24 , Sep 24, 2001
                OK, so I tried it and it almost works, but not exactly. I added the lines

                syn region cFctDesc start="^//==SDOC=*" end="$"
                contains=cComment
                syn match cFctDesc display "^//==EDOC=*"

                in syntax/c.vim and

                auto BufNewFile,BufRead *.c,*.h,*.cpp syn region myFold start="//==SDOC=*"
                end="//==EDOC=*" transparent fold

                in my .vimrc

                This doesn't work as I expect. But if that wasn't of the '//' at the
                beginning of the patterns, then it would work fine. I suppose it has
                something do to with the fact that my patterns begin by the comment
                characters.

                Anybody has an idea what I could do to overcome that?

                Thanks,
                Julien


                > -----Original Message-----
                > From: Julien Myette [mailto:jmyette@...]
                > Sent: Saturday, September 22, 2001 16:18
                > To: Doug Kearns
                > Cc: vim@...
                > Subject: Re: Folding
                >
                >
                > Well, that's what I'll do! Thanks for the hint!
                >
                >
                > Doug Kearns wrote:
                > >
                > > On Fri, Sep 21, 2001 at 02:42:15PM -0400, Julien Myette wrote:
                > > > Hi,
                > > >
                > > > I've just installed Vim 6.0ax, and I'm experimenting with
                > folds. It's really
                > > > cool. However, from what I understand, we can use only
                > one fold method at a
                > > > time. As stated in the reference manual: "When setting
                > 'foldmethod' to a
                > > > value other than "manual", all folds are deleted and new
                > ones created.
                > > > Switching to the "manual" method doesn't remove the
                > existing folds."
                > > >
                > > > What I would like to do is using syntax folds in C source
                > file, and also
                > > > marker folds for the function descriptions, which are
                > surrounded by the
                > > > following line.
                > > >
                > > >
                > //==SDOC======================================================
                > ==============
                > > > =
                > > > ...
                > > >
                > //==EDOC======================================================
                > ==============
                > > > =
                > > >
                > > > Is there a way to do that?
                > >
                > > Why not just make this a syntax group ?
                > >
                > > Regards,
                > > Doug
                >
              • Doug Kearns
                ... Try starting with something like this(untested): syntax region cFctDesc start= //==SDOC== + s*$ end= //==EDOC== + s*$ fold contains=cComment hi
                Message 7 of 24 , Sep 25, 2001
                  On Mon, Sep 24, 2001 at 01:56:46PM -0400, Julien Myette wrote:
                  > OK, so I tried it and it almost works, but not exactly. I added the lines
                  >
                  > syn region cFctDesc start="^//==SDOC=*" end="$"
                  > contains=cComment
                  > syn match cFctDesc display "^//==EDOC=*"

                  <snip>

                  Try starting with something like this(untested):

                  syntax region cFctDesc start="//==SDOC==\+\s*$" end="//==EDOC==\+\s*$" fold contains=cComment
                  hi link cFctDesc PreProc

                  and add it to ~/.vim/after/syntax/c.vim

                  Regards,
                  Doug
                • Julien Myette
                  Thank you very much Doug, this is doing exactly what I want!
                  Message 8 of 24 , Sep 25, 2001
                    Thank you very much Doug, this is doing exactly what I want!


                    > -----Original Message-----
                    > From: Doug Kearns [mailto:djkea2@...]
                    > Sent: Tuesday, September 25, 2001 6:45
                    > To: vim@...
                    > Subject: Re: Folding
                    >
                    >
                    > On Mon, Sep 24, 2001 at 01:56:46PM -0400, Julien Myette wrote:
                    > > OK, so I tried it and it almost works, but not exactly. I
                    > added the lines
                    > >
                    > > syn region cFctDesc start="^//==SDOC=*" end="$"
                    > > contains=cComment
                    > > syn match cFctDesc display "^//==EDOC=*"
                    >
                    > <snip>
                    >
                    > Try starting with something like this(untested):
                    >
                    > syntax region cFctDesc start="//==SDOC==\+\s*$"
                    > end="//==EDOC==\+\s*$" fold contains=cComment
                    > hi link cFctDesc PreProc
                    >
                    > and add it to ~/.vim/after/syntax/c.vim
                    >
                    > Regards,
                    > Doug
                    >
                  • Eric Weir
                    I m a Vim novice, and a writer not a programmer. I ve perused the responses to questions about folding in the Vim FAQ. It s largely Greek to me. I have a
                    Message 9 of 24 , Jun 1, 2011
                      I'm a Vim novice, and a writer not a programmer. I've perused the responses to questions about folding in the Vim FAQ. It's largely Greek to me. I have a couple questions: I understand folds can be indented. Is it possible to get Vim to wrap words to the indent column? Is there a way I can get folds to persist across a save and reload?

                      Thanks,
                      ------------------------------------------------------------------------------------------
                      Eric Weir
                      Decatur, GA USA
                      eeweir@...




                      --
                      You received this message from the "vim_use" maillist.
                      Do not top-post! Type your reply below the text you are replying to.
                      For more information, visit http://www.vim.org/maillist.php
                    • Ben Fritz
                      ... How do you mean? You can fold based on existing indent, which will fold all lines having the same indent into a single displayed line, where line means a
                      Message 10 of 24 , Jun 1, 2011
                        On Jun 1, 8:37 am, Eric Weir <eew...@...> wrote:
                        > I'm a Vim novice, and a writer not a programmer. I've perused the responses to questions about folding in the Vim FAQ. It's largely Greek to me. I have a couple questions:

                        > I understand folds can be indented.

                        How do you mean? You can fold based on existing indent, which will
                        fold all lines having the same indent into a single displayed line,
                        where "line" means a newline-terminated string.

                        Or, if you have a fold, you can use the >> operator to increase the
                        indent of everything inside the fold.

                        Or perhaps you mean something different.

                        > Is it possible to get Vim to wrap words to the indent column?

                        Word wrapping and folding are two completely unrelated topics.

                        Again, what do you mean by wrapping? Usually this means you have a
                        single long line which Vim displays on many lines by "wrapping" the
                        text which goes past the edge of the window. This is accomplished by
                        setting the 'wrap' option and probably 'linebreak' as well so that Vim
                        only wraps at word boundaries.

                        Unfortunately, using this wrap method, there is no way to
                        automatically start the next displayed line at the appropriate indent
                        level unless you modify the Vim executable. Since you say you're not a
                        programmer, this is probably an intimidating task.

                        There are a couple of partial solutions. The first would be to use the
                        'showbreak' option, which will add text to be displayed at the
                        beginning of each wrapped line. This text can be simply a number of
                        spaces, in effect creating an indent for wrapped lines. However,
                        'showbreak' affects every line in the same way, regardless of indent.

                        The next option would be to not use this "soft wrap" feature, but
                        instead us a "hard wrap" and insert real line breaks to wrap your
                        text. If you set 'formatoptions' to contain the 't' and 'a' flags, and
                        set 'textwidth' appropriately, Vim will automatically reformat each
                        paragraph as you type it so you don't need to worry about keeping this
                        up-to-date.

                        > Is there a way I can get folds to persist across a save and reload?
                        >

                        I understand the :mkview command will save manual folds, which
                        the :loadview command will restore. There is probably a plugin to do
                        this for you automatically.

                        If you fold using another method (e.g. indent, as mentioned above)
                        then you can either set up a command in your .vimrc to automatically
                        set this fold method for certain file types or file names. For
                        example,

                        autocmd BufRead *.txt set foldmethod=indent

                        Or, you could include a line such as the following at either the top
                        or bottom of every file you wish to do this for:

                        vim: foldmethod=indent

                        This is called a "modeline". By default, Vim scans the first and last
                        few lines in a file for lines in this format, and uses them to set
                        options on a per-file basis, overriding your built-in defaults
                        and .vimrc settings. Many *nix systems disable these globally, but you
                        could re-enable them in your .vimrc if you have this problem.

                        --
                        You received this message from the "vim_use" maillist.
                        Do not top-post! Type your reply below the text you are replying to.
                        For more information, visit http://www.vim.org/maillist.php
                      • Eric Weir
                        ... I meant both. I see that neither accomplishes what I wanted, i.e., for the folded indent to display as indented. As it is, it appears to me that the only
                        Message 11 of 24 , Jun 2, 2011
                          On Jun 1, 2011, at 10:53 AM, Ben Fritz wrote:

                          > On Jun 1, 8:37 am, Eric Weir <eew...@...> wrote:
                          >
                          >> I understand folds can be indented.
                          >
                          > How do you mean? You can fold based on existing indent, which will
                          > fold all lines having the same indent into a single displayed line,
                          > where "line" means a newline-terminated string.
                          >
                          > Or, if you have a fold, you can use the >> operator to increase the
                          > indent of everything inside the fold.

                          I meant both. I see that neither accomplishes what I wanted, i.e., for the folded indent to display as indented. As it is, it appears to me that the only way to know a fold is indented is to undent it.

                          But having tried that I see that that would not have accomplished what I wanted anyway, i.e., for all text with a certain range of a given line to "disappear under" that line. But I see that there is a way that can be done, by folding the other lines first, then folding on the first line and the lines that have already been folded.

                          I just wish I could get rid of the prefix that indicates how many lines there are in the fold. No doubt that is useful to some. To me it is clutter. It just gets in the way. The text of the top level line is sufficient to identify what's in the fold as far as I'm concerned.

                          >> Is it possible to get Vim to wrap words to the indent column?
                          >
                          > Again, what do you mean by wrapping? Usually this means you have a
                          > single long line which Vim displays on many lines by "wrapping" the
                          > text which goes past the edge of the window. This is accomplished by
                          > setting the 'wrap' option and probably 'linebreak' as well so that Vim
                          > only wraps at word boundaries.

                          I've done that. The options you suggest either don't do what I want, i.e., to display all and screen lines of an indented text, and only those lines as indented; or do things I don't want, e.g., insert hard returns into the text.

                          That said, I've come to the conclusion that I don't need to do what I wanted to do, that the method of "folding on folds" will accomplish most of what I wanted.

                          >> Is there a way I can get folds to persist across a save and reload?
                          >
                          > I understand the :mkview command will save manual folds, which
                          > the :loadview command will restore. There is probably a plugin to do
                          > this for you automatically.

                          Sounds like that would do the job. Especially if I could do it on a per file basis, i.e., without specifying filetypes to which it applies or having it apply globally.

                          I'll read up on the command, and will probably have more questions after that.

                          Thanks for the informative response to my noobie questions.

                          ------------------------------------------------------------------------------------------
                          Eric Weir
                          Decatur, GA USA
                          eeweir@...




                          --
                          You received this message from the "vim_use" maillist.
                          Do not top-post! Type your reply below the text you are replying to.
                          For more information, visit http://www.vim.org/maillist.php
                        • Gary Johnson
                          ... I don t like all that clutter in the fold line, either, but I do like to see the number of lines in the fold, so I modified the appearance of the fold line
                          Message 12 of 24 , Jun 2, 2011
                            On 2011-06-02, Eric Weir wrote:

                            > I just wish I could get rid of the prefix that indicates how many
                            > lines there are in the fold. No doubt that is useful to some. To
                            > me it is clutter. It just gets in the way. The text of the top
                            > level line is sufficient to identify what's in the fold as far as
                            > I'm concerned.

                            I don't like all that clutter in the fold line, either, but I do
                            like to see the number of lines in the fold, so I modified the
                            appearance of the fold line with this in my ~/.vimrc.

                            set foldtext=MyFoldText()

                            " MyFoldText()
                            "
                            " This is intended to be the same as the default foldtext()
                            " function, but without the text of the first line of the fold.
                            " See f_foldtext() in eval.c to see how the string is built.
                            "
                            function! MyFoldText()
                            let n = v:foldend - v:foldstart + 1
                            let i = indent(v:foldstart)
                            let istr = ''
                            while i > 0
                            let istr = istr . ' '
                            let i = i - 1
                            endwhile
                            return istr . "+-" . v:folddashes . " " . n . " lines "
                            endfunction

                            You could do something similar to get the appearance you want. I
                            wrote it before the repeat() function was available, so it could
                            probably be rewritten with five fewer lines today. See

                            :help fold-foldtext

                            Regards,
                            Gary

                            --
                            You received this message from the "vim_use" maillist.
                            Do not top-post! Type your reply below the text you are replying to.
                            For more information, visit http://www.vim.org/maillist.php
                          • Ben Fritz
                            ... Ah, so you want to modify what is displayed in place of the folded text. This is certainly possible, using the foldtext option. If you can specify
                            Message 13 of 24 , Jun 2, 2011
                              On Jun 2, 8:47 am, Eric Weir <eew...@...> wrote:
                              >
                              > I meant both. I see that neither accomplishes what I wanted, i.e., for the folded indent to display as indented. As it is, it appears to me that the only way to know a fold is indented is to undent it.
                              >
                              > [Snip]
                              >
                              > I just wish I could get rid of the prefix that indicates how many lines there are in the fold. No doubt that is useful to some. To me it is clutter. It just gets in the way. The text of the top level line is sufficient to identify what's in the fold as far as I'm concerned.  
                              >

                              Ah, so you want to modify what is displayed in place of the folded
                              text. This is certainly possible, using the 'foldtext' option.

                              If you can specify exactly what you want folded text to look like,
                              someone can help you make one. Or you can try your hand yourself.
                              There are a couple of examples at :help fold-foldtext and also
                              http://vim.wikia.com/wiki/Folding_for_plain_text_files_based_on_indentation
                              and http://vim.wikia.com/wiki/Customize_text_for_closed_folds. The
                              first link above may be very close to what you are looking for by
                              itself.

                              The caveat to remember in terms of indenting folded lines is that a
                              tab character in the fold text is replaced with a single space, so
                              you'll need to do something like this to replace it:

                              linetext = substitute(getline(v:foldstart),'^\s\+','\=repeat("
                              ",strdisplaywidth(submatch(0)))', '')

                              This replaces a sequence of whitespace at the beginning of the line ('^
                              \s\+') with a sequence of space characters ( repeat(" " ) of length
                              equal to the width of the whitespace sequence as displayed in Vim
                              ( strdisplaywidth(submatch(0)) ).

                              --
                              You received this message from the "vim_use" maillist.
                              Do not top-post! Type your reply below the text you are replying to.
                              For more information, visit http://www.vim.org/maillist.php
                            • sc
                              ... i bet this was written before we had the repeat() function sc -- You received this message from the vim_use maillist. Do not top-post! Type your reply
                              Message 14 of 24 , Jun 2, 2011
                                On Thursday, June 02, 2011 09:36:07 Gary Johnson wrote:

                                > while i > 0
                                > let istr = istr . ' '
                                > let i = i - 1
                                > endwhile

                                i bet this was written before we had the repeat() function

                                sc

                                --
                                You received this message from the "vim_use" maillist.
                                Do not top-post! Type your reply below the text you are replying to.
                                For more information, visit http://www.vim.org/maillist.php
                              • Gary Johnson
                                ... Yeah. That s why a little farther down the page I also wrote: You could do something similar to get the appearance you want. I wrote it before the
                                Message 15 of 24 , Jun 2, 2011
                                  On 2011-06-02, sc wrote:
                                  > On Thursday, June 02, 2011 09:36:07 Gary Johnson wrote:
                                  >
                                  > > while i > 0
                                  > > let istr = istr . ' '
                                  > > let i = i - 1
                                  > > endwhile
                                  >
                                  > i bet this was written before we had the repeat() function

                                  Yeah. That's why a little farther down the page I also wrote:

                                  You could do something similar to get the appearance you want. I
                                  wrote it before the repeat() function was available, so it could
                                  probably be rewritten with five fewer lines today.

                                  Regards,
                                  Gary

                                  --
                                  You received this message from the "vim_use" maillist.
                                  Do not top-post! Type your reply below the text you are replying to.
                                  For more information, visit http://www.vim.org/maillist.php
                                • Eric Weir
                                  ... Thanks, Gary. As I mentioned in my original post on this thread, I m not a programmer. I think I understand what this does, but from your description, not
                                  Message 16 of 24 , Jun 3, 2011
                                    On Jun 2, 2011, at 10:36 AM, Gary Johnson wrote:

                                    > I don't like all that clutter in the fold line, either, but I do
                                    > like to see the number of lines in the fold, so I modified the
                                    > appearance of the fold line with this in my ~/.vimrc.
                                    >
                                    > set foldtext=MyFoldText()
                                    >
                                    > " MyFoldText()
                                    > "
                                    > " This is intended to be the same as the default foldtext()
                                    > " function, but without the text of the first line of the fold.
                                    > " See f_foldtext() in eval.c to see how the string is built.
                                    > "
                                    > function! MyFoldText()
                                    > let n = v:foldend - v:foldstart + 1
                                    > let i = indent(v:foldstart)
                                    > let istr = ''
                                    > while i > 0
                                    > let istr = istr . ' '
                                    > let i = i - 1
                                    > endwhile
                                    > return istr . "+-" . v:folddashes . " " . n . " lines "
                                    > endfunction
                                    >
                                    > You could do something similar to get the appearance you want. I
                                    > wrote it before the repeat() function was available, so it could
                                    > probably be rewritten with five fewer lines today.

                                    Thanks, Gary. As I mentioned in my original post on this thread, I'm not a programmer. I think I understand what this does, but from your description, not the code. As I understand it eliminates all text except the number of lines. I want to eliminate the number of lines and keep the text from the first line of the fold. And I have absolutely no idea how to go about revising the code to make it do what I want.

                                    Thanks again nevertheless.

                                    Sincerely,
                                    ------------------------------------------------------------------------------------------
                                    Eric Weir
                                    Decatur, GA USA
                                    eeweir@...




                                    --
                                    You received this message from the "vim_use" maillist.
                                    Do not top-post! Type your reply below the text you are replying to.
                                    For more information, visit http://www.vim.org/maillist.php
                                  • Eric Weir
                                    ... Thanks, Ben. What I would like is that the line displayed by the fold be simply the first screen line of text of the fold. I took a look at the suggestions
                                    Message 17 of 24 , Jun 3, 2011
                                      On Jun 2, 2011, at 11:02 AM, Ben Fritz wrote:

                                      > Ah, so you want to modify what is displayed in place of the folded
                                      > text. This is certainly possible, using the 'foldtext' option.
                                      >
                                      > If you can specify exactly what you want folded text to look like,
                                      > someone can help you make one. Or you can try your hand yourself.
                                      > There are a couple of examples at :help fold-foldtext and also
                                      > http://vim.wikia.com/wiki/Folding_for_plain_text_files_based_on_indentation
                                      > and http://vim.wikia.com/wiki/Customize_text_for_closed_folds. The
                                      > first link above may be very close to what you are looking for by
                                      > itself.

                                      Thanks, Ben. What I would like is that the line displayed by the fold be simply the first screen line of text of the fold.

                                      I took a look at the suggestions at the links above. While they address folding generally, rather what's displayed by the fold, I found the first especially interesting. I really am not a programmer, however, and at this point at least, couldn't begin trying to implement what's described there.

                                      A link provided at the first link http://jfi.uchicago.edu/~tten/for%20geeks/Vim_editor/ provides an alternative based on "reverse indenting" -- I don't understand the rationale for employing "reverse indenting" -- that comes as close as I've seen to what I want, including hierarchical outlining without a plugin or special coding of files, and an uncluttered fold display. Just the first line of the folded text is displayed. Again, however, as close as it seems to what I want, I am again definitely not in a position to take on implementing it at this time.

                                      Something somewhere in the reading to which I was led by your response led me to this really good overview of folding on Vim Tips that I think I need to study. http://vim.wikia.com/wiki/Folding#Indent_folding One option discussed there is one that provides for folding based on indents and manual folding that looks similar to a suggestion to which I was led by a response on mac_vim that provides for retention of folds across a save and reload. It' very simple, but for some reason is not working for me exactly as described. [I'm getting error messages and recently saved folds are opening with fewer lines folded than were saved.]

                                      I know I'm being vague. I'm getting clearer as I pursue the suggestions I'm getting, at least about what I want. Definitely not very clear yet how to get it. But I am not a programmer. This is not something I need to do. It's something I want to do. I accept that it's going to take time, and that a fair bit of learning will be involved.

                                      Thanks again,
                                      ------------------------------------------------------------------------------------------
                                      Eric Weir
                                      Decatur, GA USA
                                      eeweir@...




                                      --
                                      You received this message from the "vim_use" maillist.
                                      Do not top-post! Type your reply below the text you are replying to.
                                      For more information, visit http://www.vim.org/maillist.php
                                    • Gary Johnson
                                      ... The example at the top of :help fold-foldtext does that. (The line beginning :set foldtext=v:folddashes... ) Try that and see if it does what you
                                      Message 18 of 24 , Jun 4, 2011
                                        On 2011-06-03, Eric Weir wrote:
                                        > On Jun 2, 2011, at 10:36 AM, Gary Johnson wrote:
                                        >
                                        > > I don't like all that clutter in the fold line, either, but I do
                                        > > like to see the number of lines in the fold, so I modified the
                                        > > appearance of the fold line with this in my ~/.vimrc.
                                        > >
                                        > > set foldtext=MyFoldText()
                                        > >
                                        > > " MyFoldText()
                                        ...
                                        > > You could do something similar to get the appearance you want. I
                                        > > wrote it before the repeat() function was available, so it could
                                        > > probably be rewritten with five fewer lines today.
                                        >
                                        > Thanks, Gary. As I mentioned in my original post on this thread,
                                        > I'm not a programmer. I think I understand what this does, but
                                        > from your description, not the code. As I understand it eliminates
                                        > all text except the number of lines. I want to eliminate the
                                        > number of lines and keep the text from the first line of the fold.
                                        > And I have absolutely no idea how to go about revising the code to
                                        > make it do what I want.

                                        The example at the top of ":help fold-foldtext" does that. (The
                                        line beginning ":set foldtext=v:folddashes...") Try that and see if
                                        it does what you want.

                                        Regards,
                                        Gary

                                        --
                                        You received this message from the "vim_use" maillist.
                                        Do not top-post! Type your reply below the text you are replying to.
                                        For more information, visit http://www.vim.org/maillist.php
                                      • Eric Weir
                                        ... Thanks, Gary. Comes close. I still get a report of the number of lines in the fold. I just plunked the line as is from the help screen into my .vimrc, but
                                        Message 19 of 24 , Jun 4, 2011
                                          On Jun 4, 2011, at 3:27 AM, Gary Johnson wrote:

                                          >> On 2011-06-03, Eric Weir wrote:
                                          >>
                                          >> I want to eliminate the
                                          >> number of lines and keep the text from the first line of the fold.
                                          >> And I have absolutely no idea how to go about revising the code to
                                          >> make it do what I want.
                                          >
                                          > The example at the top of ":help fold-foldtext" does that. (The
                                          > line beginning ":set foldtext=v:folddashes...") Try that and see if
                                          > it does what you want.

                                          Thanks, Gary. Comes close. I still get a report of the number of lines in the fold.

                                          I just plunked the line as is from the help screen into my .vimrc, but I can't read it, and don't see how to modify it to get rid of the number of lines report.

                                          Is there a way to do that?

                                          ------------------------------------------------------------------------------------------
                                          Eric Weir
                                          Decatur, GA USA
                                          eeweir@...




                                          --
                                          You received this message from the "vim_use" maillist.
                                          Do not top-post! Type your reply below the text you are replying to.
                                          For more information, visit http://www.vim.org/maillist.php
                                        • Gary Johnson
                                          ... That line, ... does not include the number of lines in the fold, so either it is not being executed in your ~/.vimrc or the option is being set to some
                                          Message 20 of 24 , Jun 4, 2011
                                            On 2011-06-04, Eric Weir wrote:
                                            > On Jun 4, 2011, at 3:27 AM, Gary Johnson wrote:
                                            >
                                            > >> On 2011-06-03, Eric Weir wrote:
                                            > >>
                                            > >> I want to eliminate the
                                            > >> number of lines and keep the text from the first line of the fold.
                                            > >> And I have absolutely no idea how to go about revising the code to
                                            > >> make it do what I want.
                                            > >
                                            > > The example at the top of ":help fold-foldtext" does that. (The
                                            > > line beginning ":set foldtext=v:folddashes...") Try that and see if
                                            > > it does what you want.
                                            >
                                            > Thanks, Gary. Comes close. I still get a report of the number of
                                            > lines in the fold.
                                            >
                                            > I just plunked the line as is from the help screen into my .vimrc,
                                            > but I can't read it, and don't see how to modify it to get rid of
                                            > the number of lines report.
                                            >
                                            > Is there a way to do that?

                                            That line,

                                            :set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')

                                            does not include the number of lines in the fold, so either it is
                                            not being executed in your ~/.vimrc or the option is being set
                                            to some other value somewhere after your ~/.vimrc is read. Execute

                                            :verbose foldtext?

                                            and see what it reports. It will show you the current value of the
                                            'foldtext' option and where it was last set.

                                            Regards,
                                            Gary

                                            --
                                            You received this message from the "vim_use" maillist.
                                            Do not top-post! Type your reply below the text you are replying to.
                                            For more information, visit http://www.vim.org/maillist.php
                                          • Eric Weir
                                            ... It does seem to be being executed. What s displayed is definitely different. Minus the line number report -- which of course I can live with till I learn
                                            Message 21 of 24 , Jun 5, 2011
                                              On Jun 5, 2011, at 2:38 AM, Gary Johnson wrote:

                                              > That line,
                                              >
                                              > :set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')
                                              >
                                              > does not include the number of lines in the fold, so either it is
                                              > not being executed in your ~/.vimrc or the option is being set
                                              > to some other value somewhere after your ~/.vimrc is read.

                                              It does seem to be being executed. What's displayed is definitely different. Minus the line number report -- which of course I can live with till I learn how to get rid of it -- it's exactly what I want.

                                              > Execute
                                              >
                                              > :verbose foldtext?
                                              >
                                              > and see what it reports. It will show you the current value of the
                                              > 'foldtext' option and where it was last set.

                                              Weird. When I execute that command I get an error message: "W492: Not an editor command: verbose foldtext?" [I also tried it without the "?".]

                                              I've checked help on :verbose, but it didn't help me understand why I'm getting this message. .

                                              Thanks again,
                                              ------------------------------------------------------------------------------------------
                                              Eric Weir
                                              Decatur, GA USA
                                              eeweir@...




                                              --
                                              You received this message from the "vim_use" maillist.
                                              Do not top-post! Type your reply below the text you are replying to.
                                              For more information, visit http://www.vim.org/maillist.php
                                            • Tony Mechelynck
                                              ... You should have typed ... -- :foldtext? by itself is indeed not an editor command -- one word slipped off Gary s typing. ... HTH, Tony. -- An exotic
                                              Message 22 of 24 , Jun 5, 2011
                                                On 05/06/11 16:28, Eric Weir wrote:
                                                >
                                                > On Jun 5, 2011, at 2:38 AM, Gary Johnson wrote:
                                                >
                                                >> That line,
                                                >>
                                                >> :set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')
                                                >>
                                                >> does not include the number of lines in the fold, so either it is
                                                >> not being executed in your ~/.vimrc or the option is being set
                                                >> to some other value somewhere after your ~/.vimrc is read.
                                                >
                                                > It does seem to be being executed. What's displayed is definitely different. Minus the line number report -- which of course I can live with till I learn how to get rid of it -- it's exactly what I want.
                                                >
                                                >> Execute
                                                >>
                                                >> :verbose foldtext?
                                                >>
                                                >> and see what it reports. It will show you the current value of the
                                                >> 'foldtext' option and where it was last set.
                                                >
                                                > Weird. When I execute that command I get an error message: "W492: Not an editor command: verbose foldtext?" [I also tried it without the "?".]
                                                >
                                                > I've checked help on :verbose, but it didn't help me understand why I'm getting this message. .

                                                You should have typed

                                                :verbose set foldtext?

                                                -- :foldtext? by itself is indeed not an editor command -- one word
                                                slipped off Gary's typing.

                                                >
                                                > Thanks again,
                                                > ------------------------------------------------------------------------------------------
                                                > Eric Weir
                                                > Decatur, GA USA
                                                > eeweir@...
                                                >
                                                >
                                                >
                                                >

                                                HTH,
                                                Tony.
                                                --
                                                An exotic journey in downtown Newark is in your future.

                                                --
                                                You received this message from the "vim_use" maillist.
                                                Do not top-post! Type your reply below the text you are replying to.
                                                For more information, visit http://www.vim.org/maillist.php
                                              • Eric Weir
                                                ... Thanks, Tony. ... Eric Weir Decatur, GA USA eeweir@bellsouth.net -- You received this message from the vim_use maillist. Do not top-post! Type your
                                                Message 23 of 24 , Jun 5, 2011
                                                  On Jun 5, 2011, at 10:51 AM, Tony Mechelynck wrote:

                                                  > On 05/06/11 16:28, Eric Weir wrote:
                                                  >>
                                                  >>> On Jun 5, 2011, at 2:38 AM, Gary Johnson wrote:
                                                  >>>
                                                  >>> Execute
                                                  >>>
                                                  >>> :verbose foldtext?
                                                  >>>
                                                  >>> and see what it reports. It will show you the current value of the
                                                  >>> 'foldtext' option and where it was last set.
                                                  >>
                                                  >> Weird. When I execute that command I get an error message: "W492: Not an editor command: verbose foldtext?" [I also tried it without the "?".]
                                                  >>
                                                  >> I've checked help on :verbose, but it didn't help me understand why I'm getting this message. .
                                                  >
                                                  > You should have typed
                                                  >
                                                  > :verbose set foldtext?

                                                  Thanks, Tony.

                                                  ------------------------------------------------------------------------------------------
                                                  Eric Weir
                                                  Decatur, GA USA
                                                  eeweir@...




                                                  --
                                                  You received this message from the "vim_use" maillist.
                                                  Do not top-post! Type your reply below the text you are replying to.
                                                  For more information, visit http://www.vim.org/maillist.php
                                                • Eric Weir
                                                  ... The report was that the line I inserted was the only one setting foldtext:
                                                  Message 24 of 24 , Jun 5, 2011

                                                    On Jun 5, 2011, at 2:38 AM, Gary Johnson wrote:

                                                    That line,

                                                       :set foldtext=v:folddashes.substitute(getline(v:foldstart),'/\\*\\\|\\*/\\\|{{{\\d\\=','','g')

                                                    does not include the number of lines in the fold, so either it is
                                                    not being executed in your ~/.vimrc or the option is being set
                                                    to some other value somewhere after your ~/.vimrc is read.  Execute

                                                       :verbose foldtext?

                                                    and see what it reports.  It will show you the current value of the
                                                    'foldtext' option and where it was last set.

                                                    The report was that the line I inserted was the only one setting foldtext: 

                                                    foldtext=v:folddashes.substitute(getline(v:foldstart),'/\*\|\*/\|{{{\d\=','','g')
                                                            Last set from ~/.vimrc  

                                                    Is there something other than foldtext that would affect display of the number of lines?

                                                    Thanks,
                                                    ------------------------------------------------------------------------------------------
                                                    Eric Weir
                                                    Decatur, GA  USA
                                                    eeweir@...




                                                    --
                                                    You received this message from the "vim_use" maillist.
                                                    Do not top-post! Type your reply below the text you are replying to.
                                                    For more information, visit http://www.vim.org/maillist.php
                                                  Your message has been successfully submitted and would be delivered to recipients shortly.