|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
*map.txt* For Vim version 9.2. Last change: 2026 May
|
| 2 |
|
| 3 |
|
| 4 |
VIM REFERENCE MANUAL by Bram Moolenaar
|
|
@@ -1593,7 +1593,10 @@ reported if any are supplied). However, it is possible to specify that the
|
|
| 1593 |
command can take arguments, using the -nargs attribute. Valid cases are:
|
| 1594 |
|
| 1595 |
-nargs=0 No arguments are allowed (the default)
|
| 1596 |
-
-nargs=1 Exactly one argument is required, it includes spaces
|
|
|
|
|
|
|
|
|
|
| 1597 |
-nargs=* Any number of arguments are allowed (0, 1, or many),
|
| 1598 |
separated by white space
|
| 1599 |
-nargs=? 0 or 1 arguments are allowed
|
|
@@ -1601,7 +1604,23 @@ command can take arguments, using the -nargs attribute. Valid cases are:
|
|
| 1601 |
|
| 1602 |
Arguments are considered to be separated by (unescaped) spaces or tabs in this
|
| 1603 |
context, except when there is one argument, then the white space is part of
|
| 1604 |
-
the argument.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1605 |
|
| 1606 |
Note that arguments are used as text, not as expressions. Specifically,
|
| 1607 |
"s:var" will use the script-local variable in the script where the command was
|
|
|
|
| 1 |
+
*map.txt* For Vim version 9.2. Last change: 2026 May 17
|
| 2 |
|
| 3 |
|
| 4 |
VIM REFERENCE MANUAL by Bram Moolenaar
|
|
|
|
| 1593 |
command can take arguments, using the -nargs attribute. Valid cases are:
|
| 1594 |
|
| 1595 |
-nargs=0 No arguments are allowed (the default)
|
| 1596 |
+
-nargs=1 Exactly one argument is required, it includes spaces;
|
| 1597 |
+
completion treats white spaces as argument separation
|
| 1598 |
+
-nargs=_ Exactly one argument is required, it includes spaces;
|
| 1599 |
+
completion treats white spaces as part of the argument
|
| 1600 |
-nargs=* Any number of arguments are allowed (0, 1, or many),
|
| 1601 |
separated by white space
|
| 1602 |
-nargs=? 0 or 1 arguments are allowed
|
|
|
|
| 1604 |
|
| 1605 |
Arguments are considered to be separated by (unescaped) spaces or tabs in this
|
| 1606 |
context, except when there is one argument, then the white space is part of
|
| 1607 |
+
the argument. The difference between the "-nargs=1" and "-nargs=_": >
|
| 1608 |
+
|
| 1609 |
+
func MyComplete(ArgLead, CmdLine, CursorPos)
|
| 1610 |
+
return ["one value", "two values", "three values"]
|
| 1611 |
+
\->matchfuzzy(a:ArgLead)
|
| 1612 |
+
endfunc
|
| 1613 |
+
:command -nargs=1 -complete=customlist,MyComplete MyCmd1 echo <q-args>
|
| 1614 |
+
:command -nargs=_ -complete=customlist,MyComplete MyCmd2 echo <q-args>
|
| 1615 |
+
|
| 1616 |
+
Completing ":MyCmd1 two va<tab>" will complete with: >
|
| 1617 |
+
|
| 1618 |
+
:MyCmd1 two one value
|
| 1619 |
+
|
| 1620 |
+
Completing ":MyCmd2 two va<tab>" will complete with: >
|
| 1621 |
+
|
| 1622 |
+
:MyCmd2 two values
|
| 1623 |
+
|
| 1624 |
|
| 1625 |
Note that arguments are used as text, not as expressions. Specifically,
|
| 1626 |
"s:var" will use the script-local variable in the script where the command was
|
|
@@ -52632,6 +52632,8 @@ Other ~
|
|
| 52632 |
- |C-indenting| detects comments better.
|
| 52633 |
- The |package-hlyank| can now optionally highlight the last put region as
|
| 52634 |
well.
|
|
|
|
|
|
|
| 52635 |
|
| 52636 |
Platform specific ~
|
| 52637 |
-----------------
|
|
|
|
| 52632 |
- |C-indenting| detects comments better.
|
| 52633 |
- The |package-hlyank| can now optionally highlight the last put region as
|
| 52634 |
well.
|
| 52635 |
+
- New argument handling for user commands |:command-nargs| using the "-nars=_"
|
| 52636 |
+
attribute to handle completion of single arguments with spaces as expected.
|
| 52637 |
|
| 52638 |
Platform specific ~
|
| 52639 |
-----------------
|