1
0
forked from aniani/vim

patch 7.4.1799

Problem:    'guicolors' is a confusing option name.
Solution:   Use 'termguicolors' instead. (Hirohito Higashi)
This commit is contained in:
Bram Moolenaar
2016-04-29 22:59:22 +02:00
parent bb82762907
commit 61be73bb0f
17 changed files with 153 additions and 148 deletions

View File

@@ -3477,18 +3477,6 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
*'guicolors'* *'gcol'*
'guicolors' 'gcol' boolean (default off)
global
{not in Vi}
{not available when compiled without the
|+termtruecolor| feature}
When on, uses |highlight-guifg| and |highlight-guibg| attributes in
the terminal (thus using 24-bit color). Requires a ISO-8613-3
compatible terminal.
If setting this option does not work (produces a colorless UI)
reading |xterm-true-color| might help.
*'guicursor'* *'gcr'* *E545* *E546* *E548* *E549*
'guicursor' 'gcr' string (default "n-v-c:block-Cursor/lCursor,
ve:ver35-Cursor,
@@ -7551,6 +7539,18 @@ A jump table for the options with a short description can be found at |Q_op|.
:set encoding=utf-8
< You need to do this when your system has no locale support for UTF-8.
*'termguicolors'* *'tgc'*
'termguicolors' 'tgc' boolean (default off)
global
{not in Vi}
{not available when compiled without the
|+termguicolors| feature}
When on, uses |highlight-guifg| and |highlight-guibg| attributes in
the terminal (thus using 24-bit color). Requires a ISO-8613-3
compatible terminal.
If setting this option does not work (produces a colorless UI)
reading |xterm-true-color| might help.
*'terse'* *'noterse'*
'terse' boolean (default off)
global

View File

@@ -1,4 +1,4 @@
*term.txt* For Vim version 7.4. Last change: 2016 Apr 21
*term.txt* For Vim version 7.4. Last change: 2016 Apr 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -302,7 +302,6 @@ Added by Vim (there are no standard codes for these):
t_u7 request cursor position (for xterm) *t_u7* *'t_u7'*
see |'ambiwidth'|
t_RB request terminal background color *t_RB* *'t_RB'*
see |'ambiwidth'|
t_8f set foreground color (R, G, B) *t_8f* *'t_8f'*
|xterm-true-color|
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.
*xterm-true-color*
Vim supports using true colors in the terminal (taken from |highlight-guifg|
and |highlight-guibg|), given that terminal supports this. To make this
work, 'guicolors' option needs to be set.
and |highlight-guibg|), given that the terminal supports this. To make this
work the 'termguicolors' option needs to be set.
Sometimes setting 'guicolors' is not enough and one has to set the |t_8f| and
|t_8b| options explicitly. Default values of these options are
`^[[38;2;%lu;%lu;%lum` and `^[[48;2;%lu;%lu;%lum` (replace `^[` with real
escape) respectively, but it is only set when `$TERM` is `xterm`. Some
terminals accept the same sequences, but with all semicolons replaced by
colons (this is actually more compatible, but less widely supported). These
options contain printf strings, with |printf()| (actually, its C equivalent
hence `l` modifier) invoked with the t_ option value and three unsigned long
integers that may have any value between 0 and 255 (inclusive) representing
red, green and blue colors respectively.
Sometimes setting 'termguicolors' is not enough and one has to set the |t_8f|
and |t_8b| options explicitly. Default values of these options are
"^[[38;2;%lu;%lu;%lum" and "^[[48;2;%lu;%lu;%lum" respectively, but it is only
set when `$TERM` is `xterm`. Some terminals accept the same sequences, but
with all semicolons replaced by colons (this is actually more compatible, but
less widely supported): >
set t_8f=^[[38:2:%lu:%lu:%lum
set t_8b=^[[48:2:%lu:%lu:%lum
(replace `^[` with real escape)
These options contain printf strings, with |printf()| (actually, its C
equivalent hence `l` modifier) invoked with the t_ option value and three
unsigned long integers that may have any value between 0 and 255 (inclusive)
representing red, green and blue colors respectively.
*xterm-resize*
Window resizing with xterm only works if the allowWindowOps resource is

View File

@@ -1,4 +1,4 @@
*various.txt* For Vim version 7.4. Last change: 2016 Mar 20
*various.txt* For Vim version 7.4. Last change: 2016 Apr 29
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -424,7 +424,7 @@ m *+tcl* Tcl interface |tcl|
m *+tcl/dyn* Tcl interface |tcl-dynamic| |/dyn|
*+terminfo* uses |terminfo| instead of termcap
N *+termresponse* support for |t_RV| and |v:termresponse|
m *+termtruecolor* 24-bit color in xterm-compatible terminals support
B *+termguicolors* 24-bit color in xterm-compatible terminals support
N *+textobjects* |text-objects| selection
*+tgetent* non-Unix only: able to use external termcap
N *+timers* the |timer_start()| function

View File

@@ -44,24 +44,24 @@ highlight default link dircolorsExtension Identifier
highlight default link dircolorsEscape Special
function! s:set_guicolors() abort
let s:guicolors = {}
let s:termguicolors = {}
let s:guicolors[0] = "Black"
let s:guicolors[1] = "DarkRed"
let s:guicolors[2] = "DarkGreen"
let s:guicolors[3] = "DarkYellow"
let s:guicolors[4] = "DarkBlue"
let s:guicolors[5] = "DarkMagenta"
let s:guicolors[6] = "DarkCyan"
let s:guicolors[7] = "Gray"
let s:guicolors[8] = "DarkGray"
let s:guicolors[9] = "Red"
let s:guicolors[10] = "Green"
let s:guicolors[11] = "Yellow"
let s:guicolors[12] = "Blue"
let s:guicolors[13] = "Magenta"
let s:guicolors[14] = "Cyan"
let s:guicolors[15] = "White"
let s:termguicolors[0] = "Black"
let s:termguicolors[1] = "DarkRed"
let s:termguicolors[2] = "DarkGreen"
let s:termguicolors[3] = "DarkYellow"
let s:termguicolors[4] = "DarkBlue"
let s:termguicolors[5] = "DarkMagenta"
let s:termguicolors[6] = "DarkCyan"
let s:termguicolors[7] = "Gray"
let s:termguicolors[8] = "DarkGray"
let s:termguicolors[9] = "Red"
let s:termguicolors[10] = "Green"
let s:termguicolors[11] = "Yellow"
let s:termguicolors[12] = "Blue"
let s:termguicolors[13] = "Magenta"
let s:termguicolors[14] = "Cyan"
let s:termguicolors[15] = "White"
let xterm_palette = ["00", "5f", "87", "af", "d7", "ff"]
@@ -70,7 +70,7 @@ function! s:set_guicolors() abort
for r in xterm_palette
for g in xterm_palette
for b in xterm_palette
let s:guicolors[cur_col] = '#' . r . g . b
let s:termguicolors[cur_col] = '#' . r . g . b
let cur_col += 1
endfor
endfor
@@ -78,14 +78,14 @@ function! s:set_guicolors() abort
for i in range(24)
let g = i * 0xa + 8
let s:guicolors[i + 232] = '#' . g . g . g
let s:termguicolors[i + 232] = '#' . g . g . g
endfor
endfunction
function! s:get_hi_str(color, place) abort
if a:color >= 0 && a:color <= 255
if has('gui_running')
return ' gui' . a:place . '=' . s:guicolors[a:color]
return ' gui' . a:place . '=' . s:termguicolors[a:color]
elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88
return ' cterm' . a:place . '=' . a:color
endif