Wednesday, October 5, 2011

Re: How to conceal entire line including newline?

Hi vim_use!

On Mi, 05 Okt 2011, Christian Brabandt wrote:

> Hi AK!
>
> On Mi, 05 Okt 2011, AK wrote:
>
> > On 10/05/2011 03:36 PM, Christian Brabandt wrote:
> > >Hi AK!
> > >
> > >On Mi, 05 Okt 2011, AK wrote:
> > >
> > >>On 10/05/2011 02:41 PM, Christian Brabandt wrote:
> > >>>On Mi, 05 Okt 2011, AK wrote:
> > >>>>Hi, I want to have an overview of code without comments or
> > >>>>docstrings, with their lines completely omitted when in
> > >>>>conceal mode, without showing them as blank lines.
> > >>>>
> > >>>>How can I do that?
> > >>>
> > >>>You can't. Use folding to hide them away.
> > >>>
> > >>Wow, why is conceal so bizarrely hindered? Even before
> > >>conceal feature was created, I've often thought that it
> > >>would be extremely useful to temporarily conceal some
> > >>types of lines.
> > >
> > >Well you can hide away lines, but I think you won't be able to
> > >completely hide away the new line character. This makes sense, as for
> > >this folding can be used.
> >
> >
> > 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.
>
> Close enough:
> :setl foldenable foldmethod=expr foldminlines=0
> foldexpr=getline(v:lnum)=~'^#'?1:0 foldtext=v:folddashes foldlevel=0
> fillchars-=fold:-
>
> which makes it:
> -
> code
> -
> code
> -
> code

BTW: concealing the comments would look like this:
:syn match MyConceal /^#.*$/ conceal
:setl conceallevel=3

code


code

code

You can't make the lines disappear, since they are only not drawn, but
physically still there.

regards,
Christian

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