zsh.info-2 (zsh-5.8.1-doc.tar.xz) | : | zsh.info-2 (zsh-5.9-doc.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 236 | skipping to change at line 236 | |||
The number of lines for this terminal session. Used for printing | The number of lines for this terminal session. Used for printing | |||
select lists and for the line editor. | select lists and for the line editor. | |||
LISTMAX | LISTMAX | |||
In the line editor, the number of matches to list without asking | In the line editor, the number of matches to list without asking | |||
first. If the value is negative, the list will be shown if it | first. If the value is negative, the list will be shown if it | |||
spans at most as many lines as given by the absolute value. If | spans at most as many lines as given by the absolute value. If | |||
set to zero, the shell asks only if the top of the listing would | set to zero, the shell asks only if the top of the listing would | |||
scroll off the screen. | scroll off the screen. | |||
LOGCHECK | ||||
The interval in seconds between checks for login/logout activity | ||||
using the watch parameter. | ||||
If this parameter is set and mailpath is not set, the shell looks | If this parameter is set and mailpath is not set, the shell looks | |||
for mail in the specified file. | for mail in the specified file. | |||
MAILCHECK | MAILCHECK | |||
The interval in seconds between checks for new mail. | The interval in seconds between checks for new mail. | |||
mailpath <S> <Z> (MAILPATH <S>) | mailpath <S> <Z> (MAILPATH <S>) | |||
An array (colon-separated list) of filenames to check for new | An array (colon-separated list) of filenames to check for new | |||
mail. Each filename can be followed by a `?' and a message that | mail. Each filename can be followed by a `?' and a message that | |||
skipping to change at line 434 | skipping to change at line 430 | |||
continued later with the fg or wait builtins it will see the modes | continued later with the fg or wait builtins it will see the modes | |||
specified by STTY, as if it were not suspended. This | specified by STTY, as if it were not suspended. This | |||
(intentionally) does not apply if the command is continued via | (intentionally) does not apply if the command is continued via | |||
`kill -CONT'. STTY is ignored if the command is run in the | `kill -CONT'. STTY is ignored if the command is run in the | |||
background, or if it is in the environment of the shell but not | background, or if it is in the environment of the shell but not | |||
explicitly assigned to in the input line. This avoids running stty | explicitly assigned to in the input line. This avoids running stty | |||
at every external command by accidentally exporting it. Also note | at every external command by accidentally exporting it. Also note | |||
that STTY should not be used for window size specifications; these | that STTY should not be used for window size specifications; these | |||
will not be local to the command. | will not be local to the command. | |||
If the parameter is set and empty, all of the above applies except | ||||
that stty is not run. This can be useful as a way to freeze the tty | ||||
around a single command, blocking its changes to tty settings, | ||||
similar to the ttyctl builtin. | ||||
TERM <S> | TERM <S> | |||
The type of terminal in use. This is used when looking up termcap | The type of terminal in use. This is used when looking up termcap | |||
sequences. An assignment to TERM causes zsh to re-initialize the | sequences. An assignment to TERM causes zsh to re-initialize the | |||
terminal, even if the value does not change (e.g., `TERM=$TERM'). | terminal, even if the value does not change (e.g., `TERM=$TERM'). | |||
It is necessary to make such an assignment upon any change to the | It is necessary to make such an assignment upon any change to the | |||
terminal definition database or terminal type in order for the new | terminal definition database or terminal type in order for the new | |||
settings to take effect. | settings to take effect. | |||
TERMINFO <S> | TERMINFO <S> | |||
A reference to your terminfo database, used by the `terminfo' | A reference to your terminfo database, used by the `terminfo' | |||
library when the system has it; see man page terminfo(5). If set, | library when the system has it; see terminfo(5). If set, this | |||
this causes the shell to reinitialise the terminal, making the | causes the shell to reinitialise the terminal, making the | |||
workaround `TERM=$TERM' unnecessary. | workaround `TERM=$TERM' unnecessary. | |||
TERMINFO_DIRS <S> | TERMINFO_DIRS <S> | |||
A colon-seprarated list of terminfo databases, used by the | A colon-seprarated list of terminfo databases, used by the | |||
`terminfo' library when the system has it; see man page | `terminfo' library when the system has it; see terminfo(5). This | |||
terminfo(5). This variable is only used by certain terminal | variable is only used by certain terminal libraries, in particular | |||
libraries, in particular ncurses; see man page terminfo(5) to | ncurses; see terminfo(5) to check support on your system. If set, | |||
check support on your system. If set, this causes the shell to | this causes the shell to reinitialise the terminal, making the | |||
reinitialise the terminal, making the workaround `TERM=$TERM' | workaround `TERM=$TERM' unnecessary. Note that unlike other | |||
unnecessary. Note that unlike other colon-separated arrays this | colon-separated arrays this is not tied to a zsh array. | |||
is not tied to a zsh array. | ||||
TIMEFMT | TIMEFMT | |||
The format of process time reports with the time keyword. The | The format of process time reports with the time keyword. The | |||
default is `%J %U user %S system %P cpu %*E total'. Recognizes | default is `%J %U user %S system %P cpu %*E total'. Recognizes | |||
the following escape sequences, although not all may be available | the following escape sequences, although not all may be available | |||
on all systems, and some that are available may not be useful: | on all systems, and some that are available may not be useful: | |||
%% | %% | |||
A `%'. | A `%'. | |||
skipping to change at line 557 | skipping to change at line 557 | |||
well as any directory names. The default is `/tmp/zsh'. | well as any directory names. The default is `/tmp/zsh'. | |||
TMPSUFFIX | TMPSUFFIX | |||
A filename suffix which the shell will use for temporary files | A filename suffix which the shell will use for temporary files | |||
created by process substitutions (e.g., `=(LIST)'). Note that the | created by process substitutions (e.g., `=(LIST)'). Note that the | |||
value should include a leading dot `.' if intended to be | value should include a leading dot `.' if intended to be | |||
interpreted as a file extension. The default is not to append any | interpreted as a file extension. The default is not to append any | |||
suffix, thus this parameter should be assigned only when needed | suffix, thus this parameter should be assigned only when needed | |||
and then unset again. | and then unset again. | |||
watch <S> <Z> (WATCH <S>) | ||||
An array (colon-separated list) of login/logout events to report. | ||||
If it contains the single word `all', then all login/logout events | ||||
are reported. If it contains the single word `notme', then all | ||||
events are reported as with `all' except $USERNAME. | ||||
An entry in this list may consist of a username, an `@' followed | ||||
by a remote hostname, and a `%' followed by a line (tty). Any of | ||||
these may be a pattern (be sure to quote this during the | ||||
assignment to watch so that it does not immediately perform file | ||||
generation); the setting of the EXTENDED_GLOB option is respected. | ||||
Any or all of these components may be present in an entry; if a | ||||
login/logout event matches all of them, it is reported. | ||||
For example, with the EXTENDED_GLOB option set, the following: | ||||
watch=('^(pws|barts)') | ||||
causes reports for activity associated with any user other than pws | ||||
or barts. | ||||
WATCHFMT | ||||
The format of login/logout reports if the watch parameter is set. | ||||
Default is `%n has %a %l from %m'. Recognizes the following | ||||
escape sequences: | ||||
%n | ||||
The name of the user that logged in/out. | ||||
%a | ||||
The observed action, i.e. "logged on" or "logged off". | ||||
%l | ||||
The line (tty) the user is logged in on. | ||||
%M | ||||
The full hostname of the remote host. | ||||
%m | ||||
The hostname up to the first `.'. If only the IP address is | ||||
available or the utmp field contains the name of an X-windows | ||||
display, the whole name is printed. | ||||
_NOTE:_ The `%m' and `%M' escapes will work only if there is | ||||
a host name field in the utmp on your machine. Otherwise | ||||
they are treated as ordinary strings. | ||||
%S (%s) | ||||
Start (stop) standout mode. | ||||
%U (%u) | ||||
Start (stop) underline mode. | ||||
%B (%b) | ||||
Start (stop) boldface mode. | ||||
%t | ||||
%@ | ||||
The time, in 12-hour, am/pm format. | ||||
%T | ||||
The time, in 24-hour format. | ||||
%w | ||||
The date in `DAY-DD' format. | ||||
%W | ||||
The date in `MM/DD/YY' format. | ||||
%D | ||||
The date in `YY-MM-DD' format. | ||||
%D{STRING} | ||||
The date formatted as STRING using the strftime function, with | ||||
zsh extensions as described by *Note Prompt Expansion::. | ||||
%(X:TRUE-TEXT:FALSE-TEXT) | ||||
Specifies a ternary expression. The character following the | ||||
X is arbitrary; the same character is used to separate the | ||||
text for the "true" result from that for the "false" result. | ||||
Both the separator and the right parenthesis may be escaped | ||||
with a backslash. Ternary expressions may be nested. | ||||
The test character X may be any one of `l', `n', `m' or `M', | ||||
which indicate a `true' result if the corresponding escape | ||||
sequence would return a non-empty value; or it may be `a', | ||||
which indicates a `true' result if the watched user has | ||||
logged in, or `false' if he has logged out. Other characters | ||||
evaluate to neither true nor false; the entire expression is | ||||
omitted in this case. | ||||
If the result is `true', then the TRUE-TEXT is formatted | ||||
according to the rules above and printed, and the FALSE-TEXT | ||||
is skipped. If `false', the TRUE-TEXT is skipped and the | ||||
FALSE-TEXT is formatted and printed. Either or both of the | ||||
branches may be empty, but both separators must be present in | ||||
any case. | ||||
WORDCHARS <S> | WORDCHARS <S> | |||
A list of non-alphanumeric characters considered part of a word by | A list of non-alphanumeric characters considered part of a word by | |||
the line editor. | the line editor. | |||
ZBEEP | ZBEEP | |||
If set, this gives a string of characters, which can use all the | If set, this gives a string of characters, which can use all the | |||
same codes as the bindkey command as described in *Note The | same codes as the bindkey command as described in *Note The | |||
zsh/zle Module::, that will be output to the terminal instead of | zsh/zle Module::, that will be output to the terminal instead of | |||
beeping. This may have a visible instead of an audible effect; | beeping. This may have a visible instead of an audible effect; | |||
for example, the string `\e[?5h\e[?5l' on a vt100 or xterm will | for example, the string `\e[?5h\e[?5l' on a vt100 or xterm will | |||
skipping to change at line 801 | skipping to change at line 702 | |||
option being off, in which case the inversion of that name refers to | option being off, in which case the inversion of that name refers to | |||
the option being on. For example, `+n' is the short name of `exec', and | the option being on. For example, `+n' is the short name of `exec', and | |||
`-n' is the short name of its inversion, `noexec'. | `-n' is the short name of its inversion, `noexec'. | |||
In strings of single letter options supplied to the shell at startup, | In strings of single letter options supplied to the shell at startup, | |||
trailing whitespace will be ignored; for example the string `-f ' | trailing whitespace will be ignored; for example the string `-f ' | |||
will be treated just as `-f', but the string `-f i' is an error. This | will be treated just as `-f', but the string `-f i' is an error. This | |||
is because many systems which implement the `#!' mechanism for calling | is because many systems which implement the `#!' mechanism for calling | |||
scripts do not strip trailing whitespace. | scripts do not strip trailing whitespace. | |||
It is possible for options to be set within a function scope. See the | ||||
description of the option LOCAL_OPTIONS below. | ||||
File: zsh.info, Node: Description of Options, Next: Option Aliases, Prev: Spe cifying Options, Up: Options | File: zsh.info, Node: Description of Options, Next: Option Aliases, Prev: Spe cifying Options, Up: Options | |||
16.2 Description of Options | 16.2 Description of Options | |||
=========================== | =========================== | |||
In the following list, options set by default in all emulations are | In the following list, options set by default in all emulations are | |||
marked <D>; those set by default only in csh, ksh, sh, or zsh | marked <D>; those set by default only in csh, ksh, sh, or zsh | |||
emulations are marked <C>, <K>, <S>, <Z> as appropriate. When listing | emulations are marked <C>, <K>, <S>, <Z> as appropriate. When listing | |||
options (by `setopt', `unsetopt', `set -o' or `set +o'), those turned | options (by `setopt', `unsetopt', `set -o' or `set +o'), those turned | |||
skipping to change at line 1059 | skipping to change at line 963 | |||
other uses of patterns are always sensitive to case. If the | other uses of patterns are always sensitive to case. If the | |||
option is unset, the presence of any character which is special to | option is unset, the presence of any character which is special to | |||
filename generation will cause case-insensitive matching. For | filename generation will cause case-insensitive matching. For | |||
example, cvs(/) can match the directory CVS owing to the presence | example, cvs(/) can match the directory CVS owing to the presence | |||
of the globbing flag (unless the option BARE_GLOB_QUAL is unset). | of the globbing flag (unless the option BARE_GLOB_QUAL is unset). | |||
CASE_MATCH <D> | CASE_MATCH <D> | |||
Make regular expressions using the zsh/regex module (including | Make regular expressions using the zsh/regex module (including | |||
matches with =~) sensitive to case. | matches with =~) sensitive to case. | |||
CASE_PATHS | ||||
If CASE_PATHS is not set (the default), CASE_GLOB affects the | ||||
interpretation of _every_ path component, whenever a special | ||||
character appears in _any_ component. When CASE_PATHS is set, | ||||
file path components that do _not_ contain special filename | ||||
generation characters are always sensitive to case, thus | ||||
restricting NO_CASE_GLOB to components that contain globbing | ||||
characters. | ||||
Note that if the filesystem itself is not sensitive to case, then | ||||
CASE_PATHS has no effect. | ||||
CSH_NULL_GLOB <C> | CSH_NULL_GLOB <C> | |||
If a pattern for filename generation has no matches, delete the | If a pattern for filename generation has no matches, delete the | |||
pattern from the argument list; do not report an error unless all | pattern from the argument list; do not report an error unless all | |||
the patterns in a command have no matches. Overrides NOMATCH. | the patterns in a command have no matches. Overrides NOMATCH. | |||
EQUALS <Z> | EQUALS <Z> | |||
Perform = filename expansion. (See *Note Filename Expansion::.) | Perform = filename expansion. (See *Note Filename Expansion::.) | |||
EXTENDED_GLOB | EXTENDED_GLOB | |||
Treat the `#', `~' and `^' characters as part of patterns for | Treat the `#', `~' and `^' characters as part of patterns for | |||
skipping to change at line 1455 | skipping to change at line 1371 | |||
already or the flag +g is given explicitly. If the option is | already or the flag +g is given explicitly. If the option is | |||
unset, exported parameters will be made local in just the same way | unset, exported parameters will be made local in just the same way | |||
as any other parameter. | as any other parameter. | |||
This option is set by default for backward compatibility; it is not | This option is set by default for backward compatibility; it is not | |||
recommended that its behaviour be relied upon. Note that the | recommended that its behaviour be relied upon. Note that the | |||
builtin export always sets both the -x and -g flags, and hence its | builtin export always sets both the -x and -g flags, and hence its | |||
effect extends beyond the scope of the enclosing function; this is | effect extends beyond the scope of the enclosing function; this is | |||
the most portable way to achieve this behaviour. | the most portable way to achieve this behaviour. | |||
GLOBAL_RCS (-d) <D> | GLOBAL_RCS (+d) <D> | |||
If this option is unset, the startup files /etc/zprofile, | If this option is unset, the startup files /etc/zprofile, | |||
/etc/zshrc, /etc/zlogin and /etc/zlogout will not be run. It can | /etc/zshrc, /etc/zlogin and /etc/zlogout will not be run. It can | |||
be disabled and re-enabled at any time, including inside local | be disabled and re-enabled at any time, including inside local | |||
startup files (.zshrc, etc.). | startup files (.zshrc, etc.). | |||
RCS (+f) <D> | RCS (+f) <D> | |||
After /etc/zshenv is sourced on startup, source the .zshenv, | After /etc/zshenv is sourced on startup, source the .zshenv, | |||
/etc/zprofile, .zprofile, /etc/zshrc, .zshrc, /etc/zlogin, | /etc/zprofile, .zprofile, /etc/zshrc, .zshrc, /etc/zlogin, | |||
.zlogin, and .zlogout files, as described in *Note Files::. If | .zlogin, and .zlogout files, as described in *Note Files::. If | |||
this option is unset, the /etc/zshenv file is still sourced, but | this option is unset, the /etc/zshenv file is still sourced, but | |||
skipping to change at line 1484 | skipping to change at line 1400 | |||
Expand aliases. | Expand aliases. | |||
CLOBBER (+C, ksh: +C) <D> | CLOBBER (+C, ksh: +C) <D> | |||
Allows `>' redirection to truncate existing files. Otherwise `>!' | Allows `>' redirection to truncate existing files. Otherwise `>!' | |||
or `>|' must be used to truncate a file. | or `>|' must be used to truncate a file. | |||
If the option is not set, and the option APPEND_CREATE is also not | If the option is not set, and the option APPEND_CREATE is also not | |||
set, `>>!' or `>>|' must be used to create a file. If either | set, `>>!' or `>>|' must be used to create a file. If either | |||
option is set, `>>' may be used. | option is set, `>>' may be used. | |||
CLOBBER_EMPTY | ||||
This option is only used if the option CLOBBER is not set: note | ||||
that it is set by default. | ||||
If this option is set, then regular files of zero length may be | ||||
ovewritten (`clobbered'). Note that it is possible another process | ||||
has written to the file between this test and use of the file by | ||||
the current process. This option should therefore not be used in | ||||
cases where files to be clobbered may be written to asynchronously. | ||||
CORRECT (-0) | CORRECT (-0) | |||
Try to correct the spelling of commands. Note that, when the | Try to correct the spelling of commands. Note that, when the | |||
HASH_LIST_ALL option is not set or when some directories in the | HASH_LIST_ALL option is not set or when some directories in the | |||
path are not readable, this may falsely report spelling errors the | path are not readable, this may falsely report spelling errors the | |||
first time some commands are used. | first time some commands are used. | |||
The shell variable CORRECT_IGNORE may be set to a pattern to match | The shell variable CORRECT_IGNORE may be set to a pattern to match | |||
words that will never be offered as corrections. | words that will never be offered as corrections. | |||
CORRECT_ALL (-O) | CORRECT_ALL (-O) | |||
skipping to change at line 1572 | skipping to change at line 1498 | |||
PATH_SCRIPT <K> <S> | PATH_SCRIPT <K> <S> | |||
If this option is not set, a script passed as the first non-option | If this option is not set, a script passed as the first non-option | |||
argument to the shell must contain the name of the file to open. | argument to the shell must contain the name of the file to open. | |||
If this option is set, and the script does not specify a directory | If this option is set, and the script does not specify a directory | |||
path, the script is looked for first in the current directory, | path, the script is looked for first in the current directory, | |||
then in the command path. See *Note Invocation::. | then in the command path. See *Note Invocation::. | |||
PRINT_EIGHT_BIT | PRINT_EIGHT_BIT | |||
Print eight bit characters literally in completion lists, etc. | Print eight bit characters literally in completion lists, etc. | |||
This option is not necessary if your system correctly returns the | This option is not necessary if your system correctly returns the | |||
printability of eight bit characters (see man page ctype(3)). | printability of eight bit characters (see ctype(3)). | |||
PRINT_EXIT_VALUE (-1) | PRINT_EXIT_VALUE (-1) | |||
Print the exit value of programs with non-zero exit status. This | Print the exit value of programs with non-zero exit status. This | |||
is only available at the command line in interactive shells. | is only available at the command line in interactive shells. | |||
RC_QUOTES | RC_QUOTES | |||
Allow the character sequence `''' to signify a single quote within | Allow the character sequence `''' to signify a single quote within | |||
singly quoted strings. Note this does not apply in quoted strings | singly quoted strings. Note this does not apply in quoted strings | |||
using the format $'...', where a backslashed single quote can be | using the format $'...', where a backslashed single quote can be | |||
used. | used. | |||
skipping to change at line 1598 | skipping to change at line 1524 | |||
If querying the user before executing `rm *' or `rm path/*', first | If querying the user before executing `rm *' or `rm path/*', first | |||
wait ten seconds and ignore anything typed in that time. This | wait ten seconds and ignore anything typed in that time. This | |||
avoids the problem of reflexively answering `yes' to the query | avoids the problem of reflexively answering `yes' to the query | |||
when one didn't really mean it. The wait and query can always be | when one didn't really mean it. The wait and query can always be | |||
avoided by expanding the `*' in ZLE (with tab). | avoided by expanding the `*' in ZLE (with tab). | |||
SHORT_LOOPS <C> <Z> | SHORT_LOOPS <C> <Z> | |||
Allow the short forms of for, repeat, select, if, and function | Allow the short forms of for, repeat, select, if, and function | |||
constructs. | constructs. | |||
SHORT_REPEAT | ||||
Allow the short form repeat as SHORT_LOOPS but without enabling it | ||||
for the other constructs. | ||||
SUN_KEYBOARD_HACK (-L) | SUN_KEYBOARD_HACK (-L) | |||
If a line ends with a backquote, and there are an odd number of | If a line ends with a backquote, and there are an odd number of | |||
backquotes on the line, ignore the trailing backquote. This is | backquotes on the line, ignore the trailing backquote. This is | |||
useful on some keyboards where the return key is too small, and | useful on some keyboards where the return key is too small, and | |||
the backquote key lies annoyingly close to it. As an alternative | the backquote key lies annoyingly close to it. As an alternative | |||
the variable KEYBOARD_HACK lets you choose the character to be | the variable KEYBOARD_HACK lets you choose the character to be | |||
removed. | removed. | |||
16.2.7 Job Control | 16.2.7 Job Control | |||
------------------ | ------------------ | |||
skipping to change at line 1632 | skipping to change at line 1562 | |||
CHECK_JOBS <Z> | CHECK_JOBS <Z> | |||
Report the status of background and suspended jobs before exiting | Report the status of background and suspended jobs before exiting | |||
a shell with job control; a second attempt to exit the shell will | a shell with job control; a second attempt to exit the shell will | |||
succeed. NO_CHECK_JOBS is best used only in combination with | succeed. NO_CHECK_JOBS is best used only in combination with | |||
NO_HUP, else such jobs will be killed automatically. | NO_HUP, else such jobs will be killed automatically. | |||
The check is omitted if the commands run from the previous command | The check is omitted if the commands run from the previous command | |||
line included a `jobs' command, since it is assumed the user is | line included a `jobs' command, since it is assumed the user is | |||
aware that there are background or suspended jobs. A `jobs' | aware that there are background or suspended jobs. A `jobs' | |||
command run from one of the hook functions defined in the section | command run from one of the hook functions defined in the section | |||
Special Functions in *Note Functions:: is not counted for this | `Special Functions' in *Note Functions:: is not counted for this | |||
purpose. | purpose. | |||
CHECK_RUNNING_JOBS <Z> | CHECK_RUNNING_JOBS <Z> | |||
Check for both running and suspended jobs when CHECK_JOBS is | Check for both running and suspended jobs when CHECK_JOBS is | |||
enabled. When this option is disabled, zsh checks only for | enabled. When this option is disabled, zsh checks only for | |||
suspended jobs, which matches the default behavior of bash. | suspended jobs, which matches the default behavior of bash. | |||
This option has no effect unless CHECK_JOBS is set. | This option has no effect unless CHECK_JOBS is set. | |||
HUP <Z> | HUP <Z> | |||
skipping to change at line 1929 | skipping to change at line 1859 | |||
`dot' builtin commands. | `dot' builtin commands. | |||
TYPESET_SILENT | TYPESET_SILENT | |||
If this is unset, executing any of the `typeset' family of | If this is unset, executing any of the `typeset' family of | |||
commands with no options and a list of parameters that have no | commands with no options and a list of parameters that have no | |||
values to be assigned but already exist will display the value of | values to be assigned but already exist will display the value of | |||
the parameter. If the option is set, they will only be shown when | the parameter. If the option is set, they will only be shown when | |||
parameters are selected with the `-m' option. The option `-p' is | parameters are selected with the `-m' option. The option `-p' is | |||
available whether or not the option is set. | available whether or not the option is set. | |||
TYPESET_TO_UNSET <K> <S> | ||||
When declaring a new parameter with any of the `typeset' family of | ||||
related commands, the parameter remains unset unless and until a | ||||
value is explicity assigned to it, either in the `typeset' command | ||||
itself or as a later assignment statement. | ||||
VERBOSE (-v, ksh: -v) | VERBOSE (-v, ksh: -v) | |||
Print shell input lines as they are read. | Print shell input lines as they are read. | |||
XTRACE (-x, ksh: -x) | XTRACE (-x, ksh: -x) | |||
Print commands and their arguments as they are executed. The | Print commands and their arguments as they are executed. The | |||
output is preceded by the value of $PS4, formatted as described in | output is preceded by the value of $PS4, formatted as described in | |||
*Note Prompt Expansion::. | *Note Prompt Expansion::. | |||
16.2.10 Shell Emulation | 16.2.10 Shell Emulation | |||
----------------------- | ----------------------- | |||
skipping to change at line 1960 | skipping to change at line 1896 | |||
BASH_REMATCH array variable, instead of the default MATCH and | BASH_REMATCH array variable, instead of the default MATCH and | |||
match variables. The first element of the BASH_REMATCH array will | match variables. The first element of the BASH_REMATCH array will | |||
contain the entire matched text and subsequent elements will | contain the entire matched text and subsequent elements will | |||
contain extracted substrings. This option makes more sense when | contain extracted substrings. This option makes more sense when | |||
KSH_ARRAYS is also set, so that the entire matched portion is | KSH_ARRAYS is also set, so that the entire matched portion is | |||
stored at index 0 and the first substring is at index 1. Without | stored at index 0 and the first substring is at index 1. Without | |||
this option, the MATCH variable contains the entire matched text | this option, the MATCH variable contains the entire matched text | |||
and the match array variable contains substrings. | and the match array variable contains substrings. | |||
BSD_ECHO <S> | BSD_ECHO <S> | |||
Make the echo builtin compatible with the BSD man page echo(1) | Make the echo builtin compatible with the BSD echo(1) command. | |||
command. This disables backslashed escape sequences in echo | This disables backslashed escape sequences in echo strings unless | |||
strings unless the -e option is specified. | the -e option is specified. | |||
CONTINUE_ON_ERROR | CONTINUE_ON_ERROR | |||
If a fatal error is encountered (see *Note Errors::), and the code | If a fatal error is encountered (see *Note Errors::), and the code | |||
is running in a script, the shell will resume execution at the | is running in a script, the shell will resume execution at the | |||
next statement in the script at the top level, in other words | next statement in the script at the top level, in other words | |||
outside all functions or shell constructs such as loops and | outside all functions or shell constructs such as loops and | |||
conditions. This mimics the behaviour of interactive shells, | conditions. This mimics the behaviour of interactive shells, | |||
where the shell returns to the line editor to read a new command; | where the shell returns to the line editor to read a new command; | |||
it was the normal behaviour in versions of zsh before 5.0.1. | it was the normal behaviour in versions of zsh before 5.0.1. | |||
skipping to change at line 2107 | skipping to change at line 2043 | |||
In addition, various error conditions associated with the above | In addition, various error conditions associated with the above | |||
builtins or exec cause a non-interactive shell to exit and an | builtins or exec cause a non-interactive shell to exit and an | |||
interactive shell to return to its top-level processing. | interactive shell to return to its top-level processing. | |||
Furthermore, functions and shell builtins are not executed after | Furthermore, functions and shell builtins are not executed after | |||
an exec prefix; the command to be executed must be an external | an exec prefix; the command to be executed must be an external | |||
command found in the path. | command found in the path. | |||
Furthermore, the getopts builtin behaves in a POSIX-compatible | Furthermore, the getopts builtin behaves in a POSIX-compatible | |||
fashion in that the associated variable OPTIND is not made local | fashion in that the associated variable OPTIND is not made local | |||
to functions. | to functions, and its value is calculated differently to match | |||
other shells. | ||||
Moreover, the warning and special exit code from [[ -o | Moreover, the warning and special exit code from [[ -o | |||
NON_EXISTENT_OPTION ]] are suppressed. | NON_EXISTENT_OPTION ]] are suppressed. | |||
POSIX_IDENTIFIERS <K> <S> | POSIX_IDENTIFIERS <K> <S> | |||
When this option is set, only the ASCII characters a to z, A to Z, | When this option is set, only the ASCII characters a to z, A to Z, | |||
0 to 9 and _ may be used in identifiers (names of shell parameters | 0 to 9 and _ may be used in identifiers (names of shell parameters | |||
and modules). | and modules). | |||
In addition, setting this option limits the effect of parameter | In addition, setting this option limits the effect of parameter | |||
skipping to change at line 2170 | skipping to change at line 2107 | |||
For example, the command line argument a$'b\0c'd is treated with | For example, the command line argument a$'b\0c'd is treated with | |||
the option off as the characters a, b, null, c, d, and with the | the option off as the characters a, b, null, c, d, and with the | |||
option on as the characters a, b, d. | option on as the characters a, b, d. | |||
POSIX_TRAPS <K> <S> | POSIX_TRAPS <K> <S> | |||
When this option is set, the usual zsh behaviour of executing | When this option is set, the usual zsh behaviour of executing | |||
traps for EXIT on exit from shell functions is suppressed. In | traps for EXIT on exit from shell functions is suppressed. In | |||
that case, manipulating EXIT traps always alters the global trap | that case, manipulating EXIT traps always alters the global trap | |||
for exiting the shell; the LOCAL_TRAPS option is ignored for the | for exiting the shell; the LOCAL_TRAPS option is ignored for the | |||
EXIT trap. Furthermore, a return statement executed in a trap | EXIT trap. | |||
with no argument passes back from the function the value from the | ||||
surrounding context, not from code executed within the trap. | Also, a return statement executed in a trap with no argument passes | |||
back from the function the value from the surrounding context, not | ||||
from code executed within the trap. | ||||
Furthermore, if a trap is set to be ignored, this state persists | ||||
when a subshell is entered. Without the option, the trap would be | ||||
reset to its default state at this point. | ||||
SH_FILE_EXPANSION <K> <S> | SH_FILE_EXPANSION <K> <S> | |||
Perform filename expansion (e.g., ~ expansion) _before_ parameter | Perform filename expansion (e.g., ~ expansion) _before_ parameter | |||
expansion, command substitution, arithmetic expansion and brace | expansion, command substitution, arithmetic expansion and brace | |||
expansion. If this option is unset, it is performed _after_ brace | expansion. If this option is unset, it is performed _after_ brace | |||
expansion, so things like `~$USERNAME' and `~{pfalstad,rc}' will | expansion, so things like `~$USERNAME' and `~{pfalstad,rc}' will | |||
work. | work. | |||
SH_NULLCMD <K> <S> | SH_NULLCMD <K> <S> | |||
Do not use the values of NULLCMD and READNULLCMD when doing | Do not use the values of NULLCMD and READNULLCMD when doing | |||
skipping to change at line 2693 | skipping to change at line 2636 | |||
: [ ARG ... ] | : [ ARG ... ] | |||
This command does nothing, although normal argument expansions is | This command does nothing, although normal argument expansions is | |||
performed which may have effects on shell parameters. A zero exit | performed which may have effects on shell parameters. A zero exit | |||
status is returned. | status is returned. | |||
alias [ {+|-}gmrsL ] [ NAME[=VALUE] ... ] | alias [ {+|-}gmrsL ] [ NAME[=VALUE] ... ] | |||
For each NAME with a corresponding VALUE, define an alias with | For each NAME with a corresponding VALUE, define an alias with | |||
that value. A trailing space in VALUE causes the next word to be | that value. A trailing space in VALUE causes the next word to be | |||
checked for alias expansion. If the -g flag is present, define a | checked for alias expansion. If the -g flag is present, define a | |||
global alias; global aliases are expanded even if they do not | global alias; global aliases are expanded even if they do not | |||
occur in command position. | occur in command position: | |||
% perldoc --help 2>&1 | grep 'built-in functions' | ||||
-f Search Perl built-in functions | ||||
% alias -g HG='--help 2>&1 | grep' | ||||
% perldoc HG 'built-in functions' | ||||
-f Search Perl built-in functions | ||||
If the -s flag is present, define a suffix alias: if the command | If the -s flag is present, define a suffix alias: if the command | |||
word on a command line is in the form `TEXT.NAME', where TEXT is | word on a command line is in the form `TEXT.NAME', where TEXT is | |||
any non-empty string, it is replaced by the text `VALUE | any non-empty string, it is replaced by the text `VALUE | |||
TEXT.NAME'. Note that NAME is treated as a literal string, not a | TEXT.NAME'. Note that NAME is treated as a literal string, not a | |||
pattern. A trailing space in VALUE is not special in this case. | pattern. A trailing space in VALUE is not special in this case. | |||
For example, | For example, | |||
alias -s ps='gv --' | alias -s ps='gv --' | |||
skipping to change at line 3311 | skipping to change at line 3260 | |||
export [ NAME[=VALUE] ... ] | export [ NAME[=VALUE] ... ] | |||
The specified NAMEs are marked for automatic export to the | The specified NAMEs are marked for automatic export to the | |||
environment of subsequently executed commands. Equivalent to | environment of subsequently executed commands. Equivalent to | |||
typeset -gx. If a parameter specified does not already exist, it | typeset -gx. If a parameter specified does not already exist, it | |||
is created in the global scope. | is created in the global scope. | |||
false [ ARG ... ] | false [ ARG ... ] | |||
Do nothing and return an exit status of 1. | Do nothing and return an exit status of 1. | |||
fc [ -e ENAME ] [ -LI ] [ -m MATCH ] [ OLD=NEW ... ] [ FIRST [ LAST ] ] | fc [ -e ENAME ] [ -s ] [ -LI ] [ -m MATCH ] [ OLD=NEW ... ] [ FIRST [ LAST ] ] | |||
fc -l [ -LI ] [ -nrdfEiD ] [ -t TIMEFMT ] [ -m MATCH ] | fc -l [ -LI ] [ -nrdfEiD ] [ -t TIMEFMT ] [ -m MATCH ] | |||
[ OLD=NEW ... ] [ FIRST [ LAST ] ] | [ OLD=NEW ... ] [ FIRST [ LAST ] ] | |||
fc -p [ -a ] [ FILENAME [ HISTSIZE [ SAVEHISTSIZE ] ] ] | fc -p [ -a ] [ FILENAME [ HISTSIZE [ SAVEHISTSIZE ] ] ] | |||
fc -P | fc -P | |||
fc -ARWI [ FILENAME ] | fc -ARWI [ FILENAME ] | |||
The fc command controls the interactive history mechanism. Note | The fc command controls the interactive history mechanism. Note | |||
that reading and writing of history options is only performed if | that reading and writing of history options is only performed if | |||
the shell is interactive. Usually this is detected automatically, | the shell is interactive. Usually this is detected automatically, | |||
but it can be forced by setting the interactive option when | but it can be forced by setting the interactive option when | |||
starting the shell. | starting the shell. | |||
The first two forms of this command select a range of events from | The first two forms of this command select a range of events from | |||
FIRST to LAST from the history list. The arguments FIRST and LAST | FIRST to LAST from the history list. The arguments FIRST and LAST | |||
may be specified as a number or as a string. A negative number is | may be specified as a number or as a string. A negative number is | |||
used as an offset to the current history event number. A string | used as an offset to the current history event number. A string | |||
specifies the most recent event beginning with the given string. | specifies the most recent event beginning with the given string. | |||
All substitutions OLD=NEW, if any, are then performed on the text | All substitutions OLD=NEW, if any, are then performed on the text | |||
of the events. | of the events. | |||
In addition to the number range, | The range of events selected by numbers can be narrowed further by | |||
the following flags. | ||||
-I | -I | |||
restricts to only internal events (not from $HISTFILE) | restricts to only internal events (not from $HISTFILE) | |||
-L | -L | |||
restricts to only local events (not from other shells, see | restricts to only local events (not from other shells, see | |||
SHARE_HISTORY in *Note Description of Options:: - note that | SHARE_HISTORY in *Note Description of Options:: - note that | |||
$HISTFILE is considered local when read at startup) | $HISTFILE is considered local when read at startup) | |||
-m | -m | |||
takes the first argument as a pattern (should be quoted) and | takes the first argument as a pattern (which should be | |||
only the history events matching this pattern are considered | quoted) and only the history events matching this pattern are | |||
considered | ||||
If FIRST is not specified, it will be set to -1 (the most recent | If FIRST is not specified, it will be set to -1 (the most recent | |||
event), or to -16 if the -l flag is given. If LAST is not | event), or to -16 if the -l flag is given. If LAST is not | |||
specified, it will be set to FIRST, or to -1 if the -l flag is | specified, it will be set to FIRST, or to -1 if the -l flag is | |||
given. However, if the current event has added entries to the | given. However, if the current event has added entries to the | |||
history with `print -s' or `fc -R', then the default LAST for -l | history with `print -s' or `fc -R', then the default LAST for -l | |||
includes all new history entries since the current event began. | includes all new history entries since the current event began. | |||
When the -l flag is given, the resulting events are listed on | When the -l flag is given, the resulting events are listed on | |||
standard output. Otherwise the editor program specified by -e | standard output. Otherwise the editor program specified by -e | |||
ENAME is invoked on a file containing these history events. If -e | ENAME is invoked on a file containing these history events. If -e | |||
is not given, the value of the parameter FCEDIT is used; if that | is not given, the value of the parameter FCEDIT is used; if that | |||
is not set the value of the parameter EDITOR is used; if that is | is not set the value of the parameter EDITOR is used; if that is | |||
not set a builtin default, usually `vi' is used. If ENAME is `-', | not set a builtin default, usually `vi' is used. If ENAME is `-', | |||
no editor is invoked. When editing is complete, the edited | no editor is invoked. When editing is complete, the edited | |||
command is executed. | command is executed. | |||
The flag -r reverses the order of the events and the flag -n | The flag `-s' is equivalent to `-e -'. The flag -r reverses the | |||
suppresses event numbers when listing. | order of the events and the flag -n suppresses event numbers when | |||
listing. | ||||
Also when listing, | Also when listing, | |||
-d | -d | |||
prints timestamps for each event | prints timestamps for each event | |||
-f | -f | |||
prints full time-date stamps in the US `MM/DD/YY HH:MM' format | prints full time-date stamps in the US `MM/DD/YY HH:MM' format | |||
-E | -E | |||
prints full time-date stamps in the European `DD.MM.YYYY | prints full time-date stamps in the European `DD.MM.YYYY | |||
skipping to change at line 3446 | skipping to change at line 3398 | |||
Equivalent to typeset -E, except that options irrelevant to | Equivalent to typeset -E, except that options irrelevant to | |||
floating point numbers are not permitted. | floating point numbers are not permitted. | |||
functions [ {+|-}UkmtTuWz ] [ -x NUM ] [ NAME ... ] | functions [ {+|-}UkmtTuWz ] [ -x NUM ] [ NAME ... ] | |||
functions -c OLDFN NEWFN | functions -c OLDFN NEWFN | |||
functions -M [-s] MATHFN [ MIN [ MAX [ SHELLFN ] ] ] | functions -M [-s] MATHFN [ MIN [ MAX [ SHELLFN ] ] ] | |||
functions -M [ -m PATTERN ... ] | functions -M [ -m PATTERN ... ] | |||
functions +M [ -m ] MATHFN ... | functions +M [ -m ] MATHFN ... | |||
Equivalent to typeset -f, with the exception of the -c, -x, -M and | Equivalent to typeset -f, with the exception of the -c, -x, -M and | |||
-W options. For functions -u and functions -U, see autoload, | -W options. For functions -u and functions -U, see autoload, | |||
which provides additional options. | which provides additional options. For functions -t and functions | |||
-T, see typeset -f. | ||||
The -x option indicates that any functions output will have each | The -x option indicates that any functions output will have each | |||
leading tab for indentation, added by the shell to show syntactic | leading tab for indentation, added by the shell to show syntactic | |||
structure, expanded to the given number NUM of spaces. NUM can | structure, expanded to the given number NUM of spaces. NUM can | |||
also be 0 to suppress all indentation. | also be 0 to suppress all indentation. | |||
The -W option turns on the option WARN_NESTED_VAR for the named | The -W option turns on the option WARN_NESTED_VAR for the named | |||
function or functions only. The option is turned off at the start | function or functions only. The option is turned off at the start | |||
of nested functions (apart from anonoymous functions) unless the | of nested functions (apart from anonoymous functions) unless the | |||
called function also has the -W attribute. | called function also has the -W attribute. | |||
The -c option causes OLDFN to be copied to NEWFN. The copy is | The -c option causes OLDFN to be copied to NEWFN. The copy is | |||
efficiently handled internally by reference counting. If OLDFN | efficiently handled internally by reference counting. If OLDFN | |||
was marked for autoload it is first loaded and if this fails the | was marked for autoload it is first loaded and if this fails the | |||
copy fails. Either function may subsequently be redefined without | copy fails. Either function may subsequently be redefined without | |||
affecting the other. A typical idiom is that OLDFN is the name of | affecting the other. A typical idiom is that OLDFN is the name of | |||
a library shell function which is then redefined to call newfn, | a library shell function which is then redefined to call newfn, | |||
thereby installing a modified version of the function. | thereby installing a modified version of the function. | |||
_The _-M_ and _+M_ flags_ | ||||
Use of the -M option may not be combined with any of the options | Use of the -M option may not be combined with any of the options | |||
handled by typeset -f. | handled by typeset -f. | |||
functions -M MATHFN defines MATHFN as the name of a mathematical | functions -M MATHFN defines MATHFN as the name of a mathematical | |||
function recognised in all forms of arithmetical expressions; see | function recognised in all forms of arithmetical expressions; see | |||
*Note Arithmetic Evaluation::. By default MATHFN may take any | *Note Arithmetic Evaluation::. By default MATHFN may take any | |||
number of comma-separated arguments. If MIN is given, it must | number of comma-separated arguments. If MIN is given, it must | |||
have exactly MIN args; if MIN and MAX are both given, it must have | have exactly MIN args; if MIN and MAX are both given, it must have | |||
at least MIN and at most MAX args. MAX may be -1 to indicate that | at least MIN and at most MAX args. MAX may be -1 to indicate that | |||
there is no upper limit. | there is no upper limit. | |||
By default the function is implemented by a shell function of the | By default the function is implemented by a shell function of the | |||
same name; if SHELLFN is specified it gives the name of the | same name; if SHELLFN is specified it gives the name of the | |||
corresponding shell function while MATHFN remains the name used in | corresponding shell function while MATHFN remains the name used in | |||
arithmetical expressions. The name of the function in $0 is | arithmetical expressions. The name of the function in $0 is | |||
MATHFN (not SHELLFN as would usually be the case), provided the | MATHFN (not SHELLFN as would usually be the case), provided the | |||
option FUNCTION_ARGZERO is in effect. The positional parameters | option FUNCTION_ARGZERO is in effect. The positional parameters | |||
in the shell function correspond to the arguments of the | in the shell function correspond to the arguments of the | |||
mathematical function call. The result of the last arithmetical | mathematical function call. | |||
expression evaluated inside the shell function (even if it is a | ||||
form that normally only returns a status) gives the result of the | The result of the last arithmetical expression evaluated inside | |||
mathematical function. | the shell function gives the result of the mathematical function. | |||
This is not limited to arithmetic substitutions of the form | ||||
$((...)), but also includes arithmetical expressions evaluated in | ||||
any other way, including by the let builtin, by ((...)) statements, | ||||
and even by the return builtin and by array subscripts. | ||||
Therefore, care must be taken not to use syntactical constructs | ||||
that perform arithmetic evaluation after evaluating what is to be | ||||
the result of the function. For example: | ||||
# WRONG | ||||
zmath_cube() { | ||||
(( $1 * $1 * $1 )) | ||||
return 0 | ||||
} | ||||
functions -M cube 1 1 zmath_cube | ||||
print $(( cube(3) )) | ||||
This will print `0' because of the return. | ||||
Commenting the return out would lead to a different problem: the | ||||
((...)) statement would become the last statement in the function, | ||||
so the _return status_ ($?) of the function would be non-zero | ||||
(indicating failure) whenever the _arithmetic result_ of the | ||||
function would happen to be zero (numerically): | ||||
# WRONG | ||||
zmath_cube() { | ||||
(( $1 * $1 * $1 )) | ||||
} | ||||
functions -M cube 1 1 zmath_cube | ||||
print $(( cube(0) )) | ||||
Instead, the true builtin can be used: | ||||
# RIGHT | ||||
zmath_cube() { | ||||
(( $1 * $1 * $1 )) | ||||
true | ||||
} | ||||
functions -M cube 1 1 zmath_cube | ||||
print $(( cube(3) )) | ||||
If the additional option -s is given to functions -M, the argument | If the additional option -s is given to functions -M, the argument | |||
to the function is a single string: anything between the opening | to the function is a single string: anything between the opening | |||
and matching closing parenthesis is passed to the function as a | and matching closing parenthesis is passed to the function as a | |||
single argument, even if it includes commas or white space. The | single argument, even if it includes commas or white space. The | |||
minimum and maximum argument specifiers must therefore be 1 if | minimum and maximum argument specifiers must therefore be 1 if | |||
given. An empty argument list is passed as a zero-length string. | given. An empty argument list is passed as a zero-length string. | |||
Thus, the following string function takes a single argument, | ||||
including the commas, and prints 11: | ||||
stringfn() { (( $#1 )); true } | ||||
functions -Ms stringfn | ||||
print $(( stringfn(foo,bar,rod) )) | ||||
functions -M with no arguments lists all such user-defined | functions -M with no arguments lists all such user-defined | |||
functions in the same form as a definition. With the additional | functions in the same form as a definition. With the additional | |||
option -m and a list of arguments, all functions whose MATHFN | option -m and a list of arguments, all functions whose MATHFN | |||
matches one of the pattern arguments are listed. | matches one of the pattern arguments are listed. | |||
function +M removes the list of mathematical functions; with the | function +M removes the list of mathematical functions; with the | |||
additional option -m the arguments are treated as patterns and all | additional option -m the arguments are treated as patterns and all | |||
functions whose MATHFN matches the pattern are removed. Note that | functions whose MATHFN matches the pattern are removed. Note that | |||
the shell function implementing the behaviour is not removed | the shell function implementing the behaviour is not removed | |||
(regardless of whether its name coincides with MATHFN). | (regardless of whether its name coincides with MATHFN). | |||
For example, the following prints the cube of 3: | ||||
zmath_cube() { (( $1 * $1 * $1 )) } | ||||
functions -M cube 1 1 zmath_cube | ||||
print $(( cube(3) )) | ||||
The following string function takes a single argument, including | ||||
the commas, so prints 11: | ||||
stringfn() { (( $#1 )) } | ||||
functions -Ms stringfn | ||||
print $(( stringfn(foo,bar,rod) )) | ||||
getcap | getcap | |||
See *Note The zsh/cap Module::. | See *Note The zsh/cap Module::. | |||
getln [ -AclneE ] NAME ... | getln [ -AclneE ] NAME ... | |||
Read the top value from the buffer stack and put it in the shell | Read the top value from the buffer stack and put it in the shell | |||
parameter NAME. Equivalent to read -zr. | parameter NAME. Equivalent to read -zr. | |||
getopts OPTSTRING NAME [ ARG ... ] | getopts OPTSTRING NAME [ ARG ... ] | |||
Checks the ARGs for legal options. If the ARGs are omitted, use | Checks the ARGs for legal options. If the ARGs are omitted, use | |||
the positional parameters. A valid option argument begins with a | the positional parameters. A valid option argument begins with a | |||
skipping to change at line 3545 | skipping to change at line 3533 | |||
separated from the argument by blanks. | separated from the argument by blanks. | |||
Each time it is invoked, getopts places the option letter it finds | Each time it is invoked, getopts places the option letter it finds | |||
in the shell parameter NAME, prepended with a `+' when ARG begins | in the shell parameter NAME, prepended with a `+' when ARG begins | |||
with a `+'. The index of the next ARG is stored in OPTIND. The | with a `+'. The index of the next ARG is stored in OPTIND. The | |||
option argument, if any, is stored in OPTARG. | option argument, if any, is stored in OPTARG. | |||
The first option to be examined may be changed by explicitly | The first option to be examined may be changed by explicitly | |||
assigning to OPTIND. OPTIND has an initial value of 1, and is | assigning to OPTIND. OPTIND has an initial value of 1, and is | |||
normally set to 1 upon entry to a shell function and restored upon | normally set to 1 upon entry to a shell function and restored upon | |||
exit (this is disabled by the POSIX_BUILTINS option). OPTARG is | exit. (The POSIX_BUILTINS option disables this, and also changes | |||
the way the value is calculated to match other shells.) OPTARG is | ||||
not reset and retains its value from the most recent call to | not reset and retains its value from the most recent call to | |||
getopts. If either of OPTIND or OPTARG is explicitly unset, it | getopts. If either of OPTIND or OPTARG is explicitly unset, it | |||
remains unset, and the index or option argument is not stored. | remains unset, and the index or option argument is not stored. | |||
The option itself is still stored in NAME in this case. | The option itself is still stored in NAME in this case. | |||
A leading `:' in OPTSTRING causes getopts to store the letter of | A leading `:' in OPTSTRING causes getopts to store the letter of | |||
any invalid option in OPTARG, and to set NAME to `?' for an | any invalid option in OPTARG, and to set NAME to `?' for an | |||
unknown option and to `:' when a required argument is missing. | unknown option and to `:' when a required argument is missing. | |||
Otherwise, getopts sets NAME to `?' and prints an error message | Otherwise, getopts sets NAME to `?' and prints an error message | |||
when an option is invalid. The exit status is nonzero when there | when an option is invalid. The exit status is nonzero when there | |||
skipping to change at line 3625 | skipping to change at line 3614 | |||
Lists information about each given job, or all jobs if JOB is | Lists information about each given job, or all jobs if JOB is | |||
omitted. The -l flag lists process IDs, and the -p flag lists | omitted. The -l flag lists process IDs, and the -p flag lists | |||
process groups. If the -r flag is specified only running jobs | process groups. If the -r flag is specified only running jobs | |||
will be listed and if the -s flag is given only stopped jobs are | will be listed and if the -s flag is given only stopped jobs are | |||
shown. If the -d flag is given, the directory from which the job | shown. If the -d flag is given, the directory from which the job | |||
was started (which may not be the current directory of the job) | was started (which may not be the current directory of the job) | |||
will also be shown. | will also be shown. | |||
The -Z option replaces the shell's argument and environment space | The -Z option replaces the shell's argument and environment space | |||
with the given string, truncated if necessary to fit. This will | with the given string, truncated if necessary to fit. This will | |||
normally be visible in ps (man page ps(1)) listings. This feature | normally be visible in ps (ps(1)) listings. This feature is | |||
is typically used by daemons, to indicate their state. | typically used by daemons, to indicate their state. | |||
Full job control is only available in the top-level interactive | ||||
shell, not in commands run in the left hand side of pipelines or | ||||
within the (...) construct. However, a snapshot of the job state | ||||
at that point is taken, so it is still possible to use the jobs | ||||
builtin, or any parameter providing job information. This gives | ||||
information about the state of jobs at the point the subshell was | ||||
created. If background processes are created within the subshell, | ||||
then instead information about those processes is provided. | ||||
For example, | ||||
sleep 10 & # Job in background | ||||
( # Shell forks | ||||
jobs # Shows information about "sleep 10 &" | ||||
sleep 5 & # Process in background (no job control) | ||||
jobs # Shows information about "sleep 5 &" | ||||
) | ||||
kill [ -s SIGNAL_NAME | -n SIGNAL_NUMBER | -SIG ] JOB ... | kill [ -s SIGNAL_NAME | -n SIGNAL_NUMBER | -SIG ] JOB ... | |||
kill -l [ SIG ... ] | kill -l [ SIG ... ] | |||
Sends either SIGTERM or the specified signal to the given jobs or | Sends either SIGTERM or the specified signal to the given jobs or | |||
processes. Signals are given by number or by names, with or | processes. Signals are given by number or by names, with or | |||
without the `SIG' prefix. If the signal being sent is not `KILL' | without the `SIG' prefix. If the signal being sent is not `KILL' | |||
or `CONT', then the job will be sent a `CONT' signal if it is | or `CONT', then the job will be sent a `CONT' signal if it is | |||
stopped. The argument JOB can be the process ID of a job not in | stopped. The argument JOB can be the process ID of a job not in | |||
the job list. In the second form, kill -l, if SIG is not | the job list. In the second form, kill -l, if SIG is not | |||
specified the signal names are listed. Otherwise, for each SIG | specified the signal names are listed. Otherwise, for each SIG | |||
skipping to change at line 3783 | skipping to change at line 3790 | |||
The limit command is not made available by default when the shell | The limit command is not made available by default when the shell | |||
starts in a mode emulating another shell. It can be made available | starts in a mode emulating another shell. It can be made available | |||
with the command `zmodload -F zsh/rlimits b:limit'. | with the command `zmodload -F zsh/rlimits b:limit'. | |||
local [ {+|-}AHUahlprtux ] [ {+|-}EFLRZi [ N ] ] [ NAME[=VALUE] ... ] | local [ {+|-}AHUahlprtux ] [ {+|-}EFLRZi [ N ] ] [ NAME[=VALUE] ... ] | |||
Same as typeset, except that the options -g, and -f are not | Same as typeset, except that the options -g, and -f are not | |||
permitted. In this case the -x option does not force the use of | permitted. In this case the -x option does not force the use of | |||
-g, i.e. exported variables will be local to functions. | -g, i.e. exported variables will be local to functions. | |||
log | ||||
List all users currently logged in who are affected by the current | ||||
setting of the watch parameter. | ||||
logout [ N ] | logout [ N ] | |||
Same as exit, except that it only works in a login shell. | Same as exit, except that it only works in a login shell. | |||
noglob SIMPLE COMMAND | noglob SIMPLE COMMAND | |||
See *Note Precommand Modifiers::. | See *Note Precommand Modifiers::. | |||
popd [ -q ] [ {+|-}N ] | popd [ -q ] [ {+|-}N ] | |||
Remove an entry from the directory stack, and perform a cd to the | Remove an entry from the directory stack, and perform a cd to the | |||
new top directory. With no argument, the current top entry is | new top directory. With no argument, the current top entry is | |||
removed. An argument of the form `+N' identifies a stack entry by | removed. An argument of the form `+N' identifies a stack entry by | |||
skipping to change at line 4023 | skipping to change at line 4026 | |||
pwd [ -rLP ] | pwd [ -rLP ] | |||
Print the absolute pathname of the current working directory. If | Print the absolute pathname of the current working directory. If | |||
the -r or the -P flag is specified, or the CHASE_LINKS option is | the -r or the -P flag is specified, or the CHASE_LINKS option is | |||
set and the -L flag is not given, the printed path will not | set and the -L flag is not given, the printed path will not | |||
contain symbolic links. | contain symbolic links. | |||
r | r | |||
Same as fc -e -. | Same as fc -e -. | |||
read [ -rszpqAclneE ] [ -t [ NUM ] ] [ -k [ NUM ] ] [ -d DELIM ] | read [ -rszpqAclneE ] [ -t [ NUM ] ] [ -k [ NUM ] ] [ -d DELIM ] | |||
[ -u N ] [ NAME[?PROMPT] ] [ NAME ... ] | [ -u N ] [ [NAME][?PROMPT] ] [ NAME ... ] | |||
Read one line and break it into fields using the characters in | Read one line and break it into fields using the characters in | |||
$IFS as separators, except as noted below. The first field is | $IFS as separators, except as noted below. The first field is | |||
assigned to the first NAME, the second field to the second NAME, | assigned to the first NAME, the second field to the second NAME, | |||
etc., with leftover fields assigned to the last NAME. If NAME is | etc., with leftover fields assigned to the last NAME. If NAME is | |||
omitted then REPLY is used for scalars and reply for arrays. | omitted then REPLY is used for scalars and reply for arrays. | |||
-r | -r | |||
Raw mode: a `\' at the end of a line does not signify line | Raw mode: a `\' at the end of a line does not signify line | |||
continuation and backslashes in the line don't quote the | continuation and backslashes in the line don't quote the | |||
following character and are not removed. | following character and are not removed. | |||
skipping to change at line 4153 | skipping to change at line 4156 | |||
readonly | readonly | |||
Same as typeset -r. With the POSIX_BUILTINS option set, same as | Same as typeset -r. With the POSIX_BUILTINS option set, same as | |||
typeset -gr. | typeset -gr. | |||
rehash | rehash | |||
Same as hash -r. | Same as hash -r. | |||
return [ N ] | return [ N ] | |||
Causes a shell function or `.' script to return to the invoking | Causes a shell function or `.' script to return to the invoking | |||
script with the return status specified by an arithmetic | script with the return status specified by an arithmetic | |||
expression N. If N is omitted, the return status is that of the | expression N. For example, the following prints `42': | |||
last command executed. | ||||
() { integer foo=40; return "foo + 2" } | ||||
echo $? | ||||
If N is omitted, the return status is that of the last command | ||||
executed. | ||||
If return was executed from a trap in a TRAPNAL function, the | If return was executed from a trap in a TRAPNAL function, the | |||
effect is different for zero and non-zero return status. With zero | effect is different for zero and non-zero return status. With zero | |||
status (or after an implicit return at the end of the trap), the | status (or after an implicit return at the end of the trap), the | |||
shell will return to whatever it was previously processing; with a | shell will return to whatever it was previously processing; with a | |||
non-zero status, the shell will behave as interrupted except that | non-zero status, the shell will behave as interrupted except that | |||
the return status of the trap is retained. Note that the numeric | the return status of the trap is retained. Note that the numeric | |||
value of the signal which caused the trap is passed as the first | value of the signal which caused the trap is passed as the first | |||
argument, so the statement `return $((128+$1))' will return the | argument, so the statement `return "128+$1"' will return the same | |||
same status as if the signal had not been trapped. | status as if the signal had not been trapped. | |||
sched | sched | |||
See *Note The zsh/sched Module::. | See *Note The zsh/sched Module::. | |||
set [ {+|-}OPTIONS | {+|-}o [ OPTION_NAME ] ] ... [ {+|-}A [ NAME ] ] | set [ {+|-}OPTIONS | {+|-}o [ OPTION_NAME ] ] ... [ {+|-}A [ NAME ] ] | |||
[ ARG ... ] | [ ARG ... ] | |||
Set the options for the shell and/or set the positional | Set the options for the shell and/or set the positional | |||
parameters, or declare and set an array. If the -s option is | parameters, or declare and set an array. If the -s option is | |||
given, it causes the specified arguments to be sorted before | given, it causes the specified arguments to be sorted before | |||
assigning them to the positional parameters (or to the array NAME | assigning them to the positional parameters (or to the array NAME | |||
skipping to change at line 4387 | skipping to change at line 4395 | |||
blocked. | blocked. | |||
Without options it reports whether the terminal is frozen or not. | Without options it reports whether the terminal is frozen or not. | |||
Note that, regardless of whether the tty is frozen or not, the | Note that, regardless of whether the tty is frozen or not, the | |||
shell needs to change the settings when the line editor starts, so | shell needs to change the settings when the line editor starts, so | |||
unfreezing the tty does not guarantee settings made on the command | unfreezing the tty does not guarantee settings made on the command | |||
line are preserved. Strings of commands run between editing the | line are preserved. Strings of commands run between editing the | |||
command line will see a consistent tty state. See also the shell | command line will see a consistent tty state. See also the shell | |||
variable STTY for a means of initialising the tty before running | variable STTY for a means of initialising the tty before running | |||
external commands. | external commands and/or freezing the tty around a single command. | |||
type [ -wfpamsS ] NAME ... | type [ -wfpamsS ] NAME ... | |||
Equivalent to whence -v. | Equivalent to whence -v. | |||
typeset [ {+|-}AHUaghlmrtux ] [ {+|-}EFLRZip [ N ] ] | typeset [ {+|-}AHUaghlmrtux ] [ {+|-}EFLRZip [ N ] ] | |||
[ + ] [ NAME[=VALUE] ... ] | [ + ] [ NAME[=VALUE] ... ] | |||
typeset -T [ {+|-}Uglrux ] [ {+|-}LRZp [ N ] ] | typeset -T [ {+|-}Uglrux ] [ {+|-}LRZp [ N ] ] | |||
[ + | SCALAR[=VALUE] ARRAY[=(VALUE ...)] [ SEP ] ] | [ + | SCALAR[=VALUE] ARRAY[=(VALUE ...)] [ SEP ] ] | |||
typeset -f [ {+|-}TUkmtuz ] [ + ] [ NAME ... ] | typeset -f [ {+|-}TUkmtuz ] [ + ] [ NAME ... ] | |||
Set or display attributes and values for shell parameters. | Set or display attributes and values for shell parameters. | |||
Except as noted below for control flags that change the behavior, | Except as noted below for control flags that change the behavior, | |||
a parameter is created for each NAME that does not already refer | a parameter is created for each NAME that does not already refer | |||
to one. When inside a function, a new parameter is created for | to one. When inside a function, a new parameter is created for | |||
every NAME (even those that already exist), and is unset again | every NAME (even those that already exist), and is unset again | |||
when the function completes. See *Note Local Parameters::. The | when the function completes. See *Note Local Parameters::. The | |||
same rules apply to special shell parameters, which retain their | same rules apply to special shell parameters, which retain their | |||
special attributes when made local. | special attributes when made local. | |||
For each NAME=VALUE assignment, the parameter NAME is set to VALUE. | For each NAME=VALUE assignment, the parameter NAME is set to | |||
VALUE. If the assignment is omitted and NAME does _not_ refer to | ||||
an existing parameter, a new parameter is intialized to empty | ||||
string, zero, or empty array (as appropriate), _unless_ the shell | ||||
option TYPESET_TO_UNSET is set. When that option is set, the | ||||
parameter attributes are recorded but the parameter remains unset. | ||||
If the shell option TYPESET_SILENT is not set, for each remaining | If the shell option TYPESET_SILENT is not set, for each remaining | |||
NAME that refers to a parameter that is already set, the name and | NAME that refers to a parameter that is already set, the name and | |||
value of the parameter are printed in the form of an assignment. | value of the parameter are printed in the form of an assignment. | |||
Nothing is printed for newly-created parameters, or when any | Nothing is printed for newly-created parameters, or when any | |||
attribute flags listed below are given along with the NAME. Using | attribute flags listed below are given along with the NAME. Using | |||
`+' instead of minus to introduce an attribute turns it off. | `+' instead of minus to introduce an attribute turns it off. | |||
If no NAME is present, the names and values of all parameters are | If no NAME is present, the names and values of all parameters are | |||
printed. In this case the attribute flags restrict the display to | printed. In this case the attribute flags restrict the display to | |||
skipping to change at line 4478 | skipping to change at line 4491 | |||
assignment causes the argument to be treated in this fashion: | assignment causes the argument to be treated in this fashion: | |||
typeset {var1,var2,var3}=name | typeset {var1,var2,var3}=name | |||
The above syntax is valid, and has the expected effect of setting | The above syntax is valid, and has the expected effect of setting | |||
the three parameters to the same value, but the command line is | the three parameters to the same value, but the command line is | |||
parsed as a set of three normal command line arguments to typeset | parsed as a set of three normal command line arguments to typeset | |||
after expansion. Hence it is not possible to assign to multiple | after expansion. Hence it is not possible to assign to multiple | |||
arrays by this means. | arrays by this means. | |||
Note that each interface to any of the commands my be disabled | Note that each interface to any of the commands may be disabled | |||
separately. For example, `disable -r typeset' disables the | separately. For example, `disable -r typeset' disables the | |||
reserved word interface to typeset, exposing the builtin | reserved word interface to typeset, exposing the builtin | |||
interface, while `disable typeset' disables the builtin. Note | interface, while `disable typeset' disables the builtin. Note | |||
that disabling the reserved word interface for typeset may cause | that disabling the reserved word interface for typeset may cause | |||
problems with the output of `typeset -p', which assumes the | problems with the output of `typeset -p', which assumes the | |||
reserved word interface is available in order to restore array and | reserved word interface is available in order to restore array and | |||
associative array values. | associative array values. | |||
Unlike parameter assignment statements, typeset's exit status on an | Unlike parameter assignment statements, typeset's exit status on an | |||
assignment that involves a command substitution does not reflect | assignment that involves a command substitution does not reflect | |||
skipping to change at line 4886 | skipping to change at line 4899 | |||
limits for resources known to the shell which do not correspond to | limits for resources known to the shell which do not correspond to | |||
option letters. Such limits will be shown by number in the output | option letters. Such limits will be shown by number in the output | |||
of `ulimit -a'. | of `ulimit -a'. | |||
The number may alternatively be out of the range of limits | The number may alternatively be out of the range of limits | |||
compiled into the shell. The shell will try to read or write the | compiled into the shell. The shell will try to read or write the | |||
limit anyway, and will report an error if this fails. | limit anyway, and will report an error if this fails. | |||
umask [ -S ] [ MASK ] | umask [ -S ] [ MASK ] | |||
The umask is set to MASK. MASK can be either an octal number or a | The umask is set to MASK. MASK can be either an octal number or a | |||
symbolic value as described in man page chmod(1). If MASK is | symbolic value as described in the chmod(1) man page. If MASK is | |||
omitted, the current value is printed. The -S option causes the | omitted, the current value is printed. The -S option causes the | |||
mask to be printed as a symbolic value. Otherwise, the mask is | mask to be printed as a symbolic value. Otherwise, the mask is | |||
printed as an octal number. Note that in the symbolic form the | printed as an octal number. Note that in the symbolic form the | |||
permissions you specify are those which are to be allowed (not | permissions you specify are those which are to be allowed (not | |||
denied) to the users specified. | denied) to the users specified. | |||
unalias [ -ams ] NAME ... | unalias [ -ams ] NAME ... | |||
Removes aliases. This command works the same as unhash -a, except | Removes aliases. This command works the same as unhash -a, except | |||
that the -a option removes all regular or global aliases, or with | that the -a option removes all regular or global aliases, or with | |||
-s all suffix aliases: in this case no NAME arguments may appear. | -s all suffix aliases: in this case no NAME arguments may appear. | |||
skipping to change at line 5539 | skipping to change at line 5552 | |||
following setting: | following setting: | |||
zle_highlight=(none) | zle_highlight=(none) | |||
In many places, references are made to the numeric argument. This can | In many places, references are made to the numeric argument. This can | |||
by default be entered in emacs mode by holding the alt key and typing a | by default be entered in emacs mode by holding the alt key and typing a | |||
number, or pressing escape before each digit, and in vi command mode by | number, or pressing escape before each digit, and in vi command mode by | |||
typing the number before entering a command. Generally the numeric | typing the number before entering a command. Generally the numeric | |||
argument causes the next command entered to be repeated the specified | argument causes the next command entered to be repeated the specified | |||
number of times, unless otherwise noted below; this is implemented by | number of times, unless otherwise noted below; this is implemented by | |||
the digit-argument widget. See also *Note Arguments:: for some other | the digit-argument widget. See also *Note Arguments::for some other | |||
ways the numeric argument can be modified. | ways the numeric argument can be modified. | |||
* Menu: | * Menu: | |||
* Keymaps:: | * Keymaps:: | |||
* Zle Builtins:: | * Zle Builtins:: | |||
* Zle Widgets:: | * Zle Widgets:: | |||
* User-Defined Widgets:: | ||||
* Standard Widgets:: | ||||
* Character Highlighting:: | * Character Highlighting:: | |||
File: zsh.info, Node: Keymaps, Next: Zle Builtins, Up: Zsh Line Editor | File: zsh.info, Node: Keymaps, Next: Zle Builtins, Up: Zsh Line Editor | |||
18.2 Keymaps | 18.2 Keymaps | |||
============ | ============ | |||
A keymap in ZLE contains a set of bindings between key sequences and | A keymap in ZLE contains a set of bindings between key sequences and | |||
ZLE commands. The empty key sequence cannot be bound. | ZLE commands. The empty key sequence cannot be bound. | |||
skipping to change at line 5921 | skipping to change at line 5936 | |||
zle -N WIDGET [ FUNCTION ] | zle -N WIDGET [ FUNCTION ] | |||
zle -f FLAG [ FLAG... ] | zle -f FLAG [ FLAG... ] | |||
zle -C WIDGET COMPLETION-WIDGET FUNCTION | zle -C WIDGET COMPLETION-WIDGET FUNCTION | |||
zle -R [ -c ] [ DISPLAY-STRING ] [ STRING ... ] | zle -R [ -c ] [ DISPLAY-STRING ] [ STRING ... ] | |||
zle -M STRING | zle -M STRING | |||
zle -U STRING | zle -U STRING | |||
zle -K KEYMAP | zle -K KEYMAP | |||
zle -F [ -L | -w ] [ FD [ HANDLER ] ] | zle -F [ -L | -w ] [ FD [ HANDLER ] ] | |||
zle -I | zle -I | |||
zle -T [ tc FUNCTION | -r tc | -L ] | zle -T [ tc FUNCTION | -r tc | -L ] | |||
zle WIDGET [ -n NUM ] [ -Nw ] [ -K KEYMAP ] ARGS ... | zle WIDGET [ -n NUM ] [ -f FLAG ] [ -Nw ] [ -K KEYMAP ] ARGS ... | |||
The zle builtin performs a number of different actions concerning | The zle builtin performs a number of different actions concerning | |||
ZLE. | ZLE. | |||
With no options and no arguments, only the return status will be | With no options and no arguments, only the return status will be | |||
set. It is zero if ZLE is currently active and widgets could be | set. It is zero if ZLE is currently active and widgets could be | |||
invoked using this builtin command and non-zero otherwise. Note | invoked using this builtin command and non-zero otherwise. Note | |||
that even if non-zero status is returned, zle may still be active | that even if non-zero status is returned, zle may still be active | |||
as part of the completion system; this does not allow direct calls | as part of the completion system; this does not allow direct calls | |||
to ZLE widgets. | to ZLE widgets. | |||
skipping to change at line 6007 | skipping to change at line 6022 | |||
-C WIDGET COMPLETION-WIDGET FUNCTION | -C WIDGET COMPLETION-WIDGET FUNCTION | |||
Create a user-defined completion widget named WIDGET. The | Create a user-defined completion widget named WIDGET. The | |||
completion widget will behave like the built-in | completion widget will behave like the built-in | |||
completion-widget whose name is given as COMPLETION-WIDGET. | completion-widget whose name is given as COMPLETION-WIDGET. | |||
To generate the completions, the shell function FUNCTION will | To generate the completions, the shell function FUNCTION will | |||
be called. For further information, see *Note Completion | be called. For further information, see *Note Completion | |||
Widgets::. | Widgets::. | |||
-R [ -c ] [ DISPLAY-STRING ] [ STRING ... ] | -R [ -c ] [ DISPLAY-STRING ] [ STRING ... ] | |||
Redisplay the command line; this is to be called from within | Redisplay the command line. If a DISPLAY-STRING is given and | |||
a user-defined widget to allow changes to become visible. If | not empty, this is shown in the status line (immediately | |||
a DISPLAY-STRING is given and not empty, this is shown in the | below the line being edited). | |||
status line (immediately below the line being edited). | ||||
If the optional STRINGs are given they are listed below the | If the optional STRINGs are given they are listed below the | |||
prompt in the same way as completion lists are printed. If no | prompt in the same way as completion lists are printed. If no | |||
STRINGs are given but the -c option is used such a list is | STRINGs are given but the -c option is used such a list is | |||
cleared. | cleared. | |||
Note that this option is only useful for widgets that do not | Note that immediately after returning from running widgets, | |||
exit immediately after using it because the strings displayed | the command line will be redisplayed and the strings | |||
will be erased immediately after return from the widget. | displayed will be erased. Therefore, this option is only | |||
useful for widgets that do not exit immediately after using | ||||
it. | ||||
This command can safely be called outside user defined | This command can safely be called outside user defined | |||
widgets; if zle is active, the display will be refreshed, | widgets; if zle is active, the display will be refreshed, | |||
while if zle is not active, the command has no effect. In | while if zle is not active, the command has no effect. In | |||
this case there will usually be no other arguments. | this case there will usually be no other arguments. | |||
The status is zero if zle was active, else one. | The status is zero if zle was active, else one. | |||
-M STRING | -M STRING | |||
As with the -R option, the STRING will be displayed below the | As with the -R option, the STRING will be displayed below the | |||
skipping to change at line 6200 | skipping to change at line 6216 | |||
transformation is in operation the shell function is passed | transformation is in operation the shell function is passed | |||
the termcap code that would be output as its first argument; | the termcap code that would be output as its first argument; | |||
if the operation required a numeric argument, that is passed | if the operation required a numeric argument, that is passed | |||
as a second argument. The function should set the shell | as a second argument. The function should set the shell | |||
variable REPLY to the transformed termcap code. Typically | variable REPLY to the transformed termcap code. Typically | |||
this is used to produce some simply formatted version of the | this is used to produce some simply formatted version of the | |||
code and optional argument for debugging or testing. Note | code and optional argument for debugging or testing. Note | |||
that this transformation is not applied to other non-printing | that this transformation is not applied to other non-printing | |||
characters such as carriage returns and newlines. | characters such as carriage returns and newlines. | |||
WIDGET [ -n NUM ] [ -Nw ] [ -K KEYMAP ] ARGS ... | WIDGET [ -n NUM ] [ -f FLAG ] [ -Nw ] [ -K KEYMAP ] ARGS ... | |||
Invoke the specified WIDGET. This can only be done when ZLE | Invoke the specified WIDGET. This can only be done when ZLE | |||
is active; normally this will be within a user-defined widget. | is active; normally this will be within a user-defined widget. | |||
With the options -n and -N, the current numeric argument will | With the options -n and -N, the current numeric argument will | |||
be saved and then restored after the call to WIDGET; `-n NUM' | be saved and then restored after the call to WIDGET; `-n NUM' | |||
sets the numeric argument temporarily to NUM, while `-N' sets | sets the numeric argument temporarily to NUM, while `-N' sets | |||
it to the default, i.e. as if there were none. | it to the default, i.e. as if there were none. | |||
With the option -K, KEYMAP will be used as the current keymap | With the option -K, KEYMAP will be used as the current keymap | |||
during the execution of the widget. The previous keymap will | during the execution of the widget. The previous keymap will | |||
be restored when the widget exits. | be restored when the widget exits. | |||
Normally, calling a widget in this way does not set the | Normally, calling a widget in this way does not set the | |||
special parameter WIDGET and related parameters, so that the | special parameter WIDGET and related parameters, so that the | |||
environment appears as if the top-level widget called by the | environment appears as if the top-level widget called by the | |||
user were still active. With the option -w, WIDGET and | user were still active. With the option -w, WIDGET and | |||
related parameters are set to reflect the widget being | related parameters are set to reflect the widget being | |||
executed by the zle call. | executed by the zle call. | |||
Normally, when WIDGET returns the special parameter | ||||
LASTWIDGET will point to it. This can be inhibited by | ||||
passing the option -f nolast. | ||||
Any further arguments will be passed to the widget; note that | Any further arguments will be passed to the widget; note that | |||
as standard argument handling is performed, any general | as standard argument handling is performed, any general | |||
argument list should be preceded by --. If it is a shell | argument list should be preceded by --. If it is a shell | |||
function, these are passed down as positional parameters; for | function, these are passed down as positional parameters; for | |||
builtin widgets it is up to the widget in question what it | builtin widgets it is up to the widget in question what it | |||
does with them. Currently arguments are only handled by the | does with them. Currently arguments are only handled by the | |||
incremental-search commands, the history-search-forward and | incremental-search commands, the history-search-forward and | |||
-backward and the corresponding functions prefixed by vi-, | -backward and the corresponding functions prefixed by vi-, | |||
and by universal-argument. No error is flagged if the | and by universal-argument. No error is flagged if the | |||
command does not use the arguments, or only uses some of them. | command does not use the arguments, or only uses some of them. | |||
skipping to change at line 6242 | skipping to change at line 6262 | |||
operation carried out by the widget, or if it is a | operation carried out by the widget, or if it is a | |||
user-defined widget the return status of the shell function. | user-defined widget the return status of the shell function. | |||
A non-zero return status causes the shell to beep when the | A non-zero return status causes the shell to beep when the | |||
widget exits, unless the BEEP options was unset or the widget | widget exits, unless the BEEP options was unset or the widget | |||
was called via the zle command. Thus if a user defined | was called via the zle command. Thus if a user defined | |||
widget requires an immediate beep, it should call the beep | widget requires an immediate beep, it should call the beep | |||
widget directly. | widget directly. | |||
File: zsh.info, Node: Zle Widgets, Next: Character Highlighting, Prev: Zle Bu iltins, Up: Zsh Line Editor | File: zsh.info, Node: Zle Widgets, Next: User-Defined Widgets, Prev: Zle Buil tins, Up: Zsh Line Editor | |||
18.4 Widgets | 18.4 Zle Widgets | |||
============ | ================ | |||
All actions in the editor are performed by `widgets'. A widget's job is | All actions in the editor are performed by `widgets'. A widget's job is | |||
simply to perform some small action. The ZLE commands that key | simply to perform some small action. The ZLE commands that key | |||
sequences in keymaps are bound to are in fact widgets. Widgets can be | sequences in keymaps are bound to are in fact widgets. Widgets can be | |||
user-defined or built in. | user-defined or built in. | |||
The standard widgets built into ZLE are listed in Standard Widgets | The standard widgets built into ZLE are listed in *Note Standard | |||
below. Other built-in widgets can be defined by other modules (see | Widgets::. Other built-in widgets can be defined by other modules (see | |||
*Note Zsh Modules::). Each built-in widget has two names: its normal | *Note Zsh Modules::). Each built-in widget has two names: its normal | |||
canonical name, and the same name preceded by a `.'. The `.' name is | canonical name, and the same name preceded by a `.'. The `.' name is | |||
special: it can't be rebound to a different widget. This makes the | special: it can't be rebound to a different widget. This makes the | |||
widget available even when its usual name has been redefined. | widget available even when its usual name has been redefined. | |||
User-defined widgets are defined using `zle -N', and implemented as | User-defined widgets are defined using `zle -N', and implemented as | |||
shell functions. When the widget is executed, the corresponding shell | shell functions. When the widget is executed, the corresponding shell | |||
function is executed, and can perform editing (or other) actions. It | function is executed, and can perform editing (or other) actions. It | |||
is recommended that user-defined widgets should not have names starting | is recommended that user-defined widgets should not have names starting | |||
with `.'. | with `.'. | |||
File: zsh.info, Node: User-Defined Widgets, Next: Standard Widgets, Prev: Zle | ||||
Widgets, Up: Zsh Line Editor | ||||
18.5 User-Defined Widgets | 18.5 User-Defined Widgets | |||
========================= | ========================= | |||
User-defined widgets, being implemented as shell functions, can execute | User-defined widgets, being implemented as shell functions, can execute | |||
any normal shell command. They can also run other widgets (whether | any normal shell command. They can also run other widgets (whether | |||
built-in or user-defined) using the zle builtin command. The standard | built-in or user-defined) using the zle builtin command. The standard | |||
input of the function is redirected from /dev/null to prevent external | input of the function is redirected from /dev/null to prevent external | |||
commands from unintentionally blocking ZLE by reading from the | commands from unintentionally blocking ZLE by reading from the | |||
terminal, but read -k or read -q can be used to read characters. | terminal, but read -k or read -q can be used to read characters. | |||
Finally, they can examine and edit the ZLE buffer being edited by | Finally, they can examine and edit the ZLE buffer being edited by | |||
skipping to change at line 6463 | skipping to change at line 6486 | |||
Highlighting::. | Highlighting::. | |||
region_highlight (array) | region_highlight (array) | |||
Each element of this array may be set to a string that describes | Each element of this array may be set to a string that describes | |||
highlighting for an arbitrary region of the command line that will | highlighting for an arbitrary region of the command line that will | |||
take effect the next time the command line is redisplayed. | take effect the next time the command line is redisplayed. | |||
Highlighting of the non-editable parts of the command line in | Highlighting of the non-editable parts of the command line in | |||
PREDISPLAY and POSTDISPLAY are possible, but note that the P flag | PREDISPLAY and POSTDISPLAY are possible, but note that the P flag | |||
is needed for character indexing to include PREDISPLAY. | is needed for character indexing to include PREDISPLAY. | |||
Each string consists of the following parts: | Each string consists of the following whitespace-separated parts: | |||
* Optionally, a `P' to signify that the start and end offset | * Optionally, a `P' to signify that the start and end offset | |||
that follow include any string set by the PREDISPLAY special | that follow include any string set by the PREDISPLAY special | |||
parameter; this is needed if the predisplay string itself is | parameter; this is needed if the predisplay string itself is | |||
to be highlighted. Whitespace may follow the `P'. | to be highlighted. Whitespace between the `P' and the start | |||
offset is optional. | ||||
* A start offset in the same units as CURSOR, terminated by | * A start offset in the same units as CURSOR. | |||
whitespace. | ||||
* An end offset in the same units as CURSOR, terminated by | * An end offset in the same units as CURSOR. | |||
whitespace. | ||||
* A highlight specification in the same format as used for | * A highlight specification in the same format as used for | |||
contexts in the parameter zle_highlight, see *Note Character | contexts in the parameter zle_highlight, see *Note Character | |||
Highlighting::; for example, standout or fg=red,bold. | Highlighting::; for example, standout or fg=red,bold. | |||
* Optionally, a string of the form `memo=TOKEN'. The TOKEN | ||||
consists of everything between the `=' and the next | ||||
whitespace, comma, NUL, or the end of the string. The TOKEN | ||||
is preserved verbatim but not parsed in any way. | ||||
Plugins may use this to identify array elements they have | ||||
added: for example, a plugin might set TOKEN to its (the | ||||
plugin's) name and then use `region_highlight=( | ||||
${region_highlight:#*memo=TOKEN} )' in order to remove array | ||||
elements it have added. | ||||
(This example uses the `${NAME:#PATTERN}' array-grepping | ||||
syntax described in *Note Parameter Expansion::.) | ||||
For example, | For example, | |||
region_highlight=("P0 20 bold") | region_highlight=("P0 20 bold memo=foobar") | |||
specifies that the first twenty characters of the text including | specifies that the first twenty characters of the text including | |||
any predisplay string should be highlighted in bold. | any predisplay string should be highlighted in bold. | |||
Note that the effect of region_highlight is not saved and | Note that the effect of region_highlight is not saved and | |||
disappears as soon as the line is accepted. | disappears as soon as the line is accepted. | |||
Note that zsh 5.8 and older do not support the `memo=TOKEN' field | ||||
and may misparse the third (highlight specification) field when a | ||||
memo is given. | ||||
The final highlighting on the command line depends on both | The final highlighting on the command line depends on both | |||
region_highlight and zle_highlight; see *Note Character | region_highlight and zle_highlight; see *Note Character | |||
Highlighting:: for details. | Highlighting:: for details. | |||
registers (associative array) | registers (associative array) | |||
The contents of each of the vi register buffers. These are | The contents of each of the vi register buffers. These are | |||
typically set using vi-set-buffer followed by a delete, change or | typically set using vi-set-buffer followed by a delete, change or | |||
yank command. | yank command. | |||
SUFFIX_ACTIVE (integer) | SUFFIX_ACTIVE (integer) | |||
skipping to change at line 6648 | skipping to change at line 6688 | |||
KEYMAP is set to a different value, while the line editor is | KEYMAP is set to a different value, while the line editor is | |||
active. Initialising the keymap when the line editor starts does | active. Initialising the keymap when the line editor starts does | |||
not cause the widget to be called. | not cause the widget to be called. | |||
The value $KEYMAP within the function reflects the new keymap. The | The value $KEYMAP within the function reflects the new keymap. The | |||
old keymap is passed as the sole argument. | old keymap is passed as the sole argument. | |||
This can be used for detecting switches between the vi command | This can be used for detecting switches between the vi command | |||
(vicmd) and insert (usually main) keymaps. | (vicmd) and insert (usually main) keymaps. | |||
File: zsh.info, Node: Standard Widgets, Next: Character Highlighting, Prev: U | ||||
ser-Defined Widgets, Up: Zsh Line Editor | ||||
18.6 Standard Widgets | 18.6 Standard Widgets | |||
===================== | ===================== | |||
The following is a list of all the standard widgets, and their default | The following is a list of all the standard widgets, and their default | |||
bindings in emacs mode, vi command mode and vi insert mode (the | bindings in emacs mode, vi command mode and vi insert mode (the | |||
`emacs', `vicmd' and `viins' keymaps, respectively). | `emacs', `vicmd' and `viins' keymaps, respectively). | |||
Note that cursor keys are bound to movement keys in all three keymaps; | Note that cursor keys are bound to movement keys in all three keymaps; | |||
the shell assumes that the cursor keys send the key sequences reported | the shell assumes that the cursor keys send the key sequences reported | |||
by the terminal-handling library (termcap or terminfo). The key | by the terminal-handling library (termcap or terminfo). The key | |||
skipping to change at line 6676 | skipping to change at line 6719 | |||
* Movement:: | * Movement:: | |||
* History Control:: | * History Control:: | |||
* Modifying Text:: | * Modifying Text:: | |||
* Arguments:: | * Arguments:: | |||
* Completion:: | * Completion:: | |||
* Miscellaneous:: | * Miscellaneous:: | |||
* Text Objects:: | * Text Objects:: | |||
File: zsh.info, Node: Movement, Next: History Control, Up: Zle Widgets | File: zsh.info, Node: Movement, Next: History Control, Up: Standard Widgets | |||
18.6.1 Movement | 18.6.1 Movement | |||
--------------- | --------------- | |||
vi-backward-blank-word (unbound) (B) (unbound) | vi-backward-blank-word (unbound) (B) (unbound) | |||
Move backward one word, where a word is defined as a series of | Move backward one word, where a word is defined as a series of | |||
non-blank characters. | non-blank characters. | |||
vi-backward-blank-word-end (unbound) (gE) (unbound) | vi-backward-blank-word-end (unbound) (gE) (unbound) | |||
Move to the end of the previous word, where a word is defined as a | Move to the end of the previous word, where a word is defined as a | |||
End of changes. 56 change blocks. | ||||
186 lines changed or deleted | 231 lines changed or added |