Wednesday, October 5, 2011

Re: How to conceal entire line including newline?

On 10/05/2011 04:11 PM, 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

Well, I already did use 'invisible' folds to do
similar type of hiding, but I was really excited
about conceal feature because I thought it would
be able to conceal lines.

The reason I want to get rid of those lines is that
you can read a lot more code in the same window
and it makes it much, much easier to do code review
without jumping back and forth.

So, it's really odd to me that conceal does not work
for lines. It seems like the most useful part of
conceal is handicapped by design.

Is it possible to make a small change to the vim
code to allow this? I would not mind compiling my
own version of Vim to allow this even though the
patch will need to be applied on every upgrade.

I don't have experience with C or editing Vim code
so it would be really helpful if someone told me
if it would be easy to add and where I should start.

I would be willing to spend a few hours on this,
but if it's going to be harder than that, I'll just
use folding and syntax highlight to make folds
invisible.

Thanks for your help, Christian.

-ak

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