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

Re: folding ruby comments

Expand Messages
  • Gary Johnson
    ... I just ran into this myself. Add another backslash in front of the s: set foldexpr=getline(v:lnum)=~ ^ s*# I don t know why. I suspect that the set
    Message 1 of 5 , Jan 1, 2012
    • 0 Attachment
      On 2012-01-01, josh wrote:
      > Here is another attempt:
      > set foldexpr=getline(v:lnum)=~'^\s*#'
      >
      > I want to fold lines that stat with # or lines that start with spaces
      > and #.
      > The problem is it's not working on the second case.
      > Here is an example. it will only fold line 1-2 and not lines 4-5:
      >
      > # this is a comment
      > # in ruby. # is the first char
      >
      > # this is also a comment.
      > # there are spaces before the #

      I just ran into this myself. Add another backslash in front of the
      s:

      set foldexpr=getline(v:lnum)=~'^\\s*#'

      I don't know why. I suspect that the set command removes one level
      of backslash-escaping, even between single-quotes.

      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
    • Taylor Hedberg
      ... It does. Another good reason to use `:let &option = ‥` instead of `:set option=‥` for any non-trivial option value.
      Message 2 of 5 , Jan 2, 2012
      • 0 Attachment
        Gary Johnson, Sun 2012-01-01 @ 18:57:12-0800:
        > I don't know why. I suspect that the set command removes one level of
        > backslash-escaping, even between single-quotes.

        It does. Another good reason to use `:let &option = ‥` instead of
        `:set option=‥` for any non-trivial option value.
      Your message has been successfully submitted and would be delivered to recipients shortly.