Skip to content

Commit 61be73b

Browse files
committed
patch 7.4.1799
Problem: 'guicolors' is a confusing option name. Solution: Use 'termguicolors' instead. (Hirohito Higashi)
1 parent bb82762 commit 61be73b

17 files changed

Lines changed: 155 additions & 150 deletions

File tree

runtime/doc/options.txt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3477,18 +3477,6 @@ A jump table for the options with a short description can be found at |Q_op|.
34773477
This option cannot be set from a |modeline| or in the |sandbox|, for
34783478
security reasons.
34793479

3480-
*'guicolors'* *'gcol'*
3481-
'guicolors' 'gcol' boolean (default off)
3482-
global
3483-
{not in Vi}
3484-
{not available when compiled without the
3485-
|+termtruecolor| feature}
3486-
When on, uses |highlight-guifg| and |highlight-guibg| attributes in
3487-
the terminal (thus using 24-bit color). Requires a ISO-8613-3
3488-
compatible terminal.
3489-
If setting this option does not work (produces a colorless UI)
3490-
reading |xterm-true-color| might help.
3491-
34923480
*'guicursor'* *'gcr'* *E545* *E546* *E548* *E549*
34933481
'guicursor' 'gcr' string (default "n-v-c:block-Cursor/lCursor,
34943482
ve:ver35-Cursor,
@@ -7551,6 +7539,18 @@ A jump table for the options with a short description can be found at |Q_op|.
75517539
:set encoding=utf-8
75527540
< You need to do this when your system has no locale support for UTF-8.
75537541

7542+
*'termguicolors'* *'tgc'*
7543+
'termguicolors' 'tgc' boolean (default off)
7544+
global
7545+
{not in Vi}
7546+
{not available when compiled without the
7547+
|+termguicolors| feature}
7548+
When on, uses |highlight-guifg| and |highlight-guibg| attributes in
7549+
the terminal (thus using 24-bit color). Requires a ISO-8613-3
7550+
compatible terminal.
7551+
If setting this option does not work (produces a colorless UI)
7552+
reading |xterm-true-color| might help.
7553+
75547554
*'terse'* *'noterse'*
75557555
'terse' boolean (default off)
75567556
global

runtime/doc/term.txt

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*term.txt* For Vim version 7.4. Last change: 2016 Apr 21
1+
*term.txt* For Vim version 7.4. Last change: 2016 Apr 29
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -302,7 +302,6 @@ Added by Vim (there are no standard codes for these):
302302
t_u7 request cursor position (for xterm) *t_u7* *'t_u7'*
303303
see |'ambiwidth'|
304304
t_RB request terminal background color *t_RB* *'t_RB'*
305-
see |'ambiwidth'|
306305
t_8f set foreground color (R, G, B) *t_8f* *'t_8f'*
307306
|xterm-true-color|
308307
t_8b set background color (R, G, B) *t_8b* *'t_8b'*
@@ -425,19 +424,23 @@ Vim has started, the escape sequences may not be recognized anymore.
425424

426425
*xterm-true-color*
427426
Vim supports using true colors in the terminal (taken from |highlight-guifg|
428-
and |highlight-guibg|), given that terminal supports this. To make this
429-
work, 'guicolors' option needs to be set.
430-
431-
Sometimes setting 'guicolors' is not enough and one has to set the |t_8f| and
432-
|t_8b| options explicitly. Default values of these options are
433-
`^[[38;2;%lu;%lu;%lum` and `^[[48;2;%lu;%lu;%lum` (replace `^[` with real
434-
escape) respectively, but it is only set when `$TERM` is `xterm`. Some
435-
terminals accept the same sequences, but with all semicolons replaced by
436-
colons (this is actually more compatible, but less widely supported). These
437-
options contain printf strings, with |printf()| (actually, its C equivalent
438-
hence `l` modifier) invoked with the t_ option value and three unsigned long
439-
integers that may have any value between 0 and 255 (inclusive) representing
440-
red, green and blue colors respectively.
427+
and |highlight-guibg|), given that the terminal supports this. To make this
428+
work the 'termguicolors' option needs to be set.
429+
430+
Sometimes setting 'termguicolors' is not enough and one has to set the |t_8f|
431+
and |t_8b| options explicitly. Default values of these options are
432+
"^[[38;2;%lu;%lu;%lum" and "^[[48;2;%lu;%lu;%lum" respectively, but it is only
433+
set when `$TERM` is `xterm`. Some terminals accept the same sequences, but
434+
with all semicolons replaced by colons (this is actually more compatible, but
435+
less widely supported): >
436+
set t_8f=^[[38:2:%lu:%lu:%lum
437+
set t_8b=^[[48:2:%lu:%lu:%lum
438+
(replace `^[` with real escape)
439+
440+
These options contain printf strings, with |printf()| (actually, its C
441+
equivalent hence `l` modifier) invoked with the t_ option value and three
442+
unsigned long integers that may have any value between 0 and 255 (inclusive)
443+
representing red, green and blue colors respectively.
441444

442445
*xterm-resize*
443446
Window resizing with xterm only works if the allowWindowOps resource is

runtime/doc/various.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
*various.txt* For Vim version 7.4. Last change: 2016 Mar 20
1+
*various.txt* For Vim version 7.4. Last change: 2016 Apr 29
22

33

44
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -424,7 +424,7 @@ m *+tcl* Tcl interface |tcl|
424424
m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn|
425425
*+terminfo* uses |terminfo| instead of termcap
426426
N *+termresponse* support for |t_RV| and |v:termresponse|
427-
m *+termtruecolor* 24-bit color in xterm-compatible terminals support
427+
B *+termguicolors* 24-bit color in xterm-compatible terminals support
428428
N *+textobjects* |text-objects| selection
429429
*+tgetent* non-Unix only: able to use external termcap
430430
N *+timers* the |timer_start()| function

runtime/syntax/dircolors.vim

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -44,24 +44,24 @@ highlight default link dircolorsExtension Identifier
4444
highlight default link dircolorsEscape Special
4545

4646
function! s:set_guicolors() abort
47-
let s:guicolors = {}
48-
49-
let s:guicolors[0] = "Black"
50-
let s:guicolors[1] = "DarkRed"
51-
let s:guicolors[2] = "DarkGreen"
52-
let s:guicolors[3] = "DarkYellow"
53-
let s:guicolors[4] = "DarkBlue"
54-
let s:guicolors[5] = "DarkMagenta"
55-
let s:guicolors[6] = "DarkCyan"
56-
let s:guicolors[7] = "Gray"
57-
let s:guicolors[8] = "DarkGray"
58-
let s:guicolors[9] = "Red"
59-
let s:guicolors[10] = "Green"
60-
let s:guicolors[11] = "Yellow"
61-
let s:guicolors[12] = "Blue"
62-
let s:guicolors[13] = "Magenta"
63-
let s:guicolors[14] = "Cyan"
64-
let s:guicolors[15] = "White"
47+
let s:termguicolors = {}
48+
49+
let s:termguicolors[0] = "Black"
50+
let s:termguicolors[1] = "DarkRed"
51+
let s:termguicolors[2] = "DarkGreen"
52+
let s:termguicolors[3] = "DarkYellow"
53+
let s:termguicolors[4] = "DarkBlue"
54+
let s:termguicolors[5] = "DarkMagenta"
55+
let s:termguicolors[6] = "DarkCyan"
56+
let s:termguicolors[7] = "Gray"
57+
let s:termguicolors[8] = "DarkGray"
58+
let s:termguicolors[9] = "Red"
59+
let s:termguicolors[10] = "Green"
60+
let s:termguicolors[11] = "Yellow"
61+
let s:termguicolors[12] = "Blue"
62+
let s:termguicolors[13] = "Magenta"
63+
let s:termguicolors[14] = "Cyan"
64+
let s:termguicolors[15] = "White"
6565

6666
let xterm_palette = ["00", "5f", "87", "af", "d7", "ff"]
6767

@@ -70,22 +70,22 @@ function! s:set_guicolors() abort
7070
for r in xterm_palette
7171
for g in xterm_palette
7272
for b in xterm_palette
73-
let s:guicolors[cur_col] = '#' . r . g . b
73+
let s:termguicolors[cur_col] = '#' . r . g . b
7474
let cur_col += 1
7575
endfor
7676
endfor
7777
endfor
7878

7979
for i in range(24)
8080
let g = i * 0xa + 8
81-
let s:guicolors[i + 232] = '#' . g . g . g
81+
let s:termguicolors[i + 232] = '#' . g . g . g
8282
endfor
8383
endfunction
8484

8585
function! s:get_hi_str(color, place) abort
8686
if a:color >= 0 && a:color <= 255
8787
if has('gui_running')
88-
return ' gui' . a:place . '=' . s:guicolors[a:color]
88+
return ' gui' . a:place . '=' . s:termguicolors[a:color]
8989
elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88
9090
return ' cterm' . a:place . '=' . a:color
9191
endif

src/eval.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14042,15 +14042,15 @@ f_has(typval_T *argvars, typval_T *rettv)
1404214042
"tcl",
1404314043
# endif
1404414044
#endif
14045+
#ifdef FEAT_TERMGUICOLORS
14046+
"termguicolors",
14047+
#endif
1404514048
#ifdef TERMINFO
1404614049
"terminfo",
1404714050
#endif
1404814051
#ifdef FEAT_TERMRESPONSE
1404914052
"termresponse",
1405014053
#endif
14051-
#ifdef FEAT_TERMTRUECOLOR
14052-
"termtruecolor",
14053-
#endif
1405414054
#ifdef FEAT_TEXTOBJ
1405514055
"textobjects",
1405614056
#endif
@@ -20019,7 +20019,7 @@ f_synIDattr(typval_T *argvars UNUSED, typval_T *rettv)
2001920019
}
2002020020
else
2002120021
{
20022-
#if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
20022+
#if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
2002320023
if (USE_24BIT)
2002420024
modec = 'g';
2002520025
else

src/feature.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -815,10 +815,10 @@
815815
#endif
816816

817817
/*
818-
* +termtruecolor 'guicolor' option.
818+
* +termguicolors 'termguicolors' option.
819819
*/
820820
#if (defined(FEAT_BIG) && defined(FEAT_SYN_HL)) && !defined(ALWAYS_USE_GUI)
821-
# define FEAT_TERMTRUECOLOR
821+
# define FEAT_TERMGUICOLORS
822822
#endif
823823

824824
/* Mac specific thing: Codewarrior interface. */

src/globals.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ EXTERN char_u *use_gvimrc INIT(= NULL); /* "-U" cmdline argument */
369369
EXTERN int cterm_normal_fg_color INIT(= 0);
370370
EXTERN int cterm_normal_fg_bold INIT(= 0);
371371
EXTERN int cterm_normal_bg_color INIT(= 0);
372-
#ifdef FEAT_TERMTRUECOLOR
372+
#ifdef FEAT_TERMGUICOLORS
373373
EXTERN long_u cterm_normal_fg_gui_color INIT(= INVALCOLOR);
374374
EXTERN long_u cterm_normal_bg_gui_color INIT(= INVALCOLOR);
375375
#endif

src/hardcopy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ prt_get_attr(
307307
pattr->underline = (highlight_has_attr(hl_id, HL_UNDERLINE, modec) != NULL);
308308
pattr->undercurl = (highlight_has_attr(hl_id, HL_UNDERCURL, modec) != NULL);
309309

310-
# if defined(FEAT_GUI) || defined(FEAT_TERMTRUECOLOR)
310+
# if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)
311311
if (USE_24BIT)
312312
{
313313
bg_color = highlight_gui_color_rgb(hl_id, FALSE);

src/option.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,15 +1303,6 @@ static struct vimoption options[] =
13031303
#else
13041304
(char_u *)NULL, PV_NONE,
13051305
{(char_u *)NULL, (char_u *)0L}
1306-
#endif
1307-
SCRIPTID_INIT},
1308-
{"guicolors", "gcol", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
1309-
#ifdef FEAT_TERMTRUECOLOR
1310-
(char_u *)&p_guicolors, PV_NONE,
1311-
{(char_u *)FALSE, (char_u *)FALSE}
1312-
#else
1313-
(char_u*)NULL, PV_NONE,
1314-
{(char_u *)FALSE, (char_u *)FALSE}
13151306
#endif
13161307
SCRIPTID_INIT},
13171308
{"guicursor", "gcr", P_STRING|P_VI_DEF|P_ONECOMMA|P_NODUP,
@@ -2623,6 +2614,15 @@ static struct vimoption options[] =
26232614
#else
26242615
(char_u *)NULL, PV_NONE,
26252616
{(char_u *)0L, (char_u *)0L}
2617+
#endif
2618+
SCRIPTID_INIT},
2619+
{"termguicolors", "tgc", P_BOOL|P_VI_DEF|P_VIM|P_RCLR,
2620+
#ifdef FEAT_TERMGUICOLORS
2621+
(char_u *)&p_tgc, PV_NONE,
2622+
{(char_u *)FALSE, (char_u *)FALSE}
2623+
#else
2624+
(char_u*)NULL, PV_NONE,
2625+
{(char_u *)FALSE, (char_u *)FALSE}
26262626
#endif
26272627
SCRIPTID_INIT},
26282628
{"terse", NULL, P_BOOL|P_VI_DEF,
@@ -8364,9 +8364,9 @@ set_bool_option(
83648364

83658365
#endif
83668366

8367-
#ifdef FEAT_TERMTRUECOLOR
8368-
/* 'guicolors' */
8369-
else if ((int *)varp == &p_guicolors)
8367+
#ifdef FEAT_TERMGUICOLORS
8368+
/* 'termguicolors' */
8369+
else if ((int *)varp == &p_tgc)
83708370
{
83718371
# ifdef FEAT_GUI
83728372
if (!gui.in_use && !gui.starting)

src/option.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,6 @@ EXTERN char_u *p_popt; /* 'printoptions' */
527527
EXTERN char_u *p_header; /* 'printheader' */
528528
#endif
529529
EXTERN int p_prompt; /* 'prompt' */
530-
#ifdef FEAT_TERMTRUECOLOR
531-
EXTERN int p_guicolors; /* 'guicolors' */
532-
#endif
533530
#ifdef FEAT_GUI
534531
EXTERN char_u *p_guifont; /* 'guifont' */
535532
# ifdef FEAT_XFONTSET
@@ -843,6 +840,9 @@ EXTERN int p_tbidi; /* 'termbidi' */
843840
#ifdef FEAT_MBYTE
844841
EXTERN char_u *p_tenc; /* 'termencoding' */
845842
#endif
843+
#ifdef FEAT_TERMGUICOLORS
844+
EXTERN int p_tgc; /* 'termguicolors' */
845+
#endif
846846
EXTERN int p_terse; /* 'terse' */
847847
EXTERN int p_ta; /* 'textauto' */
848848
EXTERN int p_to; /* 'tildeop' */

0 commit comments

Comments
 (0)