diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-10-17 22:43:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-17 22:43:46 +0200 |
commit | 0cba3da26e4612c0c8fd17dd0638d76e2dc5fae0 (patch) | |
tree | 7ffd57e014e837bd31d51e81754d92094e86de22 /src | |
parent | 9467c8e16ee1fc04a9586e175fde371475c87e16 (diff) | |
parent | 3bcee71cc8ef782fc89de7d72cb784cfb6d984d3 (diff) | |
download | rneovim-0cba3da26e4612c0c8fd17dd0638d76e2dc5fae0.tar.gz rneovim-0cba3da26e4612c0c8fd17dd0638d76e2dc5fae0.tar.bz2 rneovim-0cba3da26e4612c0c8fd17dd0638d76e2dc5fae0.zip |
Merge #7399 ':checkhealth (built-in)'
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/eval.c | 29 | ||||
-rw-r--r-- | src/nvim/ex_cmds.lua | 6 | ||||
-rw-r--r-- | src/nvim/ops.c | 2 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
4 files changed, 37 insertions, 2 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index b2a0d9a767..aab777955c 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -22850,3 +22850,32 @@ void eval_format_source_name_line(char *buf, size_t bufsize) (sourcing_name ? sourcing_name : (char_u *)"?"), (sourcing_name ? sourcing_lnum : 0)); } + +/// ":checkhealth [plugins]" +void ex_checkhealth(exarg_T *eap) +{ + bool found = !!find_func((char_u *)"health#check"); + if (!found + && script_autoload("health#check", sizeof("health#check") - 1, false)) { + found = !!find_func((char_u *)"health#check"); + } + if (!found) { + const char *vimruntime_env = os_getenv("VIMRUNTIME"); + if (vimruntime_env == NULL) { + EMSG(_("E5009: $VIMRUNTIME is empty or unset")); + return; + } else { + EMSG2(_("E5009: Invalid $VIMRUNTIME: %s"), os_getenv("VIMRUNTIME")); + return; + } + } + + size_t bufsize = STRLEN(eap->arg) + sizeof("call health#check('')"); + char *buf = xmalloc(bufsize); + snprintf(buf, bufsize, "call health#check('%s')", eap->arg); + + do_cmdline_cmd(buf); + + xfree(buf); +} + diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index 5a578cd088..f99954db7a 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -451,6 +451,12 @@ return { func='ex_changes', }, { + command='checkhealth', + flags=bit.bor(EXTRA, TRLBAR), + addr_type=ADDR_LINES, + func='ex_checkhealth', + }, + { command='checkpath', flags=bit.bor(TRLBAR, BANG, CMDWIN), addr_type=ADDR_LINES, diff --git a/src/nvim/ops.c b/src/nvim/ops.c index e7bc20698b..c6df71ea46 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -5535,7 +5535,7 @@ int get_default_register_name(void) static yankreg_T *adjust_clipboard_name(int *name, bool quiet, bool writing) { #define MSG_NO_CLIP "clipboard: No provider. " \ - "Try \":CheckHealth\" or \":h clipboard\"." + "Try \":checkhealth\" or \":h clipboard\"." yankreg_T *target = NULL; bool explicit_cb_reg = (*name == '*' || *name == '+'); diff --git a/src/nvim/version.c b/src/nvim/version.c index 7f1a219322..a696c64632 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -1365,7 +1365,7 @@ void intro_message(int colon) N_("https://neovim.io/community"), "", N_("type :help nvim<Enter> if you are new! "), - N_("type :CheckHealth<Enter> to optimize Nvim"), + N_("type :checkhealth<Enter> to optimize Nvim"), N_("type :q<Enter> to exit "), N_("type :help<Enter> for help "), "", |