1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 18:37:58 +01:00

Add a -description option to :command.

This commit is contained in:
Doug Kearns
2009-06-04 14:28:32 +10:00
parent 4df596d969
commit e762b6f9d4
4 changed files with 21 additions and 6 deletions

View File

@@ -1018,10 +1018,11 @@ function Commands() //{{{
if (args.literalArg) if (args.literalArg)
{ {
let nargsOpt = args["-nargs"] || "0"; let nargsOpt = args["-nargs"] || "0";
let bangOpt = "-bang" in args; let bangOpt = "-bang" in args;
let countOpt = "-count" in args; let countOpt = "-count" in args;
let completeOpt = args["-complete"]; let descriptionOpt = args["-description"] || "User-defined command";
let completeOpt = args["-complete"];
let completeFunc = null; // default to no completion for user commands let completeFunc = null; // default to no completion for user commands
@@ -1054,7 +1055,7 @@ function Commands() //{{{
} }
let added = commands.addUserCommand([cmd], let added = commands.addUserCommand([cmd],
"User defined command", descriptionOpt,
userCommand, userCommand,
{ {
argCount: nargsOpt, argCount: nargsOpt,
@@ -1106,6 +1107,7 @@ function Commands() //{{{
function (arg) /^[01*?+]$/.test(arg), ["0", "1", "*", "?", "+"]], function (arg) /^[01*?+]$/.test(arg), ["0", "1", "*", "?", "+"]],
[["-bang"], self.OPTION_NOARG], [["-bang"], self.OPTION_NOARG],
[["-count"], self.OPTION_NOARG], [["-count"], self.OPTION_NOARG],
[["-description"], self.OPTION_STRING],
// TODO: "E180: invalid complete value: " + arg // TODO: "E180: invalid complete value: " + arg
[["-complete"], self.OPTION_STRING, [["-complete"], self.OPTION_STRING,
function (arg) arg in completeOptionMap || /custom,\w+/.test(arg), function (arg) arg in completeOptionMap || /custom,\w+/.test(arg),

View File

@@ -2,9 +2,10 @@
* version 2.2a1pre * version 2.2a1pre
* IMPORTANT: shifted key notation now matches Vim's behaviour. E.g. <C-a> * IMPORTANT: shifted key notation now matches Vim's behaviour. E.g. <C-a>
and <C-A> are equivalent, to map the uppercase character use <C-S-A>. and <C-A> are equivalent, to map the uppercase character use <C-S-A>.
* add -description option to :command
* command-line options are now supported via the host application's * command-line options are now supported via the host application's
-liberator option -liberator option
* add :i and :I for opening image location (in new tab) * add ;i and ;I for opening image location (in new tab)
* add all.html to show all help sections in a single page - available via * add all.html to show all help sections in a single page - available via
:help all :help all
* add ;c extended hint mode - open the context menu * add ;c extended hint mode - open the context menu

View File

@@ -375,6 +375,12 @@ By default a user command does not have a special version, i.e. a version
executed with the ! modifier. Providing the -bang attribute will enable this executed with the ! modifier. Providing the -bang attribute will enable this
and <bang> will be available in the argument. and <bang> will be available in the argument.
|:command-description| +
Command description
The command's description text can be set with -description. Otherwise it will
default to "User-defined command".
|:command-replacement-text| + |:command-replacement-text| +
Replacement text Replacement text

View File

@@ -375,6 +375,12 @@ By default a user command does not have a special version, i.e. a version
executed with the ! modifier. Providing the -bang attribute will enable this executed with the ! modifier. Providing the -bang attribute will enable this
and <bang> will be available in the argument. and <bang> will be available in the argument.
|:command-description| +
Command description
The command's description text can be set with -description. Otherwise it will
default to "User-defined command".
|:command-replacement-text| + |:command-replacement-text| +
Replacement text Replacement text