colorcolumn and foldtext

60 views
Skip to first unread message

Carlos Pita

unread,
Mar 5, 2015, 11:09:54 PM3/5/15
to vim...@googlegroups.com
Hi all,

is there any way to force the color column to show above a fold header?

I tried:

highlight Folded cterm=none ctermbg=none

and

highlight clear Folded

to no avail.

See the attached screenshot in case I'm not being clear.

Cheers
--
Carlos
2015-03-06-010917_708x247_scrot.png

Christian Brabandt

unread,
Mar 6, 2015, 12:58:02 AM3/6/15
to vim...@googlegroups.com
Hi Carlos!
I don't think there is a possibility. Vims highlighting priorities are
mostly hard coded in the source. So there is nothing you can do about.


Best,
Christian
--
Zur Ehe gehört nicht bloß, daß man das Mädchen, sondern auch, daß man
sich prüfe - ob nämlich 2 Vortreffliche dennoch sich einander nicht
fügen.
-- Jean Paul

Christian Brabandt

unread,
Mar 6, 2015, 4:47:28 PM3/6/15
to vim...@googlegroups.com, vim...@vim.org
Bram,

On Fr, 06 Mär 2015, Christian Brabandt wrote:
> On Do, 05 Mär 2015, Carlos Pita wrote:
>
> > Hi all,
> >
> > is there any way to force the color column to show above a fold header?
> >
> > I tried:
> >
> > highlight Folded cterm=none ctermbg=none
> >
> > and
> >
> > highlight clear Folded
> >
> > to no avail.
> >
> > See the attached screenshot in case I'm not being clear.
>
> I don't think there is a possibility. Vims highlighting priorities are
> mostly hard coded in the source. So there is nothing you can do about.

Here is a patch, that makes the colorcolumn drawn on top of folded
regions.


Best,
Christian
--
Letzte Worte eines Fahrradfahrers:
"Guck' mal, ich kann freihändig fahren."
colorcolumn_on_foldedregion.diff

Bram Moolenaar

unread,
Mar 6, 2015, 5:22:41 PM3/6/15
to Christian Brabandt, vim...@googlegroups.com, vim...@vim.org

Christian wrote:

> Bram,
>
> On Fr, 06 Mär 2015, Christian Brabandt wrote:
> > On Do, 05 Mär 2015, Carlos Pita wrote:
> >
> > > Hi all,
> > >
> > > is there any way to force the color column to show above a fold header?
> > >
> > > I tried:
> > >
> > > highlight Folded cterm=none ctermbg=none
> > >
> > > and
> > >
> > > highlight clear Folded
> > >
> > > to no avail.
> > >
> > > See the attached screenshot in case I'm not being clear.
> >
> > I don't think there is a possibility. Vims highlighting priorities are
> > mostly hard coded in the source. So there is nothing you can do about.
>
> Here is a patch, that makes the colorcolumn drawn on top of folded
> regions.

The idea of 'colorcolumn' is that it applies to the text. So you can
align items or make sure they are in a certain column. I don't see
how that is useful in a folded region. I would think it makes the
closed fold look odd. I have the idea that the closed fold is "above"
the text and the 'colorcolumn' is "under" the text.

So, why would someone want to change this?


--
Luxury. We used to have to get out of the lake at three o'clock in the
morning, clean the lake, eat a handful of hot gravel, go to work at the
mill every day for tuppence a month, come home, and Dad would beat us
around the head and neck with a broken bottle, if we were LUCKY!

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Carlos Pita

unread,
Mar 6, 2015, 5:41:45 PM3/6/15
to vim...@googlegroups.com, Christian Brabandt, vim...@vim.org
Hi Bram,

> The idea of 'colorcolumn' is that it applies to the text. So you can
> align items or make sure they are in a certain column. I don't see
> how that is useful in a folded region. I would think it makes the
> closed fold look odd. I have the idea that the closed fold is "above"
> the text and the 'colorcolumn' is "under" the text.
>
> So, why would someone want to change this?

I see the rationale behind what you're saying and I do agree. But there is a
gotcha. It's related to the way the fold line is filled with chars (as in
'fillchars'). Say I find it too invasive so I set the fold fillchar to space
and its background to the normal background, in order to turn it "invisible".
Now I have a colorcolumn splitted here and there and that *really* looks odd.
Maybe the solution is not to force filling the fold line all the way to the
right margin but to make it the length of the string foldtext() returned.

Cheers
--
Carlos

Carlos Pita

unread,
Mar 6, 2015, 6:14:24 PM3/6/15
to vim_use, Christian Brabandt, vim-dev
> Maybe the solution is not to force filling the fold line all the way to the
> right margin but to make it the length of the string foldtext() returned.

