Merge #7399 ':checkhealth (built-in)'

This commit is contained in:
Justin M. Keyes
2017-10-17 22:43:46 +02:00
committed by GitHub
14 changed files with 154 additions and 111 deletions

View File

@@ -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);
}

View File

@@ -450,6 +450,12 @@ return {
addr_type=ADDR_LINES,
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),

View File

@@ -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 == '+');

View File

@@ -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 "),
"",