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

Re: Folds

Expand Messages
  • Tim Chase
    ... Does this one work for you? g/^ / * *//{$/norm $V%jzf which is roughly on every line matching /** at the beginning, search forward for the first { at
    Message 1 of 2 , Apr 2, 2012
    • 0 Attachment
      On 04/02/12 08:25, Tom wrote:
      > [code]
      > // Javascript
      > function MyClass() {
      > }
      >
      > /**
      > * Some API Docs
      > */
      > MyClass.prototype.someMethod = function() {
      > };
      >
      > ...
      > [/code]
      >
      > What I usually do here is create a manual fold for each API doc and
      > method. But this is a lot of manual work with e.g. "V$%jzf" to fold a
      > method. I'd like to do this automatically for the whole document with
      > one<leader> map. Is this possible?

      Does this one work for you?

      g/^\/\*\*//{$/norm $V%jzf


      which is roughly "on every line matching '/**' at the beginning,
      search forward for the first '{' at the end of a line. Then, in
      normal mode, do your incantation to go visual at the EOL, jump to
      the matching close-brace, go down one line, and then fold it"

      -tim


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