mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #21839 from seandewar/lua-health-fix
feat(health): detect tmux RGB support via `client_termfeatures`
This commit is contained in:
commit
1484995a1e
@ -273,7 +273,7 @@ local function check_tmux()
|
|||||||
if tmux_esc_time ~= 'error' then
|
if tmux_esc_time ~= 'error' then
|
||||||
if empty(tmux_esc_time) then
|
if empty(tmux_esc_time) then
|
||||||
health.report_error('`escape-time` is not set', suggestions)
|
health.report_error('`escape-time` is not set', suggestions)
|
||||||
elseif tmux_esc_time > 300 then
|
elseif tonumber(tmux_esc_time) > 300 then
|
||||||
health.report_error(
|
health.report_error(
|
||||||
'`escape-time` (' .. tmux_esc_time .. ') is higher than 300ms',
|
'`escape-time` (' .. tmux_esc_time .. ') is higher than 300ms',
|
||||||
suggestions
|
suggestions
|
||||||
@ -326,17 +326,24 @@ local function check_tmux()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- check for RGB capabilities
|
-- check for RGB capabilities
|
||||||
local info = vim.fn.system({ 'tmux', 'show-messages', '-JT' })
|
local info = vim.fn.system({ 'tmux', 'display-message', '-p', '#{client_termfeatures}' })
|
||||||
local has_tc = vim.fn.stridx(info, ' Tc: (flag) true') ~= -1
|
info = vim.split(vim.trim(info), ',', { trimempty = true })
|
||||||
local has_rgb = vim.fn.stridx(info, ' RGB: (flag) true') ~= -1
|
if not vim.tbl_contains(info, 'RGB') then
|
||||||
if not has_tc and not has_rgb then
|
local has_rgb = false
|
||||||
health.report_warn(
|
if #info == 0 then
|
||||||
"Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.",
|
-- client_termfeatures may not be supported; fallback to checking show-messages
|
||||||
{
|
info = vim.fn.system({ 'tmux', 'show-messages', '-JT' })
|
||||||
"Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:\nset-option -sa terminal-overrides ',XXX:RGB'",
|
has_rgb = info:find(' Tc: (flag) true', 1, true) or info:find(' RGB: (flag) true', 1, true)
|
||||||
"For older tmux versions use this instead:\nset-option -ga terminal-overrides ',XXX:Tc'",
|
end
|
||||||
}
|
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