Skip to content

Search/IncSearch highlighting clashes with ColorColumn #7

@UrsaDK

Description

@UrsaDK

Search and/or IncSearch highlighting disappears if the highlighted word happens to be on a ColorColumn.

How to recreate

  1. Start a new buffer and run the following commands:
:colorscheme github
:set hlsearch incsearch
:set colorcolumn=3,4,5
:normal ggiThisIsMyTest
  1. Search for hisIs (broken IncSearch highlight) then hit Enter (broken Search highlight)

My solution

Normally the way colorschemes get around this issue is by setting gui=reverse cterm=reverse on both IncSearch and Search highlight groups. However, doing so here results in a pale text on a pale background when the highlighted characters are on the ColorColumn. This makes the text ineligible. It also resets the foreground colour of the text inside the highlight, which isn't ideal...

Personally, I decided to fix this issue by taking a clue from GitHub and disabling ColorColumn highlighting all together: hi clear ColorColumn. After all, GitHub doesn't support ColorColumn so by not coloring them in the theme stays true to GitHub's visual styling.

However, this solution might not be to everyone's taste.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions