mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
tmux indicates its RGB support via setrgbb and setrgbf. In modern tmux code, Tc and RGB just set setrgbb and setrgbf, so we can just check for them. Link:7eb496c00c
(cherry picked from commit88eb0ad149
) Co-authored-by: Tristan Partin <tristan@partin.io>
This commit is contained in:
parent
ea3966aac9
commit
b587aff176
@ -327,24 +327,17 @@ local function check_tmux()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- check for RGB capabilities
|
-- check for RGB capabilities
|
||||||
local info = vim.fn.system({ 'tmux', 'display-message', '-p', '#{client_termfeatures}' })
|
local info = vim.fn.system({ 'tmux', 'show-messages', '-T' })
|
||||||
info = vim.split(vim.trim(info), ',', { trimempty = true })
|
local has_setrgbb = vim.fn.stridx(info, ' setrgbb: (string)') ~= -1
|
||||||
if not vim.tbl_contains(info, 'RGB') then
|
local has_setrgbf = vim.fn.stridx(info, ' setrgbf: (string)') ~= -1
|
||||||
local has_rgb = false
|
if not has_setrgbb or not has_setrgbf then
|
||||||
if #info == 0 then
|
health.warn(
|
||||||
-- client_termfeatures may not be supported; fallback to checking show-messages
|
"True color support could not be detected. |'termguicolors'| won't work properly.",
|
||||||
info = vim.fn.system({ 'tmux', 'show-messages', '-JT' })
|
{
|
||||||
has_rgb = info:find(' Tc: (flag) true', 1, true) or info:find(' RGB: (flag) true', 1, true)
|
"Add the following to your tmux configuration file, replacing XXX by the value of $TERM outside of tmux:\nset-option -a terminal-features 'XXX:RGB'",
|
||||||
end
|
"For older tmux versions use this instead:\nset-option -a terminal-overrides 'XXX:Tc'",
|
||||||
if not has_rgb then
|
}
|
||||||
health.report_warn(
|
)
|
||||||
"Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.",
|
|
||||||
{
|
|
||||||
"Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:\nset-option -sa terminal-features ',XXX:RGB'",
|
|
||||||
"For older tmux versions use this instead:\nset-option -ga terminal-overrides ',XXX:Tc'",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user