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

56254Re[2]: hiding comments

Expand Messages
  • Wind
    Feb 1, 2005
    • 0 Attachment
      Hello David,

      Tuesday, February 1, 2005, 6:19:42 PM, you wrote:

      DS> So I did not have any luck using this approach. In fact I could not
      DS> actually get that to work at all.

      DS> I tried to add it to my python_folds.vim file. I also tried
      DS> :syntax clear
      DS> :sy region myFold start="^#@" skip="^#@" end="^\(#@\)\@!" fold
      So if "#@" thing can stand few white spaces out of the line
      beginning substitute for "\s*#@" as you do in your solution I
      think it will work.
      :sy region myFold start="^\s*#@" skip="^\s*#@" end="^\s*\(#@\)\@!" fold transparent contains=ALLBUT,myFold
      DS> transparent contains=ALLBUT,myFold #all one line of course
      DS> :set foldmethod=syntax

      DS> The only partial solution I have is to just use:
      DS> :set foldmethod=expr
      DS> :set foldexpr=getline(v:lnum)=~'^\s*#@'

      DS> This folds away the particular comment lines I want to ignore, but of
      DS> course, now I do not have the rest of the Python folding.

      DS> Thanks for your help.

      DS> David S.


      DS> Wind wrote:
      >> Hello David,
      >> try this:
      >> :sy region myFold start="^#@" skip="^#@" end="^\(#@\)\@!" fold
      >> transparent contains=ALLBUT,myFold
      >>
      >> Let me know if I missed something: I have little knowledge about Python.
      >>
      >> Tuesday, February 1, 2005, 3:32:45 AM, you wrote:
      >>
      >> DS> I would like to cause comment blocks in Python code to be folded away
      >> DS> (or use some similar mechanism) independently of like indented,
      >> DS> non-comment lines.
      >>
      >> DS> In particular, I am using Vim with the outlining tool, Leo, which places
      >> DS> marker lines in Python code files that start with '#@'. I would like to
      >> DS> treat those blocks as deeply folded block since I never need to see it.
      >> DS> But I can't seem to get folding to think take care of those comment
      >> DS> lines and subsequently the rest of the Python file.
      >>
      >> DS> In this snippet, I would like to treat lines 1 and 2 as a single,
      >> DS> independent, block to be folded:
      >>
      >> DS> 1 #@mark some section
      >> DS> 2 #@<<vim plugin>>
      >> DS> 4 #I hope I can read this comment even
      >> DS> 5 #when the previous lines are folded
      >> DS> 5 def open_in_vim():
      >> DS> 6 open_best_editor('Vim')
      >>
      >> DS> Any direction is appreciated.
      >>
      >> DS> David S.
      >>
      >>
      >>



      --
      Best regards,
      Wind mailto:sonic_wind@...
    • Show all 6 messages in this topic