aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/health/nvim.vim7
-rw-r--r--test/functional/plugin/health_spec.lua14
2 files changed, 14 insertions, 7 deletions
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index 6c6a5e8543..7f6e943dc9 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -4,12 +4,19 @@ function! s:check_config() abort
let ok = v:true
call health#report_start('Configuration')
+ " If $VIM is empty we don't care. Else make sure it is valid.
+ if !empty($VIM) && !filereadable($VIM.'/runtime/doc/nvim.txt')
+ let ok = v:false
+ call health#report_error("$VIM is invalid: ".$VIM)
+ endif
+
if exists('$NVIM_TUI_ENABLE_CURSOR_SHAPE')
let ok = v:false
call health#report_warn("$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+",
\ [ "Use the 'guicursor' option to configure cursor shape. :help 'guicursor'",
\ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ])
endif
+
if &paste
let ok = v:false
call health#report_error("'paste' is enabled. This option is only for pasting text.\nIt should not be set in your config.",
diff --git a/test/functional/plugin/health_spec.lua b/test/functional/plugin/health_spec.lua
index a91c0b401b..b5374210e6 100644
--- a/test/functional/plugin/health_spec.lua
+++ b/test/functional/plugin/health_spec.lua
@@ -3,6 +3,7 @@ local Screen = require('test.functional.ui.screen')
local plugin_helpers = require('test.functional.plugin.helpers')
local clear = helpers.clear
+local curbuf_contents = helpers.curbuf_contents
local command = helpers.command
local eq = helpers.eq
@@ -16,13 +17,12 @@ describe(':checkhealth', function()
eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*'))
end)
it("detects invalid $VIM", function()
- clear({
- env={ VIM='bogus', },
- })
- local status, err = pcall(command, 'checkhealth')
- eq(false, status)
- -- Invalid $VIM causes $VIMRUNTIME to be broken.
- eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*'))
+ clear()
+ -- Do this after startup, otherwise it just breaks $VIMRUNTIME.
+ command("let $VIM='zub'")
+ command("checkhealth nvim")
+ eq("ERROR: $VIM is invalid: zub",
+ string.match(curbuf_contents(), "ERROR: $VIM .* zub"))
end)
end)