mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 20:55:18 -07:00
fix: checkhealth warning even if init.lua exists #25306
Problem: `:checkhealth nvim` warns about missing vimrc if `init.lua` exists but `init.vim` does not. Solution: Check for any of: init.vim, init.lua, $MYVIMRC. Fix #25291 Backport of https://github.com/neovim/neovim/pull/25306
This commit is contained in:
parent
3a535ff496
commit
ea3966aac9
@ -54,15 +54,19 @@ local function check_config()
|
|||||||
health.report_start('Configuration')
|
health.report_start('Configuration')
|
||||||
local ok = true
|
local ok = true
|
||||||
|
|
||||||
local vimrc = (
|
local init_lua = vim.fn.stdpath('config') .. '/init.lua'
|
||||||
empty(vim.env.MYVIMRC) and vim.fn.stdpath('config') .. '/init.vim' or vim.env.MYVIMRC
|
local init_vim = vim.fn.stdpath('config') .. '/init.vim'
|
||||||
)
|
local vimrc = empty(vim.env.MYVIMRC) and init_lua or vim.env.MYVIMRC
|
||||||
if not filereadable(vimrc) then
|
|
||||||
|
if not filereadable(vimrc) and not filereadable(init_vim) then
|
||||||
ok = false
|
ok = false
|
||||||
local has_vim = filereadable(vim.fn.expand('~/.vimrc'))
|
local has_vim = filereadable(vim.fn.expand('~/.vimrc'))
|
||||||
health.report_warn(
|
health.report_warn(
|
||||||
(-1 == vim.fn.getfsize(vimrc) and 'Missing' or 'Unreadable') .. ' user config file: ' .. vimrc,
|
('%s user config file: %s'):format(
|
||||||
{ has_vim and ':help nvim-from-vim' or ':help init.vim' }
|
-1 == vim.fn.getfsize(vimrc) and 'Missing' or 'Unreadable',
|
||||||
|
vimrc
|
||||||
|
),
|
||||||
|
{ has_vim and ':help nvim-from-vim' or ':help config' }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user