Something like an "empty fillchar" (which is currently impossible
AFAIK) would do the trick while still allowing for the current
behaviour in a backward compatible way, albeit I don't know if a
generalization like that is desirable and/or easy to implement.

Cheers
--
Carlos

Christian Brabandt

unread,
Mar 7, 2015, 3:27:01 PM3/7/15
to vim...@googlegroups.com, vim...@vim.org
Hi Bram!

On Fr, 06 Mär 2015, Bram Moolenaar wrote:

> Christian wrote:
> > Bram,
> >
> > On Fr, 06 Mär 2015, Christian Brabandt wrote:
> > > On Do, 05 Mär 2015, Carlos Pita wrote:
> > >
> > > > Hi all,
> > > >
> > > > is there any way to force the color column to show above a fold header?
> > > >
> > > > I tried:
> > > >
> > > > highlight Folded cterm=none ctermbg=none
> > > >
> > > > and
> > > >
> > > > highlight clear Folded
> > > >
> > > > to no avail.
> > > >
> > > > See the attached screenshot in case I'm not being clear.
> > >
> > > I don't think there is a possibility. Vims highlighting priorities are
> > > mostly hard coded in the source. So there is nothing you can do about.
> >
> > Here is a patch, that makes the colorcolumn drawn on top of folded
> > regions.
>
> The idea of 'colorcolumn' is that it applies to the text. So you can
> align items or make sure they are in a certain column. I don't see
> how that is useful in a folded region. I would think it makes the
> closed fold look odd. I have the idea that the closed fold is "above"
> the text and the 'colorcolumn' is "under" the text.

I would see it the other way around. But that is debatable, I guess. I
just thought, when the cursorcolumn is displayed, the colorcolumn might
as well be displayed.

> So, why would someone want to change this?

Because broken colorcolumns looks ugly ;)


Best,
Christian
--
Ein Prognostiker ist ein Mann, der in lichten Momenten düstere
Ahnungen hat.
-- Tennessee Williams

Bram Moolenaar

unread,
Mar 8, 2015, 9:49:22 AM3/8/15
to Christian Brabandt, vim...@googlegroups.com, vim...@vim.org
I have to admit that it's now inconsistent, having cursorcolumn and
colorcolumn behave differently. Did anybody complain about the behavior
of cursorcolumn? Perhaps then it's best to do the same for colorcolumn.
Consistency is more important in this case.

--
Not too long ago, a program was something you watched on TV...

Christian Brabandt

unread,
Mar 8, 2015, 1:19:45 PM3/8/15
to vim...@googlegroups.com, vim...@vim.org
Hi Bram!

On So, 08 Mär 2015, Bram Moolenaar wrote:

> I have to admit that it's now inconsistent, having cursorcolumn and
> colorcolumn behave differently. Did anybody complain about the behavior
> of cursorcolumn? Perhaps then it's best to do the same for colorcolumn.
> Consistency is more important in this case.

Not that I know of. Carlos as the original Poster did ask how to make it
the colorcolumn work with folded regions and it looks like he has asked
the same question on Stackoverflow:
http://stackoverflow.com/questions/28892305

I wouldn't call it a complain however.

Best,
Christian
--
Es muß für einen Architekten schon blöd sein, wenn ihm dauernd was einfällt.

Carlos Pita

unread,
Mar 9, 2015, 8:11:35 PM3/9/15
to vim_use, vim-dev
Hi again,

an update: it's a bit worst than I've described, as the number columns
at the left also look splitted. See the attached screenshot.

I'm not sure whether this is an argument pro or con fold header being
above whatever special column. At least the idea of the fold header
being above every special column is already implemented and has it's
rationale, as Bram exposed it. Of course, it looks bad when one tries
to make it "transparent", as the visual effect is to make every
special column look splitted instead of just at a lower layer. Maybe
the solution is to refrain from trying to style the fold headers in a
more modest fashion and always give them a distinctive "here I am"
background. I don't know.

Cheers
--
Carlos
> --
> --
> 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
>
> ---
> You received this message because you are subscribed to a topic in the Google Groups "vim_use" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/vim_use/BIIH2PaY0jQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to vim_use+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
2015-03-09-210040_726x269_scrot.png

Christian Brabandt

unread,
Mar 10, 2015, 4:54:57 AM3/10/15
to vim...@googlegroups.com, vim-dev
Am 2015-03-10 01:10, schrieb Carlos Pita:
> an update: it's a bit worst than I've described, as the number columns
> at the left also look splitted. See the attached screenshot.

Do you mean, that the number setting isn't updated? How did you do this?
Does a manual redraw using :redraw or :redraw! help?
I can't seem to replicate that behaviour.

Best,
Christian
Reply all
Reply to author
Forward
0 new messages