[vim/vim] Vim shows underline instead of undercurl in terminal (whereas neovim does show undercurl) (#6174)

1,002 views
Skip to first unread message

Dominique Pellé

unread,
May 31, 2020, 8:05:57 PM5/31/20
to vim/vim, Subscribed

Describe the bug

After patch 8.2.863, I see underlines with colors for spelling mistakes when doing:

$ cat foo.vim
hi SpellBad   guisp=red    gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=underline
hi SpellCap   guisp=yellow gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=underline
hi SpellRare  guisp=blue   gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=underline
hi SpellLocal guisp=orange gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=underline

set termguicolors
" A text with spellling mistake in vim. check that underline or undercurl are OK.
$ vim --clean  foo.vim -c 'set spell spelllang=en_us termguicolors' -c 'so %'

vim

That's nice. However, since 'termguicolors', is set, it would have been more appropriate to show colored undercurls instead of colored underlines.

In fact, doing the same steps with neovim, I see that neovim does show colored undercurls in the terminal.

$ nvim --clean  foo.vim -c 'set spell spelllang=en_us termguicolors' -c 'so %'

nvim

I see that at least xfce4-terminal, gnome-terminal support undercurl with neovim.

Environment

  • vim-8.2.869
  • OS: xubuntu-18.04.4
  • xfce4-terminal-0.8.7.4


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Jun 1, 2020, 9:46:27 AM6/1/20
to vim/vim, Subscribed

Let's first make sure that it works without 'termguicolors':

let &t_Cs = "\e[4:3m"
let &t_Ce = "\e[4:0m"
hi SpellBad   guisp=red    gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=undercurl ctermul=red
hi SpellCap   guisp=yellow    gui=undercurl guifg=NONE guibg=NONE ctermfg=NONE ctermbg=NONE term=underline cterm=undercurl ctermul=yellow

Note that "cterm=undercurl" is used. This works for me in a gnome-terminal.
After setting 'termguicolors' it still works. Note that the "cterm" argument is not affected by 'termguicolors'. So you can have different attributes in the GUI and in a terminal. For example when undercurl doesn't work, like in an xterm.

Dominique Pellé

unread,
Jun 1, 2020, 11:56:04 AM6/1/20
to vim/vim, Subscribed

@brammool wrote:

Note that "cterm=undercurl" is used. This works for me in a gnome-terminal.

This also works fine for me (i.e. see colored undercurl) at least with those terminals that are Ubuntu-18.04 packages:

  • xfce4-terminal-0.8.7.4
  • gnome-terminal-3.28.2
  • terminator-1.91
  • tilda-1.4.1

But it does not work in:

  • xterm (330): no undercurl nor underline. Words which are meant to be undercurl have a different color
  • konsole-17.12.3, same behavior as in xterm
  • vim-8.2.69 terminal (:terminal) which use libvterm, same behavior as in xterm

Can 't_Cs' and 't_Ce' be set automatically for terminals that are known to support undercurl?

Bram Moolenaar

unread,
Jun 1, 2020, 1:06:46 PM6/1/20
to vim/vim, Subscribed

I do not know how to detect that a terminal supports undercurl. We can recognize a few terminals, but usually not the patchlevel. And I don't know at what patchlevel the feature has been implemented.
The normal way is that the termcap/terminfo is accurate.

Bram Moolenaar

unread,
Jun 1, 2020, 1:06:49 PM6/1/20
to vim/vim, Subscribed

Closed #6174.

Reply all
Reply to author
Forward
0 new messages