18.6.4 Arguments

digit-argument (ESC-0..ESC-9) (1-9) (unbound)

Start a new numeric argument, or add to the current one. See also vi-digit-or-beginning-of-line. This only works if bound to a key sequence ending in a decimal digit.

Inside a widget function, a call to this function treats the last key of the key sequence which called the widget as the digit.

neg-argument (ESC--) (unbound) (unbound)

Changes the sign of the following argument.

universal-argument

Multiply the argument of the next command by 4. Alternatively, if this command is followed by an integer (positive or negative), use that as the argument for the next command. Thus digits cannot be repeated using this command. For example, if this command occurs twice, followed immediately by forward-char, move forward sixteen spaces; if instead it is followed by -2, then forward-char, move backward two spaces.

Inside a widget function, if passed an argument, i.e. ‘zle universal-argument num’, the numeric argument will be set to num; this is equivalent to ‘NUMERIC=num’.

argument-base

Use the existing numeric argument as a numeric base, which must be in the range 2 to 36 inclusive. Subsequent use of digit-argument and universal-argument will input a new numeric argument in the given base. The usual hexadecimal convention is used: the letter a or A corresponds to 10, and so on. Arguments in bases requiring digits from 10 upwards are more conveniently input with universal-argument, since ESC-a etc. are not usually bound to digit-argument.

The function can be used with a command argument inside a user-defined widget. The following code sets the base to 16 and lets the user input a hexadecimal argument until a key out of the digit range is typed:

zle argument-base 16
zle universal-argument