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

Re: Optional Range folding at startup

Expand Messages
  • Tim Chase
    ... Well, you can have at startup (not sure whether you d like this in a custom ftplugin, or just a hack in your vimrc, or what-not) a solution I use
    Message 1 of 2 , Aug 2, 2004
    • 0 Attachment
      > I want to open a (vb.net) file with a special range (/^#Region/,/^#End
      > Region/) being folded.
      > If this range does not exist, I don't want to get an error message.

      Well, you can have at startup (not sure whether you'd like this
      in a custom ftplugin, or just a hack in your vimrc, or what-not)
      a solution I use regularly. However, it has to meet a couple
      small requirements:

      1) your "#region ... #end region" can't be nested, so the
      following wouldn't work

      #start1
      #start2
      #end
      #end

      2) if you have a #start, you have to have an #end. It works if
      you don't have *both*, but if you have the start, it should be
      closed, or otherwise funky stuff happens.

      So the solution I use regularly:

      :g/^#Region/.,/^#End Region/fold

      If there are no starting regions, the search for the end of the
      fold will never get requested, and thus prevent errors.

      Hope this helps,

      -tim
    Your message has been successfully submitted and would be delivered to recipients shortly.