[vim/vim] Highlight groups's performance is different in termguicolor for some groups. (Issue #20413)

13 views
Skip to first unread message

Mao-Yining

unread,
Jun 2, 2026, 11:15:35 AMJun 2
to vim/vim, Subscribed
mao-yining created an issue (vim/vim#20413)

Steps to reproduce

vim --clean -S a.vim

a.vim:

set termguicolors
hi SpellBad guifg=NONE guibg=NONE guisp=#d20f39 gui=undercurl ctermfg=161 ctermbg=NONE cterm=underline term=underline
hi SpellBad

On cmd.exe

default.png (view on web)

On msys2

default.png (view on web)

Expected behaviour

default.png (view on web)

Version of Vim

9.1.506

Environment

MS-Windows Windows Terminal and Consle and Msys consle

Logs and stack traces


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/20413@github.com>

Shay Hill

unread,
Jun 23, 2026, 12:52:16 PM (14 hours ago) Jun 23
to vim/vim, Subscribed
ShayHill left a comment (vim/vim#20413)

I have noticed this in Windows on PowerShell 7 and came here to ask if it was specific to Windows/PowerShell.

The problem occurs when guisp is set, but guibg is not. For the SpellBad group, set hi SpellBad guisp=NONE, and the issue cannot be seen.

Minimal config to see:

set termguicolors
colorscheme habamax
set spell

I have this in my vimrc as a bandaid, because yegappan/lsp links the Spell groups for LSP errors / warnings.

def FixSpellHi(): void
  if !has('gui_running')
    if synIDattr(hlID('SpellBad'), 'bg') == ''
      hi SpellBad   guisp=NONE
    endif
    if synIDattr(hlID('SpellCap'), 'bg') == ''
      hi SpellCap   guisp=NONE
    endif
    if synIDattr(hlID('SpellRare'), 'bg') == ''
      hi SpellRare  guisp=NONE
    endif
    if synIDattr(hlID('SpellLocal'), 'bg') == ''
      hi SpellLocal guisp=NONE
    endif
  endif
enddef

augroup FixSpellingHighlightErrors
  autocmd!
  autocmd ColorScheme * call FixSpellHi()
augroup END


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Shay Hill

unread,
Jun 23, 2026, 4:31:25 PM (10 hours ago) Jun 23
to vim/vim, Subscribed
ShayHill left a comment (vim/vim#20413)

I think I've purchased the right solution to this problem. I won't submit a PR, because I have no way of testing if this works in other terminals.

set termguicolors sets a value, t_8u, to \<Esc>[58;2;%lu;%lu;%lum. Windows Terminal doesn't parse this form (with semicolons) correctly. Windows Terminal wants the colon-form: \<Esc>[58:2::%lu:%lu:%lum. Why this only seems to affect some combinations, I can't say. From what I've read, it's likely the semicolon form causes trouble in other terminals. I never thought about it much until I started using yegappan/lsp.

If and until this is patched, this will work in your vimrc:

vim9script
set termguicolors
&t_8u = "\<Esc>[58:2::%lu:%lu:%lum"

I think

set termguicolors
let &t_8u="\<Esc>[58:2::%lu:%lu:%lum"

Would work in legacy vimscript.

In any case, it's a pretty clean fix, but one more piece of "tribal knowledge" Windows users must possess.


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!

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

Reply all
Reply to author
Forward
0 new messages