From 7cd9f28279a20decfb1cd3a54ef7c98776c2fd80 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Sat, 4 Oct 2008 16:45:16 +0000 Subject: [PATCH] add :optionusage command --- NEWS | 1 + content/liberator.js | 28 ++++++++++++++++++++++++++++ content/options.js | 5 +++-- locale/en-US/various.txt | 16 ++++++++++++---- 4 files changed, 44 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index b5b4443a..c8a4780a 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ special versions for the old behavior * IMPORTANT: renamed Startup and Quit autocmd events to VimperatorEnter and VimperatorLeave respectively + * add :optionusage * add :doautocmd and :doautoall * add :style and :delstyle commands * add DOMLoad autocmd event diff --git a/content/liberator.js b/content/liberator.js index 079af1dd..c6fe3d06 100644 --- a/content/liberator.js +++ b/content/liberator.js @@ -349,6 +349,34 @@ const liberator = (function () //{{{ bangAllowed: true }); + liberator.commands.add(["optionu[sage]"], + "List all options with a short description", + function (args, special) + { + if (!special) + { + liberator.help("option-index"); + } + else + { + // TODO: clicking on these should open the help + var usage = + { + liberator.template.map(liberator.options, function (option) + + + + ) + } +
{option.name}{option.description}
; + liberator.echo(usage, liberator.commandline.FORCE_MULTILINE); + } + }, + { + argCount: "0", + bangAllowed: true + }); + liberator.commands.add(["q[uit]"], liberator.has("tabs") ? "Quit current tab" : "Quit application", function (args, special) diff --git a/content/options.js b/content/options.js index 3effef7b..a4e63691 100644 --- a/content/options.js +++ b/content/options.js @@ -862,8 +862,9 @@ liberator.Options = function () //{{{ __iterator__: function () { - for (let i = 0; i < options.length; i++) - yield options[i]; + let sorted = options.sort(function (opt1, opt2) opt1.name > opt2.name); + for (let i = 0; i < sorted.length; i++) + yield sorted[i]; }, add: function (names, description, type, defaultValue, extraInfo) diff --git a/locale/en-US/various.txt b/locale/en-US/various.txt index 259f66f7..846446f8 100644 --- a/locale/en-US/various.txt +++ b/locale/en-US/various.txt @@ -60,16 +60,24 @@ ____________________________________________________________________________ |:exu| |:exusage| + ||:exu[sage][!]|| ________________________________________________________________________________ -Show help on Ex commands. Added to simulate the Nvi command. If [!] is given -then the help is listed in the command output window. +Show help on Ex commands. If [!] is given then the help is listed in the +command output window. +________________________________________________________________________________ + + +|:optionu| |:optionusage| + +||:optionu[sage][!]|| +________________________________________________________________________________ +Show help on options. If [!] is given then the help is listed in the command +output window. ________________________________________________________________________________ |:viu| |:viusage| + ||:viu[sage][!]|| ________________________________________________________________________________ -Show help on Normal mode commands. Added to simulate the Nvi command. If [!] is -given then the help is listed in the command output window. +Show help on Normal mode commands. If [!] is given then the help is listed in +the command output window. ________________________________________________________________________________