feat(version): unverbose ":version", ":verbose version" #24195

Problem:
`nvim -v` and `:version` prints system vimrc, fallback files, and compilation
info by default, which most people don't care about and just clutters up the
output.

Solution:
Omit extra info unless 'verbose' is set.
This commit is contained in:
Justin M. Keyes
2023-07-01 03:45:45 -07:00
committed by GitHub
parent ba8f19ebb6
commit 43ded8d358
3 changed files with 44 additions and 21 deletions

View File

@@ -2700,33 +2700,39 @@ void list_version(void)
msg(longVersion);
msg(version_buildtype);
list_lua_version();
#ifndef NDEBUG
msg(version_cflags);
#endif
version_msg("\n\n");
if (p_verbose > 0) {
#ifndef NDEBUG
msg(version_cflags);
#endif
version_msg("\n\n");
#ifdef SYS_VIMRC_FILE
version_msg(_(" system vimrc file: \""));
version_msg(SYS_VIMRC_FILE);
version_msg("\"\n");
#endif // ifdef SYS_VIMRC_FILE
version_msg(_(" system vimrc file: \""));
version_msg(SYS_VIMRC_FILE);
version_msg("\"\n");
#endif
#ifdef HAVE_PATHDEF
if (*default_vim_dir != NUL) {
version_msg(_(" fall-back for $VIM: \""));
version_msg(default_vim_dir);
version_msg("\"\n");
}
if (*default_vim_dir != NUL) {
version_msg(_(" fall-back for $VIM: \""));
version_msg(default_vim_dir);
version_msg("\"\n");
if (*default_vimruntime_dir != NUL) {
version_msg(_(" f-b for $VIMRUNTIME: \""));
version_msg(default_vimruntime_dir);
version_msg("\"\n");
}
#endif
}
if (*default_vimruntime_dir != NUL) {
version_msg(_(" f-b for $VIMRUNTIME: \""));
version_msg(default_vimruntime_dir);
version_msg("\"\n");
}
#endif // ifdef HAVE_PATHDEF
version_msg("\nRun :checkhealth for more info");
version_msg(p_verbose > 0
? "\nRun :checkhealth for more info"
: (starting
? "\nRun \"nvim -V1 -v\" for more info"
: "\nRun \":verbose version\" for more info"));
}
/// Show the intro message when not editing a file.