From b2967a0320ec327d1271bb75d96156a5ff1c8758 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 5 Aug 2017 23:53:48 +0200 Subject: [PATCH] nvim -h: omit special-case options Group some options, and sort them alphabetically. `nvim -h` should fit on one (smallish) screen. Uncommon options don't need to be here, they live in the :help. --- src/nvim/main.c | 79 ++++++++++++++----------------- src/nvim/testdir/test_startup.vim | 6 +-- 2 files changed, 39 insertions(+), 46 deletions(-) diff --git a/src/nvim/main.c b/src/nvim/main.c index 3f828d7be9..a665ad1de2 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1878,54 +1878,47 @@ static void usage(void) signal_stop(); // kill us with CTRL-C here, if you like mch_msg(_("Usage:\n")); - mch_msg(_(" nvim [arguments] [file ...] Edit specified file(s)\n")); - mch_msg(_(" nvim [arguments] - Read text from stdin\n")); - mch_msg(_(" nvim [arguments] -t Edit file where tag is defined\n")); - mch_msg(_(" nvim [arguments] -q [errorfile] Edit file with first error\n")); - mch_msg(_("\nArguments:\n")); + mch_msg(_(" nvim [options] [file ...] Edit file(s)\n")); + mch_msg(_(" nvim [options] - Read text from stdin\n")); + mch_msg(_(" nvim [options] -t Edit file where tag is defined\n")); + mch_msg(_(" nvim [options] -q [errorfile] Edit file with first error\n")); + mch_msg(_("\nOptions:\n")); mch_msg(_(" -- Only file names after this\n")); + mch_msg(_(" + Start at end of file\n")); + mch_msg(_(" --cmd Execute before any config\n")); + mch_msg(_(" +, -c Execute after config and first file\n")); + mch_msg("\n"); + mch_msg(_(" -b Binary mode\n")); + mch_msg(_(" -d Diff mode\n")); + mch_msg(_(" -e, -E Ex mode, Improved Ex mode\n")); + mch_msg(_(" -es Silent (batch) mode\n")); + mch_msg(_(" -h, --help Print this help message\n")); + mch_msg(_(" -i Use this shada file\n")); + mch_msg(_(" -m Modifications (writing files) not allowed\n")); + mch_msg(_(" -M Modifications in text not allowed\n")); + mch_msg(_(" -n No swap file, use memory only\n")); + mch_msg(_(" -o[N] Open N windows (default: one per file)\n")); + mch_msg(_(" -O[N] Open N vertical windows (default: one per file)\n")); + mch_msg(_(" -p[N] Open N tab pages (default: one per file)\n")); + mch_msg(_(" -r, -L List swap files\n")); + mch_msg(_(" -r Recover edit state for this file\n")); + mch_msg(_(" -R Read-only mode\n")); + mch_msg(_(" -S Source after loading the first file\n")); + mch_msg(_(" -s Read Normal mode commands from \n")); + mch_msg(_(" -u Use this config file\n")); + mch_msg(_(" -v, --version Print version information\n")); + mch_msg(_(" -V[N][file] Verbose [level][file]\n")); + mch_msg(_(" -Z Restricted mode\n")); + mch_msg("\n"); + mch_msg(_(" --api-info Write msgpack-encoded API metadata to stdout\n")); + mch_msg(_(" --embed Use stdin/stdout as a msgpack-rpc channel\n")); + mch_msg(_(" --headless Don't start a user interface\n")); #if !defined(UNIX) mch_msg(_(" --literal Don't expand wildcards\n")); #endif - mch_msg(_(" -e Ex mode\n")); - mch_msg(_(" -E Improved Ex mode\n")); - mch_msg(_(" -s Silent (batch) mode (only for ex mode)\n")); - mch_msg(_(" -d Diff mode\n")); - mch_msg(_(" -R Read-only mode\n")); - mch_msg(_(" -Z Restricted mode\n")); - mch_msg(_(" -m Modifications (writing files) not allowed\n")); - mch_msg(_(" -M Modifications in text not allowed\n")); - mch_msg(_(" -b Binary mode\n")); - mch_msg(_(" -l Lisp mode\n")); - mch_msg(_(" -A Arabic mode\n")); - mch_msg(_(" -F Farsi mode\n")); - mch_msg(_(" -H Hebrew mode\n")); - mch_msg(_(" -V[N][file] Be verbose [level N][log messages to file]\n")); - mch_msg(_(" -D Debugging mode\n")); - mch_msg(_(" -n No swap file, use memory only\n")); - mch_msg(_(" -r, -L List swap files and exit\n")); - mch_msg(_(" -r Recover crashed session\n")); - mch_msg(_(" -u Use instead of the default\n")); - mch_msg(_(" -i Use instead of the default\n")); - mch_msg(_(" --noplugin Don't load plugin scripts\n")); - mch_msg(_(" -o[N] Open N windows (default: one for each file)\n")); - mch_msg(_(" -O[N] Like -o but split vertically\n")); - mch_msg(_(" -p[N] Open N tab pages (default: one for each file)\n")); - mch_msg(_(" + Start at end of file\n")); - mch_msg(_(" + Start at line \n")); - mch_msg(_(" +/ Start at first occurrence of \n")); - mch_msg(_(" --cmd Execute before loading any vimrc\n")); - mch_msg(_(" -c Execute after loading the first file\n")); - mch_msg(_(" -S Source after loading the first file\n")); - mch_msg(_(" -s Read Normal mode commands from \n")); - mch_msg(_(" -w Append all typed characters to \n")); - mch_msg(_(" -W Write all typed characters to \n")); + mch_msg(_(" --noplugin Don't load plugins\n")); mch_msg(_(" --startuptime Write startup timing messages to \n")); - mch_msg(_(" --api-info Dump API metadata serialized to msgpack and exit\n")); - mch_msg(_(" --embed Use stdin/stdout as a msgpack-rpc channel\n")); - mch_msg(_(" --headless Don't start a user interface\n")); - mch_msg(_(" -v, --version Print version information and exit\n")); - mch_msg(_(" -h, --help Print this help message and exit\n")); + mch_msg(_("\nSee \":help startup-options\" for all options.\n")); } diff --git a/src/nvim/testdir/test_startup.vim b/src/nvim/testdir/test_startup.vim index 64f7f31294..5a38178bd5 100644 --- a/src/nvim/testdir/test_startup.vim +++ b/src/nvim/testdir/test_startup.vim @@ -76,11 +76,11 @@ func Test_help_arg() let found = [] for line in lines if line =~ '-R.*Read-only mode' - call add(found, 'Readonly mode') + call add(found, 'Readonly mode') endif " Watch out for a second --version line in the Gnome version. - if line =~ '--version.*Print version information and exit' - call add(found, "--version") + if line =~ '--version.*Print version information' + call add(found, "--version") endif endfor call assert_equal(['Readonly mode', '--version'], found)