mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
'termguicolors' #4690
TODO: Only works at startup (i.e., in the user's init.vim/vimrc/--cmd), but it should probably work at any time. --- patch 7.4.1799 Problem: 'guicolors' is a confusing option name. Solution: Use 'termguicolors' instead. (Hirohito Higashi)61be73bb0f
patch 7.4.1806 Problem: 'termguicolors' option missing from the options window. Solution: Add the entry.8e3d1b6326
patch 7.4.1808 Problem: Using wrong feature name to check for 'termguicolors'. Solution: Use the right feature name. (Ken Takata)8a24b794b8
patch 7.4.1809 Problem: Using wrong short option name for 'termguicolors'. Solution: Use the option name.868cfc19bb
This commit is contained in:
parent
a5a1768918
commit
acc5d08b37
@ -391,9 +391,6 @@ See
|
|||||||
in the
|
in the
|
||||||
.Xr tmux 1
|
.Xr tmux 1
|
||||||
manual page for more information.
|
manual page for more information.
|
||||||
.It Ev NVIM_TUI_ENABLE_TRUE_COLOR
|
|
||||||
If defined, assume the host terminal supports 24 bit colors.
|
|
||||||
Has no effect in GUIs.
|
|
||||||
.El
|
.El
|
||||||
.Sh FILES
|
.Sh FILES
|
||||||
.Bl -tag -width "~/.config/nvim/init.vim"
|
.Bl -tag -width "~/.config/nvim/init.vim"
|
||||||
|
@ -6420,6 +6420,14 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
*'termencoding'* *'tenc'*
|
*'termencoding'* *'tenc'*
|
||||||
'termencoding' 'tenc' Removed. |vim-differences| {Nvim}
|
'termencoding' 'tenc' Removed. |vim-differences| {Nvim}
|
||||||
|
|
||||||
|
*'termguicolors'* *'tgc'*
|
||||||
|
'termguicolors' 'tgc' boolean (default off)
|
||||||
|
global
|
||||||
|
When on, uses |highlight-guifg| and |highlight-guibg| attributes in
|
||||||
|
the terminal (thus using 24-bit color). Requires a ISO-8613-3
|
||||||
|
compatible terminal.
|
||||||
|
Must be set at startup (in your |init.vim| or |--cmd|).
|
||||||
|
|
||||||
*'terse'* *'noterse'*
|
*'terse'* *'noterse'*
|
||||||
'terse' boolean (default off)
|
'terse' boolean (default off)
|
||||||
global
|
global
|
||||||
|
@ -371,6 +371,7 @@ N *+tablineat* 'tabline' option recognizing %@Func@ items.
|
|||||||
N *+tag_binary* binary searching in tags file |tag-binary-search|
|
N *+tag_binary* binary searching in tags file |tag-binary-search|
|
||||||
N *+tag_old_static* old method for static tags |tag-old-static|
|
N *+tag_old_static* old method for static tags |tag-old-static|
|
||||||
m *+tag_any_white* any white space allowed in tags file |tag-any-white|
|
m *+tag_any_white* any white space allowed in tags file |tag-any-white|
|
||||||
|
B *+termguicolors* 24-bit color in xterm-compatible terminals support
|
||||||
*+terminfo* uses |terminfo| instead of termcap
|
*+terminfo* uses |terminfo| instead of termcap
|
||||||
N *+termresponse* support for |t_RV| and |v:termresponse|
|
N *+termresponse* support for |t_RV| and |v:termresponse|
|
||||||
N *+textobjects* |text-objects| selection
|
N *+textobjects* |text-objects| selection
|
||||||
|
@ -410,6 +410,10 @@ call append("$", "highlight\twhich highlighting to use for various occasions")
|
|||||||
call <SID>OptionG("hl", &hl)
|
call <SID>OptionG("hl", &hl)
|
||||||
call append("$", "hlsearch\thighlight all matches for the last used search pattern")
|
call append("$", "hlsearch\thighlight all matches for the last used search pattern")
|
||||||
call <SID>BinOptionG("hls", &hls)
|
call <SID>BinOptionG("hls", &hls)
|
||||||
|
if has("termguicolors")
|
||||||
|
call append("$", "termguicolors\tuse GUI colors for the terminal")
|
||||||
|
call <SID>BinOptionG("tgc", &tgc)
|
||||||
|
endif
|
||||||
if has("syntax")
|
if has("syntax")
|
||||||
call append("$", "cursorcolumn\thighlight the screen column of the cursor")
|
call append("$", "cursorcolumn\thighlight the screen column of the cursor")
|
||||||
call append("$", "\t(local to window)")
|
call append("$", "\t(local to window)")
|
||||||
|
@ -44,24 +44,24 @@ highlight default link dircolorsExtension Identifier
|
|||||||
highlight default link dircolorsEscape Special
|
highlight default link dircolorsEscape Special
|
||||||
|
|
||||||
function! s:set_guicolors() abort
|
function! s:set_guicolors() abort
|
||||||
let s:guicolors = {}
|
let s:termguicolors = {}
|
||||||
|
|
||||||
let s:guicolors[0] = "Black"
|
let s:termguicolors[0] = "Black"
|
||||||
let s:guicolors[1] = "DarkRed"
|
let s:termguicolors[1] = "DarkRed"
|
||||||
let s:guicolors[2] = "DarkGreen"
|
let s:termguicolors[2] = "DarkGreen"
|
||||||
let s:guicolors[3] = "DarkYellow"
|
let s:termguicolors[3] = "DarkYellow"
|
||||||
let s:guicolors[4] = "DarkBlue"
|
let s:termguicolors[4] = "DarkBlue"
|
||||||
let s:guicolors[5] = "DarkMagenta"
|
let s:termguicolors[5] = "DarkMagenta"
|
||||||
let s:guicolors[6] = "DarkCyan"
|
let s:termguicolors[6] = "DarkCyan"
|
||||||
let s:guicolors[7] = "Gray"
|
let s:termguicolors[7] = "Gray"
|
||||||
let s:guicolors[8] = "DarkGray"
|
let s:termguicolors[8] = "DarkGray"
|
||||||
let s:guicolors[9] = "Red"
|
let s:termguicolors[9] = "Red"
|
||||||
let s:guicolors[10] = "Green"
|
let s:termguicolors[10] = "Green"
|
||||||
let s:guicolors[11] = "Yellow"
|
let s:termguicolors[11] = "Yellow"
|
||||||
let s:guicolors[12] = "Blue"
|
let s:termguicolors[12] = "Blue"
|
||||||
let s:guicolors[13] = "Magenta"
|
let s:termguicolors[13] = "Magenta"
|
||||||
let s:guicolors[14] = "Cyan"
|
let s:termguicolors[14] = "Cyan"
|
||||||
let s:guicolors[15] = "White"
|
let s:termguicolors[15] = "White"
|
||||||
|
|
||||||
let xterm_palette = ["00", "5f", "87", "af", "d7", "ff"]
|
let xterm_palette = ["00", "5f", "87", "af", "d7", "ff"]
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ function! s:set_guicolors() abort
|
|||||||
for r in xterm_palette
|
for r in xterm_palette
|
||||||
for g in xterm_palette
|
for g in xterm_palette
|
||||||
for b 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
|
let cur_col += 1
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
@ -78,14 +78,14 @@ function! s:set_guicolors() abort
|
|||||||
|
|
||||||
for i in range(24)
|
for i in range(24)
|
||||||
let g = i * 0xa + 8
|
let g = i * 0xa + 8
|
||||||
let s:guicolors[i + 232] = '#' . g . g . g
|
let s:termguicolors[i + 232] = '#' . g . g . g
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:get_hi_str(color, place) abort
|
function! s:get_hi_str(color, place) abort
|
||||||
if a:color >= 0 && a:color <= 255
|
if a:color >= 0 && a:color <= 255
|
||||||
if has('gui_running')
|
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
|
elseif a:color <= 7 || &t_Co == 256 || &t_Co == 88
|
||||||
return ' cterm' . a:place . '=' . a:color
|
return ' cterm' . a:place . '=' . a:color
|
||||||
endif
|
endif
|
||||||
|
@ -10684,6 +10684,7 @@ static void f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
"tablineat",
|
"tablineat",
|
||||||
"tag_binary",
|
"tag_binary",
|
||||||
"tag_old_static",
|
"tag_old_static",
|
||||||
|
"termguicolors",
|
||||||
"termresponse",
|
"termresponse",
|
||||||
"textobjects",
|
"textobjects",
|
||||||
"title",
|
"title",
|
||||||
|
@ -619,6 +619,7 @@ EXTERN long p_titlelen; ///< 'titlelen'
|
|||||||
EXTERN char_u *p_titleold; ///< 'titleold'
|
EXTERN char_u *p_titleold; ///< 'titleold'
|
||||||
EXTERN char_u *p_titlestring; ///< 'titlestring'
|
EXTERN char_u *p_titlestring; ///< 'titlestring'
|
||||||
EXTERN char_u *p_tsr; ///< 'thesaurus'
|
EXTERN char_u *p_tsr; ///< 'thesaurus'
|
||||||
|
EXTERN bool p_tgc; ///< 'termguicolors'
|
||||||
EXTERN int p_ttimeout; ///< 'ttimeout'
|
EXTERN int p_ttimeout; ///< 'ttimeout'
|
||||||
EXTERN long p_ttm; ///< 'ttimeoutlen'
|
EXTERN long p_ttm; ///< 'ttimeoutlen'
|
||||||
EXTERN char_u *p_udir; ///< 'undodir'
|
EXTERN char_u *p_udir; ///< 'undodir'
|
||||||
|
@ -2382,6 +2382,14 @@ return {
|
|||||||
redraw={'everything'},
|
redraw={'everything'},
|
||||||
defaults={if_true={vi=""}}
|
defaults={if_true={vi=""}}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
full_name='termguicolors', abbreviation='tgc',
|
||||||
|
type='bool', scope={'global'},
|
||||||
|
vi_def=false,
|
||||||
|
redraw={'everything'},
|
||||||
|
varname='p_tgc',
|
||||||
|
defaults={if_true={vi=false}}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
full_name='terse',
|
full_name='terse',
|
||||||
type='bool', scope={'global'},
|
type='bool', scope={'global'},
|
||||||
|
@ -81,7 +81,7 @@ UI *tui_start(void)
|
|||||||
{
|
{
|
||||||
UI *ui = xcalloc(1, sizeof(UI));
|
UI *ui = xcalloc(1, sizeof(UI));
|
||||||
ui->stop = tui_stop;
|
ui->stop = tui_stop;
|
||||||
ui->rgb = os_getenv("NVIM_TUI_ENABLE_TRUE_COLOR") != NULL;
|
ui->rgb = p_tgc;
|
||||||
ui->resize = tui_resize;
|
ui->resize = tui_resize;
|
||||||
ui->clear = tui_clear;
|
ui->clear = tui_clear;
|
||||||
ui->eol_clear = tui_eol_clear;
|
ui->eol_clear = tui_eol_clear;
|
||||||
|
@ -69,6 +69,10 @@ static char *features[] = {
|
|||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
static int included_patches[] = {
|
static int included_patches[] = {
|
||||||
|
1809,
|
||||||
|
1808,
|
||||||
|
1806,
|
||||||
|
1799,
|
||||||
1757,
|
1757,
|
||||||
1755,
|
1755,
|
||||||
1753,
|
1753,
|
||||||
|
Loading…
Reference in New Issue
Block a user