Thursday, October 6, 2011

Re: How to conceal entire line including newline?

> Well, here's an example:
>
> # comment
> code
> # comment
> # second line
> code
> # comment
> code
>
> I want to have:
>
> code
> code
> code
>
> Folding cannot do that because it does not conceal, it only folds.
>

I never remove comments (or doc strings) when reviewing code, but I
occasionally have the same type problem with config files that come
with some programs (apache, squid, ELinks, etc.) where each coded
value has 10-15 lines of comments that serve as a kind of a
"program.conf" man page.

Some of these config files can run to thousands of lines with some 99%
being comments or sample values that are commented out.

Confusing.

So when I need a quick peek at the actual config all on one screen, I
simply do a:

:g/^#/d " or ..
:g/^"/d " or..
:g/^!/d
etc...

followed of course by an undo or quit w/o saving.

Never had a problem with this approach, but if you're worried, you
could open the file readonly or set the readonly option after deleting
the comments (all in one pass if you map a little function that
deletes all different different comment syntax forms and sets the
readonly option to an Fxx key - e.g.)

Obviously not a solution if you're also modifying the code; but then
you may want to see the comments & doc strings.. just to make sure
they still match the new code!

Sal

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

No comments:

Post a Comment