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

Re: fold on lines beginning with either = or #

Expand Messages
  • Rick Dooling
    ... Tim, Of course, I misspoke (mis-wrote). Yes, Vim folds away all lines that DO NOT begin with = and now, thanks to you, also folds away all lines that do
    Message 1 of 3 , Feb 23, 2013
    • 0 Attachment
      On Friday, February 22, 2013 7:19:06 PM UTC-6, Tim Chase wrote:
      > On 2013-02-22 15:14, Rick Dooling wrote:
      >
      > > Using Fountain (new markdown for screenwriters).
      >
      > >
      >
      > > I have Vim successfully folding on lines beginning with =
      >
      > >
      >
      > > using this
      >
      > >
      >
      > > setlocal foldexpr=getline(v:lnum)!~\"^=\"
      >
      > >
      >
      > > but I would like Vim to fold on BOTH = and # (hierarchy not
      >
      > > necessary)
      >
      >
      >
      > I'm not familiar with Fountain, but the "!~" is a "doesn't match
      >
      > this regexp" operator, so I'm surprised it's folding them
      >
      > away rather than folding away all lines that *don't* begin with an
      >
      > "=".
      >
      >
      >
      > You should be able to do
      >
      >
      >
      > setlocal foldexpr=getline(v:lnum)!~'^[=#]'
      >
      >
      >
      > to use a character-class. If they can begin after arbitrary
      >
      > whitespace, you could also do
      >
      >
      >
      > setlocal foldexpr=getline(v:lnum)!~'^\\s*[=#]'
      >
      >
      >
      > -tim

      Tim,

      Of course, I misspoke (mis-wrote). Yes, Vim folds away all lines that DO NOT begin with = and now, thanks to you, also folds away all lines that do not begin with #.

      Thank you. I could not see how to form a character class in the foldexpr help sections.

      This will be most helpful.

      Fountain is just a markup language for screenwriters, which enables us to use our favorite text editor to write screenplays, instead of buying some $200 stand-alone gui screenwriting program.

      http://fountain.io/

      Thank you again,

      Rick

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

      ---
      You received this message because you are subscribed to the Google Groups "vim_use" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    Your message has been successfully submitted and would be delivered to recipients shortly.