mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-03-12 12:05:46 +01:00
Document the :command improvements added in the previous changeset.
This commit is contained in:
@@ -556,7 +556,7 @@
|
|||||||
</item>
|
</item>
|
||||||
|
|
||||||
<item>
|
<item>
|
||||||
<spec>:com<oa>mand</oa><oa>!</oa> <oa><a>attr</a>…</oa> <a>cmd</a> <a>rep</a></spec>
|
<spec>:com<oa>mand</oa><oa>!</oa> <oa><a>options</a>…</oa> <a>cmd</a> <a>rep</a></spec>
|
||||||
<description>
|
<description>
|
||||||
<p>
|
<p>
|
||||||
Define a new user command. The name of the command is
|
Define a new user command. The name of the command is
|
||||||
@@ -564,7 +564,8 @@
|
|||||||
command with this name already exists, an error is
|
command with this name already exists, an error is
|
||||||
reported unless <oa>!</oa> is specified, in which case
|
reported unless <oa>!</oa> is specified, in which case
|
||||||
the command is redefined. Unlike Vim, the command may
|
the command is redefined. Unlike Vim, the command may
|
||||||
start with a lowercase letter.
|
start with a lowercase letter. <a>cmd</a> may also be multiple
|
||||||
|
alternative command names separated by commas.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -582,14 +583,14 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
The command's behavior can be altered by providing
|
The command's behavior can be altered by providing
|
||||||
attributes when the command is defined.
|
options when the command is defined.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3 tag="E175 E176 :command-nargs">Argument handling</h3>
|
<h3 tag="E175 E176 :command-nargs">Argument handling</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
By default, user commands accept no arguments. This can be changed by specifying
|
By default, user commands accept no arguments. This can be changed by specifying
|
||||||
the -nargs attribute.
|
the -nargs option.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>The valid values are:</p>
|
<p>The valid values are:</p>
|
||||||
@@ -615,11 +616,15 @@
|
|||||||
<h3 tag="E467 E468 :command-completion-custom">Custom completion</h3>
|
<h3 tag="E467 E468 :command-completion-custom">Custom completion</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Custom completion can be provided by specifying the <str>custom,<a>func</a></str> argument to
|
Custom completion can be provided by specifying the
|
||||||
-complete. The <a>func</a> is called with two arguments, a completion context, and
|
<str>custom,<a>thing</a></str> argument to -complete. If
|
||||||
an object describing the command's arguments. It should set the context's
|
<a>thing</a> evaluates to a function (i.e., it is a variable
|
||||||
<str>completions</str> property, or return an object, with <str>items</str> and <str>start</str>
|
holding a function value, or a string containing the definition
|
||||||
properties, describing the completions and where the replacement is to start.
|
itself), it is called with two arguments: a completion context, and
|
||||||
|
an object describing the command's arguments. It should set the
|
||||||
|
context's <str>completions</str> property, or return an object with
|
||||||
|
<str>items</str> and <str>start</str> properties describing the
|
||||||
|
completions and where the replacement is to start.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
@@ -628,22 +633,36 @@
|
|||||||
[[arg1, description1], [arg2, description2], …]
|
[[arg1, description1], [arg2, description2], …]
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<!-- TODO: add examples -->
|
<p>
|
||||||
|
Otherwise <a>thing</a> should be an array of the same form as the
|
||||||
|
<str>completions</str> property of the context object.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Example:
|
||||||
|
<code><ex>:command foo -complete custom,
|
||||||
|
\ <str delim="'">function (context) context.completions = [["arg1", "description1"], ["arg2", "description2"]]</str>
|
||||||
|
\ <ex>:echo <str>Useless</str></ex></ex>
|
||||||
|
|
||||||
|
<ex>:command foo -complete custom,<str delim="'">[["arg1", "description1"], ["arg2, "description2"]]</str>
|
||||||
|
\ <ex>:echo <str>Same as above but simpler</str></ex></ex>
|
||||||
|
</code>
|
||||||
|
</p>
|
||||||
|
|
||||||
<h3 tag="E177 E178 :command-count">Count handling</h3>
|
<h3 tag="E177 E178 :command-count">Count handling</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
By default, user commands do not accept a count. Use the -count attribute if
|
By default, user commands do not accept a count. Use the -count option if
|
||||||
you'd like to have a count passed to your user command. This will then be
|
you'd like to have a count passed to your user command. This will then be
|
||||||
available for expansion as <count> in the argument.
|
available for expansion as <count> in the replacement.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3 tag=":command-bang">Special cases</h3>
|
<h3 tag=":command-bang">Special cases</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
By default, a user command does not have a special version, i.e. a version
|
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 option will enable this
|
||||||
and <bang> will be available in the argument.
|
and <bang> will be available in the replacement.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3 tag=":command-description">Command description</h3>
|
<h3 tag=":command-description">Command description</h3>
|
||||||
@@ -656,27 +675,22 @@
|
|||||||
<h3 tag=":command-replacement-text">Replacement text</h3>
|
<h3 tag=":command-replacement-text">Replacement text</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
The replacement text <a>rep</a> is scanned for escape sequences and these are
|
The replacement text <a>rep</a> is scanned for macro strings and these are
|
||||||
replaced with values from the user-entered command line. The resulting string
|
replaced with values from the user-entered command line. The resulting string
|
||||||
is then executed as an Ex command.
|
is then executed as an Ex command.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>The valid escape sequences are:</p>
|
<p>The valid macro strings are:</p>
|
||||||
|
|
||||||
<dl>
|
<dl>
|
||||||
<dt><args></dt> <dd>The command arguments exactly as supplied</dd>
|
<dt><args></dt> <dd>The command arguments exactly as supplied</dd>
|
||||||
<dt><count></dt><dd>Any supplied count, e.g. 5</dd>
|
<dt><count></dt><dd>Any supplied count, e.g. 5</dd>
|
||||||
<dt><bang></dt> <dd>! if the command was executed with the ! modifier</dd>
|
<dt><bang></dt> <dd>! if the command was executed with the ! modifier</dd>
|
||||||
<dt><lt></dt>
|
<dt><lt></dt> <dd>A literal '<' character</dd>
|
||||||
<dd>
|
|
||||||
A literal '<' character to allow for a literal copy of one
|
|
||||||
of the escape sequences. E.g., <lt>args> will expand to a
|
|
||||||
literal <args>
|
|
||||||
</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
"q-" can be prefixed to the escape sequence so that the value is quoted, making
|
"q-" can be prefixed to the macro string so that the value is quoted, making
|
||||||
it suitable for expression evaluation. Example: <q-args>
|
it suitable for expression evaluation. Example: <q-args>
|
||||||
</p>
|
</p>
|
||||||
</description>
|
</description>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<dt>toolbar</dt> <dd>toolbars</dd>
|
<dt>toolbar</dt> <dd>toolbars</dd>
|
||||||
<dt>url</dt> <dd>URLs</dd>
|
<dt>url</dt> <dd>URLs</dd>
|
||||||
<dt>usercommand</dt> <dd>user commands</dd>
|
<dt>usercommand</dt> <dd>user commands</dd>
|
||||||
<dt>custom,<a>func</a></dt><dd>custom completion, provided by <a>func</a></dd>
|
<dt>custom,<a>thing</a></dt><dd>custom completion, provided by <a>thing</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</overlay>
|
</overlay>
|
||||||
|
|||||||
@@ -84,6 +84,9 @@
|
|||||||
- Added :yank command.
|
- Added :yank command.
|
||||||
- :delmarks, :marks and :qmarks now also accept ranges, same as
|
- :delmarks, :marks and :qmarks now also accept ranges, same as
|
||||||
:delqmarks.
|
:delqmarks.
|
||||||
|
- :command now accepts comma-separated alternative command names
|
||||||
|
- :command -complete custom now also accepts a completions array, see
|
||||||
|
:h :command-completion-custom.
|
||||||
* Improvements to :style and :highlight:
|
* Improvements to :style and :highlight:
|
||||||
- Added -agent flag to :style.
|
- Added -agent flag to :style.
|
||||||
- The -append flag now updates existing properties rather than
|
- The -append flag now updates existing properties rather than
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
<dt>url</dt> <dd>URLs</dd>
|
<dt>url</dt> <dd>URLs</dd>
|
||||||
<dt>usercommand</dt> <dd>user commands</dd>
|
<dt>usercommand</dt> <dd>user commands</dd>
|
||||||
<dt>window</dt> <dd>windows</dd>
|
<dt>window</dt> <dd>windows</dd>
|
||||||
<dt>custom,<a>func</a></dt><dd>custom completion, provided by <a>func</a></dd>
|
<dt>custom,<a>thing</a></dt><dd>custom completion, provided by <a>thing</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</overlay>
|
</overlay>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
<dt>toolbar</dt> <dd>toolbars</dd>
|
<dt>toolbar</dt> <dd>toolbars</dd>
|
||||||
<dt>url</dt> <dd>URLs</dd>
|
<dt>url</dt> <dd>URLs</dd>
|
||||||
<dt>usercommand</dt> <dd>user commands</dd>
|
<dt>usercommand</dt> <dd>user commands</dd>
|
||||||
<dt>custom,<a>func</a></dt><dd>custom completion, provided by <a>func</a></dd>
|
<dt>custom,<a>thing</a></dt><dd>custom completion, provided by <a>thing</a></dd>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
</overlay>
|
</overlay>
|
||||||
|
|||||||
Reference in New Issue
Block a user