1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

34902: Doc: Explain the numeric argument and be consistent about what we call it

This commit is contained in:
Mikael Magnusson 2011-12-12 14:13:55 +01:00
parent ffb3168586
commit ccb1cf2d10
4 changed files with 37 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2015-04-16 Mikael Magnusson <mikachu@gmail.com>
* 34902: Doc/Zsh/compsys.yo, Doc/Zsh/contrib.yo, Doc/Zsh/zle.yo:
explain the numeric argument and be consistent about what we
call it.
2015-04-15 Peter Stephenson <p.w.stephenson@ntlworld.com>
* 34901: Test/A04redirect.ztst: Test for the foregoing.

View file

@ -1860,7 +1860,7 @@ tested for all tags valid for the current completion, then the
tt(default) tag. The cursor will be moved back to the
previous line if this style is `true' for all types of match. Note
that unlike the tt(ALWAYS_LAST_PROMPT) option this is independent of the
numeric prefix argument.
numeric argument.
)
kindex(known-hosts-files)
item(tt(known-hosts-files))(

View file

@ -1928,7 +1928,7 @@ described immediately above, i.e. using styles to decide the word
boundaries. However, it is not a replacement for any existing function.
The basic behaviour is to delete the word around the cursor. There is no
numeric prefix handling; only the single word around the cursor is
numeric argument handling; only the single word around the cursor is
considered. If the widget contains the string tt(kill), the removed text
will be placed in the cutbuffer for future yanking. This can be obtained
by defining tt(kill-whole-word-match) as follows:
@ -1994,14 +1994,14 @@ full history line. Note that leading zeroes must be typed (they are only
shown when necessary for removing ambiguity). The entire history is
searched; there is no distinction between forwards and backwards.
With a prefix argument, the search is not anchored to the start of
With a numeric argument, the search is not anchored to the start of
the line; the string typed by the use may appear anywhere in the line
in the history.
If the widget name contains `tt(-end)' the cursor is moved to the end of
the line inserted. If the widget name contains `tt(-space)' any space
in the text typed is treated as a wildcard and can match anything (hence
a leading space is equivalent to giving a prefix argument). Both
a leading space is equivalent to giving a numeric argument). Both
forms can be combined, for example:
example(zle -N history-beginning-search-menu-space-end \
@ -2031,8 +2031,8 @@ vindex(incarg, use of)
item(tt(incarg))(
Typing the keystrokes for this widget with the cursor placed on or to the
left of an integer causes that integer to be incremented by one. With a
numeric prefix argument, the number is incremented by the amount of the
argument (decremented if the prefix argument is negative). The shell
numeric argument, the number is incremented by the amount of the
argument (decremented if the numeric argument is negative). The shell
parameter tt(incarg) may be set to change the default increment to
something other than one.
@ -2506,7 +2506,7 @@ This function may replace the tt(insert-last-word) widget, like so:
example(zle -N insert-last-word smart-insert-last-word)
With a numeric prefix, or when passed command line arguments in a call
With a numeric argument, or when passed command line arguments in a call
from another widget, it behaves like tt(insert-last-word), except that
words in comments are ignored when tt(INTERACTIVE_COMMENTS) is set.
@ -2535,12 +2535,12 @@ The effect is similar to the function of the same name in Emacs.
Transpose the current line with the previous line and move the cursor
to the start of the next line. Repeating this (which can be done by
providing a positive numeric prefix argument) has the effect of moving
providing a positive numeric argument) has the effect of moving
the line above the cursor down by a number of lines.
With a negative numeric prefix argument, requires two lines above the
With a negative numeric argument, requires two lines above the
cursor. These two lines are transposed and the cursor moved to the
start of the previous line. Using a numeric prefix less than -1
start of the previous line. Using a numeric argument less than -1
has the effect of moving the line above the cursor up by minus that
number of lines.
)

View file

@ -40,6 +40,17 @@ the following setting:
example(zle_highlight=(none))
In many places, references are made to the tt(numeric argument). This can
by default be entered in emacs mode by holding the alt key and typing
a number, or pressing escape before each number, and in vi command mode
by typing the number before entering a command. Generally the numeric
argument causes the next command entered to be repeated the specified
number of times, unless otherwise noted below. See also
ifzman(the em(Arguments) subsection of the em(Widgets) section )\
ifnzman(noderef(Arguments) )\
for some other ways the numeric argument can be modified. The default
bindings mentioned here use the tt(digit-argument) widget.
startmenu()
menu(Keymaps)
menu(Zle Builtins)
@ -649,9 +660,9 @@ item(var(widget) tt([ -n) var(num) tt(]) tt([ -Nw ] [ -K) var(keymap) tt(]) var(
Invoke the specified widget. This can only be done when ZLE is
active; normally this will be within a user-defined widget.
With the options tt(-n) and tt(-N), the current numerical argument will be
With the options tt(-n) and tt(-N), the current numeric argument will be
saved and then restored after the call to tt(widget); `tt(-n) var(num)'
sets the numerical argument temporarily to var(num), while `tt(-N)' sets it
sets the numeric argument temporarily to var(num), while `tt(-N)' sets it
to the default, i.e. as if there were none.
With the option tt(-K), var(keymap) will be used as the current keymap
@ -1492,7 +1503,7 @@ reexamined. Note that negative numbers should be preceded by a
If two arguments are given, the second specifies the word on the command
line in normal array index notation (as a more natural alternative to the
prefix argument). Hence 1 is the first word, and -1 (the default) is the
numeric argument). Hence 1 is the first word, and -1 (the default) is the
last word.
If a third argument is given, its value is ignored, but it is used to
@ -1889,14 +1900,14 @@ spaces; if instead it is followed by tt(-2), then tt(forward-char),
move backward two spaces.
Inside a widget function, if passed an argument, i.e. `tt(zle
universal-argument) var(num)', the numerical argument will be set to
universal-argument) var(num)', the numeric argument will be set to
var(num); this is equivalent to `tt(NUMERIC=)var(num)'.
)
tindex(argument-base)
item(tt(argument-base))(
Use the existing numeric argument as a numeric base, which must be in the
range 2 to 36 inclusive. Subsequent use of tt(digit-argument) and
tt(universal-argument) will input a new prefix in the given base.
tt(universal-argument) will input a new numeric argument in the given base.
The usual hexadecimal convention is used: the letter tt(a) or tt(A)
corresponds to 10, and so on. Arguments in bases requiring digits from 10
upwards are more conveniently input with tt(universal-argument), since
@ -2053,9 +2064,9 @@ Reads a key sequence, then prints the function bound to that sequence.
tindex(exchange-point-and-mark)
item(tt(exchange-point-and-mark) (^X^X) (unbound) (unbound))(
Exchange the cursor position (point) with the position of the mark.
Unless a negative prefix argument is given, the region between
Unless a negative numeric argument is given, the region between
point and mark is activated so that it can be highlighted.
If a zero prefix argument is given, the region is activated but
If a zero numeric argument is given, the region is activated but
point and mark are not swapped.
)
tindex(execute-named-cmd)
@ -2268,7 +2279,7 @@ Set the specified mark at the cursor position.
tindex(set-mark-command)
item(tt(set-mark-command) (^@) (unbound) (unbound))(
Set the mark at the cursor position. If called with a negative
prefix argument, do not set the mark but deactivate the region so that
numeric argument, do not set the mark but deactivate the region so that
it is no longer highlighted (it is still usable for other purposes).
Otherwise the region is marked as active.
)
@ -2426,8 +2437,8 @@ tt(set-mark-command). The region is only highlighted if it is active,
which is the case if tt(set-mark-command) or tt(exchange-point-and-mark)
has been called and the line has not been subsequently modified. The
region can be deactivated by calling tt(set-mark-command) with a
negative prefix argument, or reactivated by calling
tt(exchange-point-and-mark) with a zero prefix argument. Note
negative numeric argument, or reactivated by calling
tt(exchange-point-and-mark) with a zero numeric argument. Note
that whether or not the region is active has no effect on its
use within widgets, it simply determines whether it is highlighted.
)