[vim/vim] `set cursorline` makes code syntax colors gone (Issue #9617)

449 views
Skip to first unread message

NoahELE

unread,
Jan 24, 2022, 3:13:18 AM1/24/22
to vim/vim, Subscribed

Steps to reproduce

  1. open any file with syntax color highlightings
  2. use set cursorline
  3. that line is highlighted but the syntax colors are gone, and all words on that line are white.

Expected behaviour

cursorline should only highlight the backgroud a little to inform user of the line that the cursor is on, and should not make the syntax colors gone.

Version of Vim

8.2.4198

Environment

Windows 11, windows terminal

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617@github.com>

NoahELE

unread,
Jan 24, 2022, 3:15:00 AM1/24/22
to vim/vim, Subscribed

An example with .vim file. After I set cursorline, that line no longer has syntax highlighting.
image


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1019825788@github.com>

Christian Brabandt

unread,
Jan 24, 2022, 3:55:56 AM1/24/22
to vim/vim, Subscribed

that sounds more like a problem with your colorscheme


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1019859913@github.com>

NoahELE

unread,
Jan 24, 2022, 3:59:30 AM1/24/22
to vim/vim, Subscribed

that sounds more like a problem with your colorscheme

I thought it was a problem with vim as I also use neovim with the same config and curline worked fine on nvim.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1019862791@github.com>

NoahELE

unread,
Jan 24, 2022, 4:04:49 AM1/24/22
to vim/vim, Subscribed

I test it and find something really weird.

default colorscheme does not have the problem

image

but nearly all other colorscheme including the preinstalled ones like desert and industry do have the problem.

image


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1019867569@github.com>

Maxim Kim

unread,
Jan 24, 2022, 4:13:10 AM1/24/22
to vim_dev
It is a "known" issue with windows cmd and 'termguicolors'.


понедельник, 24 января 2022 г. в 11:55:56 UTC+3, Christian Brabandt:

Maxim Kim

unread,
Jan 24, 2022, 4:22:43 AM1/24/22
to vim_dev



понедельник, 24 января 2022 г. в 12:13:10 UTC+3, Maxim Kim:

Maxim Kim

unread,
Jan 24, 2022, 4:33:38 AM1/24/22
to vim_dev
Basically, the issue is fairly simple to reproduce (cmd.exe, windows):

1. `vim -Nu NONE`
2. `set tgc`
3. `set cursorline`
4. `set ft=vim`
5. `syntax on`
6. `iecho "hello world"`

^^^^ we can see syntax under cursorline

7. ` colo industry`

^^^ no syntax highlighting


And it boils down to whether colorscheme did define `Normal` group or not.  For example, if you remove `:hi Normal` from `industry` -- it will "fix" the cursorline issue.

@chrisbra, I remember we were discussing it on vi.se in comments, but couldn't find it.

понедельник, 24 января 2022 г. в 12:22:43 UTC+3, Maxim Kim:

Christian Brabandt

unread,
Jan 24, 2022, 5:04:16 AM1/24/22
to vim...@googlegroups.com

On Mo, 24 Jan 2022, Maxim Kim wrote:

> Basically, the issue is fairly simple to reproduce (cmd.exe, windows):
>
> 1. `vim -Nu NONE`
> 2. `set tgc`
> 3. `set cursorline`
> 4. `set ft=vim`
> 5. `syntax on`
> 6. `iecho "hello world"`
>
> ^^^^ we can see syntax under cursorline
>
> 7. ` colo industry`
>
> ^^^ no syntax highlighting
>
>
> And it boils down to whether colorscheme did define `Normal` group or not. For
> example, if you remove `:hi Normal` from `industry` -- it will "fix" the
> cursorline issue.
>
> @chrisbra, I remember we were discussing it on vi.se in comments, but couldn't
> find it.

Yes I remember something like that. What I don't know, is that something
that should be fixed by vim core or should the colorscheme generally
define/not define the Normal highlighting group?

Don't know.

Thanks,
Chris


Mit freundlichen Grüßen
Christian
--
Ärgern ist Energieverschwendung.
-- Curt Goetz

Christian Brabandt

unread,
Jan 24, 2022, 5:05:04 AM1/24/22
to vim/vim, Subscribed

related discussion on vim-dev: https://groups.google.com/g/vim_dev/c/e6puIxRP2gI/m/Q4XUxSDpAgAJ?pli=1


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1019922842@github.com>

Maxim Kim

unread,
Jan 24, 2022, 5:26:02 AM1/24/22
to vim_dev


понедельник, 24 января 2022 г. в 13:04:16 UTC+3, cbl...@256bit.org:


Yes I remember something like that. What I don't know, is that something
that should be fixed by vim core or should the colorscheme generally
define/not define the Normal highlighting group?

Don't know.


How would you create a colorscheme like peachpuff without defining Normal hl group? Or blue, darkblue, etc?

Bram Moolenaar

unread,
Jan 24, 2022, 6:58:01 AM1/24/22
to vim/vim, Subscribed

Closed #9617.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/9617/issue_event/5941888433@github.com>

Bram Moolenaar

unread,
Jan 24, 2022, 6:58:01 AM1/24/22
to vim/vim, Subscribed

This must be a problem in your configuration. I can set the cursorline background and the syntax highlighting is clearly visible.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1020022099@github.com>

Maxim Kim

unread,
Jan 24, 2022, 7:18:51 AM1/24/22
to vim/vim, Subscribed

This must be a problem in your configuration. I can set the cursorline background and the syntax highlighting is clearly visible.

It is actually not.

The issue is windows cmd.exe + set termguicolors + a colorscheme that defines a Normal highlight group.

It is easily reproducible as I mentioned in a vim_dev thread:

  1. on a cmd.exe run vim -Nu NONE
  2. set termguicolors
  3. colo industry (or any other that defines Normal hl)
  4. set ft=vim
  5. syntax on
  6. iecho "hello world"
  7. set cursorline

industry

image

peachpuff

image


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1020039498@github.com>

Maxim Kim

unread,
Jan 24, 2022, 7:47:38 AM1/24/22
to vim/vim, Subscribed

Just to make it clear, I have never experienced this issue except

  1. windows command line (either cmd.exe, powershell.exe, new windows terminal)
  2. with set termguicolors
  3. and a colorscheme that defines Normal highlight group.

For me there is no issue for GVIM, OSX homebrewed vim, macvim, debian wsl vim.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1020063007@github.com>

Bram Moolenaar

unread,
Jan 24, 2022, 8:05:06 AM1/24/22
to vim/vim, Subscribed

Hmm, so this is only a problem in the MS-Windows console?


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1020078099@github.com>

Maxim Kim

unread,
Jan 24, 2022, 8:16:08 AM1/24/22
to vim/vim, Subscribed

Hmm, so this is only a problem in the MS-Windows console?

Yes, indeed!


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1020089127@github.com>

Christian Brabandt

unread,
Jan 24, 2022, 10:40:36 AM1/24/22
to vim/vim, Subscribed

Reopened #9617.


Reply to this email directly, view it on GitHub.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/9617/issue_event/5943473562@github.com>

Christian Brabandt

unread,
Apr 29, 2022, 7:29:57 AM4/29/22
to vim/vim, Subscribed

duplicate of #10241 let me close this one here.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/9617/1113196626@github.com>

Christian Brabandt

unread,
Apr 29, 2022, 7:29:58 AM4/29/22
to vim/vim, Subscribed

Closed #9617.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/9617/issue_event/6522465111@github.com>

Reply all
Reply to author
Forward
0 new messages