mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
health: migrate to Lua #21661
* refactor: remove all vimscript from nvim/health * fixup: previous method broke if you had a folder named 'x-lua'
This commit is contained in:
parent
8a5dad44a7
commit
307efe4906
@ -1,6 +1,22 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
local health = require('vim.health')
|
local health = require('vim.health')
|
||||||
|
|
||||||
|
local fn_bool = function(key)
|
||||||
|
return function(...)
|
||||||
|
return vim.fn[key](...) == 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local has = fn_bool('has')
|
||||||
|
local executable = fn_bool('executable')
|
||||||
|
local empty = fn_bool('empty')
|
||||||
|
local filereadable = fn_bool('filereadable')
|
||||||
|
local filewritable = fn_bool('filewritable')
|
||||||
|
|
||||||
|
local shell_error = function()
|
||||||
|
return vim.v.shell_error ~= 0
|
||||||
|
end
|
||||||
|
|
||||||
local suggest_faq = 'https://github.com/neovim/neovim/wiki/Building-Neovim#optimized-builds'
|
local suggest_faq = 'https://github.com/neovim/neovim/wiki/Building-Neovim#optimized-builds'
|
||||||
|
|
||||||
local function check_runtime()
|
local function check_runtime()
|
||||||
@ -37,15 +53,6 @@ end
|
|||||||
local function check_config()
|
local function check_config()
|
||||||
health.report_start('Configuration')
|
health.report_start('Configuration')
|
||||||
local ok = true
|
local ok = true
|
||||||
local empty = function(o)
|
|
||||||
return 0 ~= vim.fn.empty(o)
|
|
||||||
end
|
|
||||||
local filereadable = function(o)
|
|
||||||
return 0 ~= vim.fn.filereadable(o)
|
|
||||||
end
|
|
||||||
local filewritable = function(o)
|
|
||||||
return 0 ~= vim.fn.filewritable(o)
|
|
||||||
end
|
|
||||||
|
|
||||||
local vimrc = (
|
local vimrc = (
|
||||||
empty(vim.env.MYVIMRC) and vim.fn.stdpath('config') .. '/init.vim' or vim.env.MYVIMRC
|
empty(vim.env.MYVIMRC) and vim.fn.stdpath('config') .. '/init.vim' or vim.env.MYVIMRC
|
||||||
@ -65,7 +72,7 @@ local function check_config()
|
|||||||
health.report_error('$VIM is invalid: ' .. vim.env.VIM)
|
health.report_error('$VIM is invalid: ' .. vim.env.VIM)
|
||||||
end
|
end
|
||||||
|
|
||||||
if 1 == vim.fn.exists('$NVIM_TUI_ENABLE_CURSOR_SHAPE') then
|
if vim.env.NVIM_TUI_ENABLE_CURSOR_SHAPE then
|
||||||
ok = false
|
ok = false
|
||||||
health.report_warn('$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+', {
|
health.report_warn('$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+', {
|
||||||
"Use the 'guicursor' option to configure cursor shape. :help 'guicursor'",
|
"Use the 'guicursor' option to configure cursor shape. :help 'guicursor'",
|
||||||
@ -139,240 +146,245 @@ local function check_config()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function check_performance()
|
local function check_performance()
|
||||||
vim.api.nvim_exec([=[
|
health.report_start('Performance')
|
||||||
func! s:check_performance() abort
|
|
||||||
let s:suggest_faq = ']=] .. suggest_faq .. [=['
|
|
||||||
|
|
||||||
call health#report_start('Performance')
|
-- Check buildtype
|
||||||
|
local buildtype = vim.fn.matchstr(vim.fn.execute('version'), [[\v\cbuild type:?\s*[^\n\r\t ]+]])
|
||||||
|
if empty(buildtype) then
|
||||||
|
health.report_error('failed to get build type from :version')
|
||||||
|
elseif vim.regex([[\v(MinSizeRel|Release|RelWithDebInfo)]]):match_str(buildtype) then
|
||||||
|
health.report_ok(buildtype)
|
||||||
|
else
|
||||||
|
health.report_info(buildtype)
|
||||||
|
health.report_warn(
|
||||||
|
'Non-optimized ' .. (has('debug') and '(DEBUG) ' or '') .. 'build. Nvim will be slower.',
|
||||||
|
{
|
||||||
|
'Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.',
|
||||||
|
suggest_faq,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
" check buildtype
|
-- check for slow shell invocation
|
||||||
let s:buildtype = matchstr(execute('version'), '\v\cbuild type:?\s*[^\n\r\t ]+')
|
local slow_cmd_time = 1.5
|
||||||
if empty(s:buildtype)
|
local start_time = vim.fn.reltime()
|
||||||
call health#report_error('failed to get build type from :version')
|
vim.fn.system('echo')
|
||||||
elseif s:buildtype =~# '\v(MinSizeRel|Release|RelWithDebInfo)'
|
local elapsed_time = vim.fn.reltimefloat(vim.fn.reltime(start_time))
|
||||||
call health#report_ok(s:buildtype)
|
if elapsed_time > slow_cmd_time then
|
||||||
else
|
health.report_warn(
|
||||||
call health#report_info(s:buildtype)
|
'Slow shell invocation (took ' .. vim.fn.printf('%.2f', elapsed_time) .. ' seconds).'
|
||||||
call health#report_warn(
|
)
|
||||||
\ 'Non-optimized '.(has('debug')?'(DEBUG) ':'').'build. Nvim will be slower.',
|
end
|
||||||
\ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.',
|
|
||||||
\ s:suggest_faq])
|
|
||||||
endif
|
|
||||||
|
|
||||||
" check for slow shell invocation
|
|
||||||
let s:slow_cmd_time = 1.5
|
|
||||||
let s:start_time = reltime()
|
|
||||||
call system('echo')
|
|
||||||
let s:elapsed_time = reltimefloat(reltime(s:start_time))
|
|
||||||
if s:elapsed_time > s:slow_cmd_time
|
|
||||||
call health#report_warn(
|
|
||||||
\ 'Slow shell invocation (took '.printf('%.2f', s:elapsed_time).' seconds).')
|
|
||||||
endif
|
|
||||||
endf
|
|
||||||
|
|
||||||
call s:check_performance()
|
|
||||||
]=], false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Load the remote plugin manifest file and check for unregistered plugins
|
-- Load the remote plugin manifest file and check for unregistered plugins
|
||||||
local function check_rplugin_manifest()
|
local function check_rplugin_manifest()
|
||||||
vim.api.nvim_exec(
|
health.report_start('Remote Plugins')
|
||||||
[=[
|
|
||||||
func! s:check_rplugin_manifest() abort
|
|
||||||
call health#report_start('Remote Plugins')
|
|
||||||
let existing_rplugins = {}
|
|
||||||
|
|
||||||
for item in remote#host#PluginsForHost('python')
|
local existing_rplugins = {}
|
||||||
let existing_rplugins[item.path] = 'python'
|
for _, item in ipairs(vim.fn['remote#host#PluginsForHost']('python')) do
|
||||||
endfor
|
existing_rplugins[item.path] = 'python'
|
||||||
|
end
|
||||||
|
|
||||||
for item in remote#host#PluginsForHost('python3')
|
for item in ipairs(vim.fn['remote#host#PluginsForHost']('python3')) do
|
||||||
let existing_rplugins[item.path] = 'python3'
|
existing_rplugins[item.path] = 'python3'
|
||||||
endfor
|
end
|
||||||
|
|
||||||
let require_update = 0
|
local require_update = false
|
||||||
|
local handle_path = function(path)
|
||||||
|
local python_glob = vim.fn.glob(path .. '/rplugin/python*', true, true)
|
||||||
|
if empty(python_glob) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
for path in map(split(&runtimepath, ','), 'resolve(v:val)')
|
local python_dir = python_glob[1]
|
||||||
let python_glob = glob(path.'/rplugin/python*', 1, 1)
|
local python_version = vim.fn.fnamemodify(python_dir, ':t')
|
||||||
if empty(python_glob)
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
let python_dir = python_glob[0]
|
local scripts = vim.fn.glob(python_dir .. '/*.py', true, true)
|
||||||
let python_version = fnamemodify(python_dir, ':t')
|
vim.list_extend(scripts, vim.fn.glob(python_dir .. '/*/__init__.py', true, true))
|
||||||
|
|
||||||
for script in glob(python_dir.'/*.py', 1, 1)
|
for script in ipairs(scripts) do
|
||||||
\ + glob(python_dir.'/*/__init__.py', 1, 1)
|
local contents = vim.fn.join(vim.fn.readfile(script))
|
||||||
let contents = join(readfile(script))
|
if vim.regex([[\<\%(from\|import\)\s\+neovim\>]]):match_str(contents) then
|
||||||
if contents =~# '\<\%(from\|import\)\s\+neovim\>'
|
if vim.regex([[[\/]__init__\.py$]]):match_str(script) then
|
||||||
if script =~# '[\/]__init__\.py$'
|
script = vim.fn.tr(vim.fn.fnamemodify(script, ':h'), '\\', '/')
|
||||||
let script = tr(fnamemodify(script, ':h'), '\', '/')
|
end
|
||||||
endif
|
if not existing_rplugins[script] then
|
||||||
|
local msg = vim.fn.printf('"%s" is not registered.', vim.fn.fnamemodify(path, ':t'))
|
||||||
|
if python_version == 'pythonx' then
|
||||||
|
if not has('python3') then
|
||||||
|
msg = msg .. ' (python3 not available)'
|
||||||
|
end
|
||||||
|
elseif not has(python_version) then
|
||||||
|
msg = msg .. vim.fn.printf(' (%s not available)', python_version)
|
||||||
|
else
|
||||||
|
require_update = true
|
||||||
|
end
|
||||||
|
|
||||||
if !has_key(existing_rplugins, script)
|
health.report_warn(msg)
|
||||||
let msg = printf('"%s" is not registered.', fnamemodify(path, ':t'))
|
end
|
||||||
if python_version ==# 'pythonx'
|
|
||||||
if !has('python3')
|
|
||||||
let msg .= ' (python3 not available)'
|
|
||||||
endif
|
|
||||||
elseif !has(python_version)
|
|
||||||
let msg .= printf(' (%s not available)', python_version)
|
|
||||||
else
|
|
||||||
let require_update = 1
|
|
||||||
endif
|
|
||||||
|
|
||||||
call health#report_warn(msg)
|
break
|
||||||
endif
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
break
|
for _, path in ipairs(vim.fn.map(vim.fn.split(vim.o.runtimepath, ','), 'resolve(v:val)')) do
|
||||||
endif
|
handle_path(path)
|
||||||
endfor
|
end
|
||||||
endfor
|
|
||||||
|
|
||||||
if require_update
|
if require_update then
|
||||||
call health#report_warn('Out of date', ['Run `:UpdateRemotePlugins`'])
|
health.report_warn('Out of date', { 'Run `:UpdateRemotePlugins`' })
|
||||||
else
|
else
|
||||||
call health#report_ok('Up to date')
|
health.report_ok('Up to date')
|
||||||
endif
|
end
|
||||||
endf
|
|
||||||
|
|
||||||
call s:check_rplugin_manifest()
|
|
||||||
]=],
|
|
||||||
false
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_tmux()
|
local function check_tmux()
|
||||||
vim.api.nvim_exec([=[
|
if empty(vim.env.TMUX) or not executable('tmux') then
|
||||||
let s:suggest_faq = ']=] .. suggest_faq .. [=['
|
return
|
||||||
|
end
|
||||||
|
|
||||||
func! s:get_tmux_option(option) abort
|
local get_tmux_option = function(option)
|
||||||
let cmd = 'tmux show-option -qvg '.a:option " try global scope
|
local cmd = 'tmux show-option -qvg ' .. option -- try global scope
|
||||||
let out = system(split(cmd))
|
local out = vim.fn.system(vim.fn.split(cmd))
|
||||||
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
local val = vim.fn.substitute(out, [[\v(\s|\r|\n)]], '', 'g')
|
||||||
if v:shell_error
|
if shell_error() then
|
||||||
call health#report_error('command failed: '.cmd."\n".out)
|
health.report_error('command failed: ' .. cmd .. '\n' .. out)
|
||||||
return 'error'
|
return 'error'
|
||||||
elseif empty(val)
|
elseif empty(val) then
|
||||||
let cmd = 'tmux show-option -qvgs '.a:option " try session scope
|
cmd = 'tmux show-option -qvgs ' .. option -- try session scope
|
||||||
let out = system(split(cmd))
|
out = vim.fn.system(vim.fn.split(cmd))
|
||||||
let val = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
val = vim.fn.substitute(out, [[\v(\s|\r|\n)]], '', 'g')
|
||||||
if v:shell_error
|
if shell_error() then
|
||||||
call health#report_error('command failed: '.cmd."\n".out)
|
health.report_error('command failed: ' .. cmd .. '\n' .. out)
|
||||||
return 'error'
|
return 'error'
|
||||||
endif
|
end
|
||||||
endif
|
end
|
||||||
return val
|
return val
|
||||||
endf
|
end
|
||||||
|
|
||||||
func! s:check_tmux() abort
|
health.report_start('tmux')
|
||||||
if empty($TMUX) || !executable('tmux')
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
call health#report_start('tmux')
|
|
||||||
|
|
||||||
" check escape-time
|
-- check escape-time
|
||||||
let suggestions = ["set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10",
|
local suggestions =
|
||||||
\ s:suggest_faq]
|
{ 'set escape-time in ~/.tmux.conf:\nset-option -sg escape-time 10', suggest_faq }
|
||||||
let tmux_esc_time = s:get_tmux_option('escape-time')
|
local tmux_esc_time = get_tmux_option('escape-time')
|
||||||
if tmux_esc_time !=# 'error'
|
if tmux_esc_time ~= 'error' then
|
||||||
if empty(tmux_esc_time)
|
if empty(tmux_esc_time) then
|
||||||
call health#report_error('`escape-time` is not set', suggestions)
|
health.report_error('`escape-time` is not set', suggestions)
|
||||||
elseif tmux_esc_time > 300
|
elseif tmux_esc_time > 300 then
|
||||||
call health#report_error(
|
health.report_error(
|
||||||
\ '`escape-time` ('.tmux_esc_time.') is higher than 300ms', suggestions)
|
'`escape-time` (' .. tmux_esc_time .. ') is higher than 300ms',
|
||||||
else
|
suggestions
|
||||||
call health#report_ok('escape-time: '.tmux_esc_time)
|
)
|
||||||
endif
|
else
|
||||||
endif
|
health.report_ok('escape-time: ' .. tmux_esc_time)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
" check focus-events
|
-- check focus-events
|
||||||
let suggestions = ["(tmux 1.9+ only) Set `focus-events` in ~/.tmux.conf:\nset-option -g focus-events on"]
|
local tmux_focus_events = get_tmux_option('focus-events')
|
||||||
let tmux_focus_events = s:get_tmux_option('focus-events')
|
if tmux_focus_events ~= 'error' then
|
||||||
if tmux_focus_events !=# 'error'
|
if empty(tmux_focus_events) or tmux_focus_events ~= 'on' then
|
||||||
if empty(tmux_focus_events) || tmux_focus_events !=# 'on'
|
health.report_warn(
|
||||||
call health#report_warn(
|
"`focus-events` is not enabled. |'autoread'| may not work.",
|
||||||
\ "`focus-events` is not enabled. |'autoread'| may not work.", suggestions)
|
{ '(tmux 1.9+ only) Set `focus-events` in ~/.tmux.conf:\nset-option -g focus-events on' }
|
||||||
else
|
)
|
||||||
call health#report_ok('focus-events: '.tmux_focus_events)
|
else
|
||||||
endif
|
health.report_ok('focus-events: ' .. tmux_focus_events)
|
||||||
endif
|
end
|
||||||
|
end
|
||||||
|
|
||||||
" check default-terminal and $TERM
|
-- check default-terminal and $TERM
|
||||||
call health#report_info('$TERM: '.$TERM)
|
health.report_info('$TERM: ' .. vim.env.TERM)
|
||||||
let cmd = 'tmux show-option -qvg default-terminal'
|
local cmd = 'tmux show-option -qvg default-terminal'
|
||||||
let out = system(split(cmd))
|
local out = vim.fn.system(vim.fn.split(cmd))
|
||||||
let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
local tmux_default_term = vim.fn.substitute(out, [[\v(\s|\r|\n)]], '', 'g')
|
||||||
if empty(tmux_default_term)
|
if empty(tmux_default_term) then
|
||||||
let cmd = 'tmux show-option -qvgs default-terminal'
|
cmd = 'tmux show-option -qvgs default-terminal'
|
||||||
let out = system(split(cmd))
|
out = vim.fn.system(vim.fn.split(cmd))
|
||||||
let tmux_default_term = substitute(out, '\v(\s|\r|\n)', '', 'g')
|
tmux_default_term = vim.fn.substitute(out, [[\v(\s|\r|\n)]], '', 'g')
|
||||||
endif
|
end
|
||||||
|
|
||||||
if v:shell_error
|
if shell_error() then
|
||||||
call health#report_error('command failed: '.cmd."\n".out)
|
health.report_error('command failed: ' .. cmd .. '\n' .. out)
|
||||||
elseif tmux_default_term !=# $TERM
|
elseif tmux_default_term ~= vim.env.TERM then
|
||||||
call health#report_info('default-terminal: '.tmux_default_term)
|
health.report_info('default-terminal: ' .. tmux_default_term)
|
||||||
call health#report_error(
|
health.report_error(
|
||||||
\ '$TERM differs from the tmux `default-terminal` setting. Colors might look wrong.',
|
'$TERM differs from the tmux `default-terminal` setting. Colors might look wrong.',
|
||||||
\ ['$TERM may have been set by some rc (.bashrc, .zshrc, ...).'])
|
{ '$TERM may have been set by some rc (.bashrc, .zshrc, ...).' }
|
||||||
elseif $TERM !~# '\v(tmux-256color|screen-256color)'
|
)
|
||||||
call health#report_error(
|
elseif not vim.regex([[\v(tmux-256color|screen-256color)]]):match_str(vim.env.TERM) then
|
||||||
\ '$TERM should be "screen-256color" or "tmux-256color" in tmux. Colors might look wrong.',
|
health.report_error(
|
||||||
\ ["Set default-terminal in ~/.tmux.conf:\nset-option -g default-terminal \"screen-256color\"",
|
'$TERM should be "screen-256color" or "tmux-256color" in tmux. Colors might look wrong.',
|
||||||
\ s:suggest_faq])
|
{
|
||||||
endif
|
'Set default-terminal in ~/.tmux.conf:\nset-option -g default-terminal "screen-256color"',
|
||||||
|
suggest_faq,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
" check for RGB capabilities
|
-- check for RGB capabilities
|
||||||
let info = system(['tmux', 'show-messages', '-JT'])
|
local info = vim.fn.system({ 'tmux', 'show-messages', '-JT' })
|
||||||
let has_tc = stridx(info, " Tc: (flag) true") != -1
|
local has_tc = vim.fn.stridx(info, ' Tc: (flag) true') ~= -1
|
||||||
let has_rgb = stridx(info, " RGB: (flag) true") != -1
|
local has_rgb = vim.fn.stridx(info, ' RGB: (flag) true') ~= -1
|
||||||
if !has_tc && !has_rgb
|
if not has_tc and not has_rgb then
|
||||||
call health#report_warn(
|
health.report_warn(
|
||||||
\ "Neither Tc nor RGB capability set. True colors are disabled. |'termguicolors'| won't work properly.",
|
"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-overrides ',XXX:RGB'",
|
{
|
||||||
\ "For older tmux versions use this instead:\nset-option -ga terminal-overrides ',XXX:Tc'"])
|
"Put this in your ~/.tmux.conf and replace XXX by your $TERM outside of tmux:\nset-option -sa terminal-overrides ',XXX:RGB'",
|
||||||
endif
|
"For older tmux versions use this instead:\nset-option -ga terminal-overrides ',XXX:Tc'",
|
||||||
endf
|
}
|
||||||
|
)
|
||||||
call s:check_tmux()
|
end
|
||||||
]=], false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function check_terminal()
|
local function check_terminal()
|
||||||
vim.api.nvim_exec(
|
if not executable('infocmp') then
|
||||||
[=[
|
return
|
||||||
func! s:check_terminal() abort
|
end
|
||||||
if !executable('infocmp')
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
call health#report_start('terminal')
|
|
||||||
let cmd = 'infocmp -L'
|
|
||||||
let out = system(split(cmd))
|
|
||||||
let kbs_entry = matchstr(out, 'key_backspace=[^,[:space:]]*')
|
|
||||||
let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*')
|
|
||||||
|
|
||||||
if v:shell_error
|
health.report_start('terminal')
|
||||||
\ && (!has('win32')
|
local cmd = 'infocmp -L'
|
||||||
\ || empty(matchstr(out,
|
local out = vim.fn.system(vim.fn.split(cmd))
|
||||||
\ 'infocmp: couldn''t open terminfo file .\+'
|
local kbs_entry = vim.fn.matchstr(out, 'key_backspace=[^,[:space:]]*')
|
||||||
\ ..'\%(conemu\|vtpcon\|win32con\)')))
|
local kdch1_entry = vim.fn.matchstr(out, 'key_dc=[^,[:space:]]*')
|
||||||
call health#report_error('command failed: '.cmd."\n".out)
|
|
||||||
else
|
|
||||||
call health#report_info(printf('key_backspace (kbs) terminfo entry: `%s`', (empty(kbs_entry) ? '? (not found)' : kbs_entry)))
|
|
||||||
call health#report_info(printf('key_dc (kdch1) terminfo entry: `%s`', (empty(kbs_entry) ? '? (not found)' : kdch1_entry)))
|
|
||||||
endif
|
|
||||||
for env_var in ['XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY']
|
|
||||||
if exists('$'.env_var)
|
|
||||||
call health#report_info(printf('$%s="%s"', env_var, eval('$'.env_var)))
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endf
|
|
||||||
|
|
||||||
call s:check_terminal()
|
if
|
||||||
]=],
|
shell_error()
|
||||||
false
|
and (
|
||||||
)
|
not has('win32')
|
||||||
|
or empty(
|
||||||
|
vim.fn.matchstr(
|
||||||
|
out,
|
||||||
|
[[infocmp: couldn't open terminfo file .\+\%(conemu\|vtpcon\|win32con\)]]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
then
|
||||||
|
health.report_error('command failed: ' .. cmd .. '\n' .. out)
|
||||||
|
else
|
||||||
|
health.report_info(
|
||||||
|
vim.fn.printf(
|
||||||
|
'key_backspace (kbs) terminfo entry: `%s`',
|
||||||
|
(empty(kbs_entry) and '? (not found)' or kbs_entry)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
health.report_info(
|
||||||
|
vim.fn.printf(
|
||||||
|
'key_dc (kdch1) terminfo entry: `%s`',
|
||||||
|
(empty(kbs_entry) and '? (not found)' or kdch1_entry)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
for env_var in ipairs({ 'XTERM_VERSION', 'VTE_VERSION', 'TERM_PROGRAM', 'COLORTERM', 'SSH_TTY' }) do
|
||||||
|
if vim.env[env_var] then
|
||||||
|
health.report_info(vim.fn.printf('$%s="%s"', env_var, vim.env[env_var]))
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.check()
|
function M.check()
|
||||||
|
@ -23,7 +23,20 @@ end
|
|||||||
local path2name = function(path)
|
local path2name = function(path)
|
||||||
if path:match('%.lua$') then
|
if path:match('%.lua$') then
|
||||||
-- Lua: transform "../lua/vim/lsp/health.lua" into "vim.lsp"
|
-- Lua: transform "../lua/vim/lsp/health.lua" into "vim.lsp"
|
||||||
return path:gsub('.-lua[%\\%/]', '', 1):gsub('[%\\%/]', '.'):gsub('%.health.-$', '')
|
|
||||||
|
-- Get full path, make sure all slashes are '/'
|
||||||
|
path = vim.fs.normalize(path)
|
||||||
|
|
||||||
|
-- Remove everything up to the last /lua/ folder
|
||||||
|
path = path:gsub('^.*/lua/', '')
|
||||||
|
|
||||||
|
-- Remove the filename (health.lua)
|
||||||
|
path = vim.fn.fnamemodify(path, ':h')
|
||||||
|
|
||||||
|
-- Change slashes to dots
|
||||||
|
path = path:gsub('/', '.')
|
||||||
|
|
||||||
|
return path
|
||||||
else
|
else
|
||||||
-- Vim: transform "../autoload/health/provider.vim" into "provider"
|
-- Vim: transform "../autoload/health/provider.vim" into "provider"
|
||||||
return vim.fn.fnamemodify(path, ':t:r')
|
return vim.fn.fnamemodify(path, ':t:r')
|
||||||
|
Loading…
Reference in New Issue
Block a user