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

how to fold across file

Expand Messages
  • vicky b
    Hi all, I have all the java sdk 1.6 source files ,now I want to close all the folds in a file and if possible all java source files any suggestions?. --
    Message 1 of 8 , Apr 27, 2011
    • 0 Attachment

      Hi all,

        I have all the java sdk 1.6 source files ,now I want to close all the folds in a file and if possible all java source files any suggestions?.
      --
      Thanks & Regards
       Vickyb



      --
      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
    • Jostein Berntsen
      ... Something like this should work if you have all the files open in a ... Jostein -- You received this message from the vim_use maillist. Do not top-post!
      Message 2 of 8 , Apr 27, 2011
      • 0 Attachment
        On 27.04.11,16:16, vicky b wrote:
        > Hi all,
        >
        > I have all the java sdk 1.6 source files ,now I want to close all the
        > folds in a file and if possible all java source files any
        > suggestions?.

        Something like this should work if you have all the files open in a
        buffer:

        :silent! bufdo if expand('%')=~"*.java"|set foldlevel=0|endif


        Jostein


        --
        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 Schmidt
        ... Usually files open with all folds closed by default, I think. What do you get if you do this?: set foldenable? foldlevel? foldlevelstart? Are you able to
        Message 3 of 8 , Apr 27, 2011
        • 0 Attachment
          > I have all the java sdk 1.6 source files ,now I want to close all the folds in
          > a file and if possible all java source files any suggestions?.

          Usually files open with all folds closed by default, I think. What do you get if
          you do this?:

          set foldenable? foldlevel? foldlevelstart?

          Are you able to close folds manually after you have opened a file?

          Ben.




          --
          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
        • vicky b
          Thanks all, I want to re-frame my question I have all java files now I want to create folds for the comments can anyone help me please. On Wed, Apr 27, 2011
          Message 4 of 8 , Apr 27, 2011
          • 0 Attachment
            Thanks all,
            I want to  re-frame my question I have all java files now I want to create folds for the comments can anyone help me please.

            On Wed, Apr 27, 2011 at 6:37 PM, Ben Schmidt <mail_ben_schmidt@...> wrote:
              I have all the java sdk 1.6 source files ,now I want to close all the folds in
            a file and if possible all java source files any suggestions?.

            Usually files open with all folds closed by default, I think. What do you get if you do this?:

              set foldenable? foldlevel? foldlevelstart?

            Are you able to close folds manually after you have opened a file?

            Ben.







            --
            Thanks & Regards
             Vickyb



            --
            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
          • Efraim Yawitz
            ... I m not sure about your specific problem, but from a quick look at a .java file in vim and a comparison of the java.vim and c.vim files in the syntax
            Message 5 of 8 , Apr 28, 2011
            • 0 Attachment


              On Thu, Apr 28, 2011 at 9:41 AM, vicky b <vickyb2084@...> wrote:
              Thanks all,
              I want to  re-frame my question I have all java files now I want to create folds for the comments can anyone help me please.



              I'm not sure about your specific problem, but from a quick look at a .java file in vim and a comparison of the java.vim and c.vim files in the syntax directory under $VIM, I see that the java syntax file doesn't create any syntax-based folds, unlike C, which has lines like

              syntax region    cBlock        start="{" end="}" transparent fold

              to create folds for blocks

              and another to create folds for comments.

              I suppose you are using foldmethod=indent if you are seeing any folds at all.

              I guess that all this was a decision by the authors of the java.vim file.

              Ephraim



              --
              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
            • Christian Brabandt
              ... What foldmethod are you using? regards, Christian -- You received this message from the vim_use maillist. Do not top-post! Type your reply below the text
              Message 6 of 8 , Apr 28, 2011
              • 0 Attachment
                On Thu, April 28, 2011 8:41 am, vicky b wrote:
                > Thanks all,
                > I want to re-frame my question I have all java files now I want to create
                > folds for the comments can anyone help me please.

                What foldmethod are you using?

                regards,
                Christian

                --
                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
              • vicky b
                What foldmethod are you using?: i am poor in folds I want fold all comments that have this pattern /** * * */ as an example on of the comments /** * The
                Message 7 of 8 , Apr 28, 2011
                • 0 Attachment
                  What foldmethod are you using?: i am poor in folds

                  I want fold all comments that have this pattern
                  /**
                  *
                  *
                  */

                  as an example on of the comments


                  /**
                   * The listener interface for receiving "interesting" mouse events
                   * (press, release, click, enter, and exit) on a component.
                   * (To track mouse moves and mouse drags, use the
                   * <code>MouseMotionListener</code>.)
                   * <P>
                   * The class that is interested in processing a mouse event
                   * either implements this interface (and all the methods it
                   * contains) or extends the abstract <code>MouseAdapter</code> class
                   * (overriding only the methods of interest).
                   * <P>
                   * The listener object created from that class is then registered with a
                   * component using the component's <code>addMouseListener</code>
                   * method. A mouse event is generated when the mouse is pressed, released
                   * clicked (pressed and released). A mouse event is also generated when
                   * the mouse cursor enters or leaves a component. When a mouse event
                   * occurs, the relevant method in the listener object is invoked, and
                   * the <code>MouseEvent</code> is passed to it.
                   *
                   * @author Carl Quinn
                   * @version 1.19, 04/13/06
                   *
                   * @see MouseAdapter
                   * @see MouseEvent
                   * @see <a href="http://java.sun.com/docs/books/tutorial/post1.0/ui/mouselistener.html">Tutorial: Writing a Mouse Listener</a>
                   *
                   * @since 1.1
                   *





                  On Thu, Apr 28, 2011 at 2:12 PM, Christian Brabandt <cblists@...> wrote:
                  On Thu, April 28, 2011 8:41 am, vicky b wrote:
                  > Thanks all,
                  > I want to  re-frame my question I have all java files now I want to create
                  > folds for the comments can anyone help me please.

                  What foldmethod are you using?

                  regards,
                  Christian

                  --
                  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



                  --
                  Thanks & Regards
                   Vickyb



                  --
                  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
                • Christian Brabandt
                  ... Please trim your quotes and don t top post. For an introduction about folding, you should read the help, e.g. ... Here is an suggestion for how to fold,
                  Message 8 of 8 , Apr 28, 2011
                  • 0 Attachment
                    On Thu, April 28, 2011 12:24 pm, vicky b wrote:
                    > What foldmethod are you using?: i am poor in folds

                    Please trim your quotes and don't top post.

                    For an introduction about folding, you should read the help, e.g.
                    :h folding
                    :h usr_28.txt

                    Here is an suggestion for how to fold, which should do what you want. I
                    only rarely do something with java code, so this may or may not provide
                    what you want:

                    :setl fdm=expr
                    :setl
                    foldexpr=getline(v:lnum)=~'/\\*\\*'?'a1':getline(v:lnum)=~'\\*/'?'s1':'='
                    :setl foldtext=getline(v:foldstart+1)

                    (each is a single line, in case the email messes the format up)
                    Enter those commands in a java file and see if this helps you.

                    If this suits you, create a file java.vim in ~/.vim/after/ftplugin/
                    (unix) or $HOME/vimfiles/after/ftplugin (Windows) directory (create
                    missing directories, if they don't exists yet) and put these statements
                    there. Be sure to include a

                    :filetype plugin indent on

                    statement inside ~/.vimrc file, so the newly created java.vim
                    file will be read whenever Vim edits a java file.

                    I am sure, there are better ways, to fold comments like what you want.
                    But this gives you a starter.

                    regards,
                    Christian

                    --
                    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.