termguicolors and xterm

560 views
Skip to first unread message

Chris Jones

unread,
Jan 19, 2019, 5:43:30 PM1/19/19
to vim...@googlegroups.com
I came across a new 'termguicolors' option in Vim.

I took a closer look using KDE's Konsole and gnome-terminal and it
appears to work out of the box: just a matter of adding a ":set
termguicolors" statement to your ~/.vimrc and 16M colors color schemes
written with gvim in mind are correctly displayed on these two
terminals.

Since I do not normally use Konsole or gnome-terminal I proceeded to
take a look at xterm where I was unable to get this new Vim magic to
work.

Has anyone been able to get the 'termguicolors' option to work on xterm
or does xterm altogether lack the capability?

Tested with XTerm(327) on debian stable (stretch).

Thanks,

CJ

Chris Jones

unread,
Feb 14, 2019, 8:05:54 AM2/14/19
to vim...@googlegroups.com
Jury still out on this one?

Thanks,

CJ

Josh Holland

unread,
Mar 4, 2019, 7:09:36 AM3/4/19
to vim_use
On Saturday, 19 January 2019 22:43:30 UTC, Chris Jones wrote:
> Has anyone been able to get the 'termguicolors' option to work on xterm
> or does xterm altogether lack the capability?

termguicolor works for me in xterm 330 on Ubuntu 18.04 (as in, I can see colours with it set; I think they are quantized to the nearest available colour in the 256-colour palette, which is an xterm limitation).

Thanks,
Josh

Josef Fortier

unread,
Mar 4, 2019, 8:42:33 AM3/4/19
to vim_use
This was helpful to me in setting up termguicolors (not on xterm) https://gist.github.com/XVilka/8346728

I use stterm. That in mind, here are a few suggestions:

1) use one of the truecolor test scripts to verify that your xterm implements truecolor. This is useful not only for obvious reasons, but as a test of any intermediaries that might be in place (in my case tmux). If you can get the test scripts to output truecolor, you should be able to get vim to work.

2) Vim's recognition of terminal support is not perfect. The ":help termguicolors" entry suggests a few ":set &t..." settings. FWIW those did not work for me, but similar strings (google searched) did work. Without the correct strings, the visual results of setting termguicolors will be obviously bad (essentially no colors).

meine

unread,
Mar 4, 2019, 10:22:29 AM3/4/19
to vim...@googlegroups.com
On Mon, Mar 04, 2019 at 04:06:19AM -0800, Josh Holland wrote:
> On Saturday, 19 January 2019 22:43:30 UTC, Chris Jones wrote:
> > Has anyone been able to get the 'termguicolors' option to work on xterm
> > or does xterm altogether lack the capability?

I don't know if it works for you and I don't have any experience with
'termguicolors' but following lines are part of my vimrc:

43 if has('gui_running')
44 colorscheme molokai_dark
45 set guifont=Monospace\ 10
46 set columns=85 lines=30
47 elseif has('x11')
48 colorscheme molokai_dark
49 set guifont=Monospace\ 10
50 " set columns=85 lines=30
51 else
52 colorscheme evening
53 set t_Co=256
54 endif

I use both the console and the xterm terminal emulator. Since xterm has
a lot more colors than the console, I use the above do trigger the right
colorscheme for that environment. The top 'if/elseif' part looks double
as x11 and GUI are the same for the user of a system. Somehow I noticed
differences eg. between different terminal emulators.

I hope you can use this to resolve your problem on coloring vim and
syntax.

//meine
Reply all
Reply to author
Forward
0 new messages