1ZSHOPTIONS(1) General Commands Manual ZSHOPTIONS(1)
2
3
4
6 zshoptions - zsh options
7
9 Options are primarily referred to by name. These names are case insen‐
10 sitive and underscores are ignored. For example, `allexport' is equiv‐
11 alent to `A__lleXP_ort'.
12
13 The sense of an option name may be inverted by preceding it with `no',
14 so `setopt No_Beep' is equivalent to `unsetopt beep'. This inversion
15 can only be done once, so `nonobeep' is not a synonym for `beep'. Sim‐
16 ilarly, `tify' is not a synonym for `nonotify' (the inversion of
17 `notify').
18
19 Some options also have one or more single letter names. There are two
20 sets of single letter options: one used by default, and another used to
21 emulate sh/ksh (used when the SH_OPTION_LETTERS option is set). The
22 single letter options can be used on the shell command line, or with
23 the set, setopt and unsetopt builtins, as normal Unix options preceded
24 by `-'.
25
26 The sense of the single letter options may be inverted by using `+'
27 instead of `-'. Some of the single letter option names refer to an
28 option being off, in which case the inversion of that name refers to
29 the option being on. For example, `+n' is the short name of `exec',
30 and `-n' is the short name of its inversion, `noexec'.
31
32 In strings of single letter options supplied to the shell at startup,
33 trailing whitespace will be ignored; for example the string `-f '
34 will be treated just as `-f', but the string `-f i' is an error. This
35 is because many systems which implement the `#!' mechanism for calling
36 scripts do not strip trailing whitespace.
37
39 In the following list, options set by default in all emulations are
40 marked <D>; those set by default only in csh, ksh, sh, or zsh emula‐
41 tions are marked <C>, <K>, <S>, <Z> as appropriate. When listing
42 options (by `setopt', `unsetopt', `set -o' or `set +o'), those turned
43 on by default appear in the list prefixed with `no'. Hence (unless
44 KSH_OPTION_PRINT is set), `setopt' shows all options whose settings are
45 changed from the default.
46
47 Changing Directories
48 AUTO_CD (-J)
49 If a command is issued that can't be executed as a normal com‐
50 mand, and the command is the name of a directory, perform the cd
51 command to that directory. This option is only applicable if
52 the option SHIN_STDIN is set, i.e. if commands are being read
53 from standard input. The option is designed for interactive
54 use; it is recommended that cd be used explicitly in scripts to
55 avoid ambiguity.
56
57 AUTO_PUSHD (-N)
58 Make cd push the old directory onto the directory stack.
59
60 CDABLE_VARS (-T)
61 If the argument to a cd command (or an implied cd with the
62 AUTO_CD option set) is not a directory, and does not begin with
63 a slash, try to expand the expression as if it were preceded by
64 a `~' (see the section `Filename Expansion').
65
66 CHASE_DOTS
67 When changing to a directory containing a path segment `..'
68 which would otherwise be treated as canceling the previous seg‐
69 ment in the path (in other words, `foo/..' would be removed from
70 the path, or if `..' is the first part of the path, the last
71 part of the current working directory would be removed), instead
72 resolve the path to the physical directory. This option is
73 overridden by CHASE_LINKS.
74
75 For example, suppose /foo/bar is a link to the directory
76 /alt/rod. Without this option set, `cd /foo/bar/..' changes to
77 /foo; with it set, it changes to /alt. The same applies if the
78 current directory is /foo/bar and `cd ..' is used. Note that
79 all other symbolic links in the path will also be resolved.
80
81 CHASE_LINKS (-w)
82 Resolve symbolic links to their true values when changing direc‐
83 tory. This also has the effect of CHASE_DOTS, i.e. a `..' path
84 segment will be treated as referring to the physical parent,
85 even if the preceding path segment is a symbolic link.
86
87 POSIX_CD <K> <S>
88 Modifies the behaviour of cd, chdir and pushd commands to make
89 them more compatible with the POSIX standard. The behaviour with
90 the option unset is described in the documentation for the cd
91 builtin in zshbuiltins(1). If the option is set, the shell does
92 not test for directories beneath the local directory (`.') until
93 after all directories in cdpath have been tested.
94
95 Also, if the option is set, the conditions under which the shell
96 prints the new directory after changing to it are modified. It
97 is no longer restricted to interactive shells (although printing
98 of the directory stack with pushd is still limited to interac‐
99 tive shells); and any use of a component of CDPATH, including a
100 `.' but excluding an empty component that is otherwise treated
101 as `.', causes the directory to be printed.
102
103 PUSHD_IGNORE_DUPS
104 Don't push multiple copies of the same directory onto the direc‐
105 tory stack.
106
107 PUSHD_MINUS
108 Exchanges the meanings of `+' and `-' when used with a number to
109 specify a directory in the stack.
110
111 PUSHD_SILENT (-E)
112 Do not print the directory stack after pushd or popd.
113
114 PUSHD_TO_HOME (-D)
115 Have pushd with no arguments act like `pushd $HOME'.
116
117 Completion
118 ALWAYS_LAST_PROMPT <D>
119 If unset, key functions that list completions try to return to
120 the last prompt if given a numeric argument. If set these func‐
121 tions try to return to the last prompt if given no numeric argu‐
122 ment.
123
124 ALWAYS_TO_END
125 If a completion is performed with the cursor within a word, and
126 a full completion is inserted, the cursor is moved to the end of
127 the word. That is, the cursor is moved to the end of the word
128 if either a single match is inserted or menu completion is per‐
129 formed.
130
131 AUTO_LIST (-9) <D>
132 Automatically list choices on an ambiguous completion.
133
134 AUTO_MENU <D>
135 Automatically use menu completion after the second consecutive
136 request for completion, for example by pressing the tab key
137 repeatedly. This option is overridden by MENU_COMPLETE.
138
139 AUTO_NAME_DIRS
140 Any parameter that is set to the absolute name of a directory
141 immediately becomes a name for that directory, that will be used
142 by the `%~' and related prompt sequences, and will be available
143 when completion is performed on a word starting with `~'. (Oth‐
144 erwise, the parameter must be used in the form `~param' first.)
145
146 AUTO_PARAM_KEYS <D>
147 If a parameter name was completed and a following character
148 (normally a space) automatically inserted, and the next charac‐
149 ter typed is one of those that have to come directly after the
150 name (like `}', `:', etc.), the automatically added character is
151 deleted, so that the character typed comes immediately after the
152 parameter name. Completion in a brace expansion is affected
153 similarly: the added character is a `,', which will be removed
154 if `}' is typed next.
155
156 AUTO_PARAM_SLASH <D>
157 If a parameter is completed whose content is the name of a
158 directory, then add a trailing slash instead of a space.
159
160 AUTO_REMOVE_SLASH <D>
161 When the last character resulting from a completion is a slash
162 and the next character typed is a word delimiter, a slash, or a
163 character that ends a command (such as a semicolon or an amper‐
164 sand), remove the slash.
165
166 BASH_AUTO_LIST
167 On an ambiguous completion, automatically list choices when the
168 completion function is called twice in succession. This takes
169 precedence over AUTO_LIST. The setting of LIST_AMBIGUOUS is
170 respected. If AUTO_MENU is set, the menu behaviour will then
171 start with the third press. Note that this will not work with
172 MENU_COMPLETE, since repeated completion calls immediately cycle
173 through the list in that case.
174
175 COMPLETE_ALIASES
176 Prevents aliases on the command line from being internally sub‐
177 stituted before completion is attempted. The effect is to make
178 the alias a distinct command for completion purposes.
179
180 COMPLETE_IN_WORD
181 If unset, the cursor is set to the end of the word if completion
182 is started. Otherwise it stays there and completion is done from
183 both ends.
184
185 GLOB_COMPLETE
186 When the current word has a glob pattern, do not insert all the
187 words resulting from the expansion but generate matches as for
188 completion and cycle through them like MENU_COMPLETE. The
189 matches are generated as if a `*' was added to the end of the
190 word, or inserted at the cursor when COMPLETE_IN_WORD is set.
191 This actually uses pattern matching, not globbing, so it works
192 not only for files but for any completion, such as options, user
193 names, etc.
194
195 Note that when the pattern matcher is used, matching control
196 (for example, case-insensitive or anchored matching) cannot be
197 used. This limitation only applies when the current word con‐
198 tains a pattern; simply turning on the GLOB_COMPLETE option does
199 not have this effect.
200
201 HASH_LIST_ALL <D>
202 Whenever a command completion or spelling correction is
203 attempted, make sure the entire command path is hashed first.
204 This makes the first completion slower but avoids false reports
205 of spelling errors.
206
207 LIST_AMBIGUOUS <D>
208 This option works when AUTO_LIST or BASH_AUTO_LIST is also set.
209 If there is an unambiguous prefix to insert on the command line,
210 that is done without a completion list being displayed; in other
211 words, auto-listing behaviour only takes place when nothing
212 would be inserted. In the case of BASH_AUTO_LIST, this means
213 that the list will be delayed to the third call of the function.
214
215 LIST_BEEP <D>
216 Beep on an ambiguous completion. More accurately, this forces
217 the completion widgets to return status 1 on an ambiguous com‐
218 pletion, which causes the shell to beep if the option BEEP is
219 also set; this may be modified if completion is called from a
220 user-defined widget.
221
222 LIST_PACKED
223 Try to make the completion list smaller (occupying less lines)
224 by printing the matches in columns with different widths.
225
226 LIST_ROWS_FIRST
227 Lay out the matches in completion lists sorted horizontally,
228 that is, the second match is to the right of the first one, not
229 under it as usual.
230
231 LIST_TYPES (-X) <D>
232 When listing files that are possible completions, show the type
233 of each file with a trailing identifying mark.
234
235 MENU_COMPLETE (-Y)
236 On an ambiguous completion, instead of listing possibilities or
237 beeping, insert the first match immediately. Then when comple‐
238 tion is requested again, remove the first match and insert the
239 second match, etc. When there are no more matches, go back to
240 the first one again. reverse-menu-complete may be used to loop
241 through the list in the other direction. This option overrides
242 AUTO_MENU.
243
244 REC_EXACT (-S)
245 If the string on the command line exactly matches one of the
246 possible completions, it is accepted, even if there is another
247 completion (i.e. that string with something else added) that
248 also matches.
249
250 Expansion and Globbing
251 BAD_PATTERN (+2) <C> <Z>
252 If a pattern for filename generation is badly formed, print an
253 error message. (If this option is unset, the pattern will be
254 left unchanged.)
255
256 BARE_GLOB_QUAL <Z>
257 In a glob pattern, treat a trailing set of parentheses as a
258 qualifier list, if it contains no `|', `(' or (if special) `~'
259 characters. See the section `Filename Generation'.
260
261 BRACE_CCL
262 Expand expressions in braces which would not otherwise undergo
263 brace expansion to a lexically ordered list of all the charac‐
264 ters. See the section `Brace Expansion'.
265
266 CASE_GLOB <D>
267 Make globbing (filename generation) sensitive to case. Note
268 that other uses of patterns are always sensitive to case. If
269 the option is unset, the presence of any character which is spe‐
270 cial to filename generation will cause case-insensitive match‐
271 ing. For example, cvs(/) can match the directory CVS owing to
272 the presence of the globbing flag (unless the option
273 BARE_GLOB_QUAL is unset).
274
275 CASE_MATCH <D>
276 Make regular expressions using the zsh/regex module (including
277 matches with =~) sensitive to case.
278
279 CSH_NULL_GLOB <C>
280 If a pattern for filename generation has no matches, delete the
281 pattern from the argument list; do not report an error unless
282 all the patterns in a command have no matches. Overrides
283 NOMATCH.
284
285 EQUALS <Z>
286 Perform = filename expansion. (See the section `Filename Expan‐
287 sion'.)
288
289 EXTENDED_GLOB
290 Treat the `#', `~' and `^' characters as part of patterns for
291 filename generation, etc. (An initial unquoted `~' always pro‐
292 duces named directory expansion.)
293
294 FORCE_FLOAT
295 Constants in arithmetic evaluation will be treated as floating
296 point even without the use of a decimal point; the values of
297 integer variables will be converted to floating point when used
298 in arithmetic expressions. Integers in any base will be con‐
299 verted.
300
301 GLOB (+F, ksh: +f) <D>
302 Perform filename generation (globbing). (See the section `File‐
303 name Generation'.)
304
305 GLOB_ASSIGN <C>
306 If this option is set, filename generation (globbing) is per‐
307 formed on the right hand side of scalar parameter assignments of
308 the form `name=pattern (e.g. `foo=*'). If the result has more
309 than one word the parameter will become an array with those
310 words as arguments. This option is provided for backwards com‐
311 patibility only: globbing is always performed on the right hand
312 side of array assignments of the form `name=(value)' (e.g.
313 `foo=(*)') and this form is recommended for clarity; with this
314 option set, it is not possible to predict whether the result
315 will be an array or a scalar.
316
317 GLOB_DOTS (-4)
318 Do not require a leading `.' in a filename to be matched explic‐
319 itly.
320
321 GLOB_STAR_SHORT
322 When this option is set and the default zsh-style globbing is in
323 effect, the pattern `**/*' can be abbreviated to `**' and the
324 pattern `***/*' can be abbreviated to ***. Hence `**.c' finds a
325 file ending in .c in any subdirectory, and `***.c' does the same
326 while also following symbolic links. A / immediately after the
327 `**' or `***' forces the pattern to be treated as the unabbrevi‐
328 ated form.
329
330 GLOB_SUBST <C> <K> <S>
331 Treat any characters resulting from parameter expansion as being
332 eligible for filename expansion and filename generation, and any
333 characters resulting from command substitution as being eligible
334 for filename generation. Braces (and commas in between) do not
335 become eligible for expansion.
336
337 HIST_SUBST_PATTERN
338 Substitutions using the :s and :& history modifiers are per‐
339 formed with pattern matching instead of string matching. This
340 occurs wherever history modifiers are valid, including glob
341 qualifiers and parameters. See the section Modifiers in zsh‐
342 expn(1).
343
344 IGNORE_BRACES (-I) <S>
345 Do not perform brace expansion. For historical reasons this
346 also includes the effect of the IGNORE_CLOSE_BRACES option.
347
348 IGNORE_CLOSE_BRACES
349 When neither this option nor IGNORE_BRACES is set, a sole close
350 brace character `}' is syntactically significant at any point on
351 a command line. This has the effect that no semicolon or new‐
352 line is necessary before the brace terminating a function or
353 current shell construct. When either option is set, a closing
354 brace is syntactically significant only in command position.
355 Unlike IGNORE_BRACES, this option does not disable brace expan‐
356 sion.
357
358 For example, with both options unset a function may be defined
359 in the following fashion:
360
361 args() { echo $# }
362
363 while if either option is set, this does not work and something
364 equivalent to the following is required:
365
366 args() { echo $#; }
367
368 KSH_GLOB <K>
369 In pattern matching, the interpretation of parentheses is
370 affected by a preceding `@', `*', `+', `?' or `!'. See the sec‐
371 tion `Filename Generation'.
372
373 MAGIC_EQUAL_SUBST
374 All unquoted arguments of the form `anything=expression' appear‐
375 ing after the command name have filename expansion (that is,
376 where expression has a leading `~' or `=') performed on expres‐
377 sion as if it were a parameter assignment. The argument is not
378 otherwise treated specially; it is passed to the command as a
379 single argument, and not used as an actual parameter assignment.
380 For example, in echo foo=~/bar:~/rod, both occurrences of ~
381 would be replaced. Note that this happens anyway with typeset
382 and similar statements.
383
384 This option respects the setting of the KSH_TYPESET option. In
385 other words, if both options are in effect, arguments looking
386 like assignments will not undergo word splitting.
387
388 MARK_DIRS (-8, ksh: -X)
389 Append a trailing `/' to all directory names resulting from
390 filename generation (globbing).
391
392 MULTIBYTE <D>
393 Respect multibyte characters when found in strings. When this
394 option is set, strings are examined using the system library to
395 determine how many bytes form a character, depending on the cur‐
396 rent locale. This affects the way characters are counted in
397 pattern matching, parameter values and various delimiters.
398
399 The option is on by default if the shell was compiled with
400 MULTIBYTE_SUPPORT; otherwise it is off by default and has no
401 effect if turned on.
402
403 If the option is off a single byte is always treated as a single
404 character. This setting is designed purely for examining
405 strings known to contain raw bytes or other values that may not
406 be characters in the current locale. It is not necessary to
407 unset the option merely because the character set for the cur‐
408 rent locale does not contain multibyte characters.
409
410 The option does not affect the shell's editor, which always
411 uses the locale to determine multibyte characters. This is
412 because the character set displayed by the terminal emulator is
413 independent of shell settings.
414
415 NOMATCH (+3) <C> <Z>
416 If a pattern for filename generation has no matches, print an
417 error, instead of leaving it unchanged in the argument list.
418 This also applies to file expansion of an initial `~' or `='.
419
420 NULL_GLOB (-G)
421 If a pattern for filename generation has no matches, delete the
422 pattern from the argument list instead of reporting an error.
423 Overrides NOMATCH.
424
425 NUMERIC_GLOB_SORT
426 If numeric filenames are matched by a filename generation pat‐
427 tern, sort the filenames numerically rather than lexicographi‐
428 cally.
429
430 RC_EXPAND_PARAM (-P)
431 Array expansions of the form `foo${xx}bar', where the parameter
432 xx is set to (a b c), are substituted with `fooabar foobbar
433 foocbar' instead of the default `fooa b cbar'. Note that an
434 empty array will therefore cause all arguments to be removed.
435
436 REMATCH_PCRE
437 If set, regular expression matching with the =~ operator will
438 use Perl-Compatible Regular Expressions from the PCRE library.
439 (The zsh/pcre module must be available.) If not set, regular
440 expressions will use the extended regexp syntax provided by the
441 system libraries.
442
443 SH_GLOB <K> <S>
444 Disables the special meaning of `(', `|', `)' and '<' for glob‐
445 bing the result of parameter and command substitutions, and in
446 some other places where the shell accepts patterns. If SH_GLOB
447 is set but KSH_GLOB is not, the shell allows the interpretation
448 of subshell expressions enclosed in parentheses in some cases
449 where there is no space before the opening parenthesis, e.g.
450 !(true) is interpreted as if there were a space after the !.
451 This option is set by default if zsh is invoked as sh or ksh.
452
453 UNSET (+u, ksh: +u) <K> <S> <Z>
454 Treat unset parameters as if they were empty when substituting,
455 and as if they were zero when reading their values in arithmetic
456 expansion and arithmetic commands. Otherwise they are treated
457 as an error.
458
459 WARN_CREATE_GLOBAL
460 Print a warning message when a global parameter is created in a
461 function by an assignment or in math context. This often indi‐
462 cates that a parameter has not been declared local when it
463 should have been. Parameters explicitly declared global from
464 within a function using typeset -g do not cause a warning. Note
465 that there is no warning when a local parameter is assigned to
466 in a nested function, which may also indicate an error.
467
468 WARN_NESTED_VAR
469 Print a warning message when an existing parameter from an
470 enclosing function scope, or global, is set in a function by an
471 assignment or in math context. Assignment to shell special
472 parameters does not cause a warning. This is the companion to
473 WARN_CREATE_GLOBAL as in this case the warning is only printed
474 when a parameter is not created. Where possible, use of typeset
475 -g to set the parameter suppresses the error, but note that this
476 needs to be used every time the parameter is set. To restrict
477 the effect of this option to a single function scope, use `func‐
478 tions -W'.
479
480 For example, the following code produces a warning for the
481 assignment inside the function nested as that overrides the
482 value within toplevel
483
484 toplevel() {
485 local foo="in fn"
486 nested
487 }
488 nested() {
489 foo="in nested"
490 }
491 setopt warn_nested_var
492 toplevel
493
494 History
495 APPEND_HISTORY <D>
496 If this is set, zsh sessions will append their history list to
497 the history file, rather than replace it. Thus, multiple paral‐
498 lel zsh sessions will all have the new entries from their his‐
499 tory lists added to the history file, in the order that they
500 exit. The file will still be periodically re-written to trim it
501 when the number of lines grows 20% beyond the value specified by
502 $SAVEHIST (see also the HIST_SAVE_BY_COPY option).
503
504 BANG_HIST (+K) <C> <Z>
505 Perform textual history expansion, csh-style, treating the char‐
506 acter `!' specially.
507
508 EXTENDED_HISTORY <C>
509 Save each command's beginning timestamp (in seconds since the
510 epoch) and the duration (in seconds) to the history file. The
511 format of this prefixed data is:
512
513 `: <beginning time>:<elapsed seconds>;<command>'.
514
515 HIST_ALLOW_CLOBBER
516 Add `|' to output redirections in the history. This allows his‐
517 tory references to clobber files even when CLOBBER is unset.
518
519 HIST_BEEP <D>
520 Beep in ZLE when a widget attempts to access a history entry
521 which isn't there.
522
523 HIST_EXPIRE_DUPS_FIRST
524 If the internal history needs to be trimmed to add the current
525 command line, setting this option will cause the oldest history
526 event that has a duplicate to be lost before losing a unique
527 event from the list. You should be sure to set the value of
528 HISTSIZE to a larger number than SAVEHIST in order to give you
529 some room for the duplicated events, otherwise this option will
530 behave just like HIST_IGNORE_ALL_DUPS once the history fills up
531 with unique events.
532
533 HIST_FCNTL_LOCK
534 When writing out the history file, by default zsh uses ad-hoc
535 file locking to avoid known problems with locking on some oper‐
536 ating systems. With this option locking is done by means of the
537 system's fcntl call, where this method is available. On recent
538 operating systems this may provide better performance, in par‐
539 ticular avoiding history corruption when files are stored on
540 NFS.
541
542 HIST_FIND_NO_DUPS
543 When searching for history entries in the line editor, do not
544 display duplicates of a line previously found, even if the
545 duplicates are not contiguous.
546
547 HIST_IGNORE_ALL_DUPS
548 If a new command line being added to the history list duplicates
549 an older one, the older command is removed from the list (even
550 if it is not the previous event).
551
552 HIST_IGNORE_DUPS (-h)
553 Do not enter command lines into the history list if they are
554 duplicates of the previous event.
555
556 HIST_IGNORE_SPACE (-g)
557 Remove command lines from the history list when the first char‐
558 acter on the line is a space, or when one of the expanded
559 aliases contains a leading space. Only normal aliases (not
560 global or suffix aliases) have this behaviour. Note that the
561 command lingers in the internal history until the next command
562 is entered before it vanishes, allowing you to briefly reuse or
563 edit the line. If you want to make it vanish right away without
564 entering another command, type a space and press return.
565
566 HIST_LEX_WORDS
567 By default, shell history that is read in from files is split
568 into words on all white space. This means that arguments with
569 quoted whitespace are not correctly handled, with the conse‐
570 quence that references to words in history lines that have been
571 read from a file may be inaccurate. When this option is set,
572 words read in from a history file are divided up in a similar
573 fashion to normal shell command line handling. Although this
574 produces more accurately delimited words, if the size of the
575 history file is large this can be slow. Trial and error is nec‐
576 essary to decide.
577
578 HIST_NO_FUNCTIONS
579 Remove function definitions from the history list. Note that
580 the function lingers in the internal history until the next com‐
581 mand is entered before it vanishes, allowing you to briefly re‐
582 use or edit the definition.
583
584 HIST_NO_STORE
585 Remove the history (fc -l) command from the history list when
586 invoked. Note that the command lingers in the internal history
587 until the next command is entered before it vanishes, allowing
588 you to briefly reuse or edit the line.
589
590 HIST_REDUCE_BLANKS
591 Remove superfluous blanks from each command line being added to
592 the history list.
593
594 HIST_SAVE_BY_COPY <D>
595 When the history file is re-written, we normally write out a
596 copy of the file named $HISTFILE.new and then rename it over the
597 old one. However, if this option is unset, we instead truncate
598 the old history file and write out the new version in-place. If
599 one of the history-appending options is enabled, this option
600 only has an effect when the enlarged history file needs to be
601 re-written to trim it down to size. Disable this only if you
602 have special needs, as doing so makes it possible to lose his‐
603 tory entries if zsh gets interrupted during the save.
604
605 When writing out a copy of the history file, zsh preserves the
606 old file's permissions and group information, but will refuse to
607 write out a new file if it would change the history file's
608 owner.
609
610 HIST_SAVE_NO_DUPS
611 When writing out the history file, older commands that duplicate
612 newer ones are omitted.
613
614 HIST_VERIFY
615 Whenever the user enters a line with history expansion, don't
616 execute the line directly; instead, perform history expansion
617 and reload the line into the editing buffer.
618
619 INC_APPEND_HISTORY
620 This option works like APPEND_HISTORY except that new history
621 lines are added to the $HISTFILE incrementally (as soon as they
622 are entered), rather than waiting until the shell exits. The
623 file will still be periodically re-written to trim it when the
624 number of lines grows 20% beyond the value specified by $SAVE‐
625 HIST (see also the HIST_SAVE_BY_COPY option).
626
627 INC_APPEND_HISTORY_TIME
628 This option is a variant of INC_APPEND_HISTORY in which, where
629 possible, the history entry is written out to the file after the
630 command is finished, so that the time taken by the command is
631 recorded correctly in the history file in EXTENDED_HISTORY for‐
632 mat. This means that the history entry will not be available
633 immediately from other instances of the shell that are using the
634 same history file.
635
636 This option is only useful if INC_APPEND_HISTORY and SHARE_HIS‐
637 TORY are turned off. The three options should be considered
638 mutually exclusive.
639
640 SHARE_HISTORY <K>
641
642 This option both imports new commands from the history file, and
643 also causes your typed commands to be appended to the history
644 file (the latter is like specifying INC_APPEND_HISTORY, which
645 should be turned off if this option is in effect). The history
646 lines are also output with timestamps ala EXTENDED_HISTORY
647 (which makes it easier to find the spot where we left off read‐
648 ing the file after it gets re-written).
649
650 By default, history movement commands visit the imported lines
651 as well as the local lines, but you can toggle this on and off
652 with the set-local-history zle binding. It is also possible to
653 create a zle widget that will make some commands ignore imported
654 commands, and some include them.
655
656 If you find that you want more control over when commands get
657 imported, you may wish to turn SHARE_HISTORY off,
658 INC_APPEND_HISTORY or INC_APPEND_HISTORY_TIME (see above) on,
659 and then manually import commands whenever you need them using
660 `fc -RI'.
661
662 Initialisation
663 ALL_EXPORT (-a, ksh: -a)
664 All parameters subsequently defined are automatically exported.
665
666 GLOBAL_EXPORT <Z>
667 If this option is set, passing the -x flag to the builtins
668 declare, float, integer, readonly and typeset (but not local)
669 will also set the -g flag; hence parameters exported to the
670 environment will not be made local to the enclosing function,
671 unless they were already or the flag +g is given explicitly. If
672 the option is unset, exported parameters will be made local in
673 just the same way as any other parameter.
674
675 This option is set by default for backward compatibility; it is
676 not recommended that its behaviour be relied upon. Note that
677 the builtin export always sets both the -x and -g flags, and
678 hence its effect extends beyond the scope of the enclosing func‐
679 tion; this is the most portable way to achieve this behaviour.
680
681 GLOBAL_RCS (-d) <D>
682 If this option is unset, the startup files /etc/zprofile,
683 /etc/zshrc, /etc/zlogin and /etc/zlogout will not be run. It
684 can be disabled and re-enabled at any time, including inside
685 local startup files (.zshrc, etc.).
686
687 RCS (+f) <D>
688 After /etc/zshenv is sourced on startup, source the .zshenv,
689 /etc/zprofile, .zprofile, /etc/zshrc, .zshrc, /etc/zlogin, .zlo‐
690 gin, and .zlogout files, as described in the section `Files'.
691 If this option is unset, the /etc/zshenv file is still sourced,
692 but any of the others will not be; it can be set at any time to
693 prevent the remaining startup files after the currently execut‐
694 ing one from being sourced.
695
696 Input/Output
697 ALIASES <D>
698 Expand aliases.
699
700 CLOBBER (+C, ksh: +C) <D>
701 Allows `>' redirection to truncate existing files. Otherwise
702 `>!' or `>|' must be used to truncate a file.
703
704 If the option is not set, and the option APPEND_CREATE is also
705 not set, `>>!' or `>>|' must be used to create a file. If
706 either option is set, `>>' may be used.
707
708 CORRECT (-0)
709 Try to correct the spelling of commands. Note that, when the
710 HASH_LIST_ALL option is not set or when some directories in the
711 path are not readable, this may falsely report spelling errors
712 the first time some commands are used.
713
714 The shell variable CORRECT_IGNORE may be set to a pattern to
715 match words that will never be offered as corrections.
716
717 CORRECT_ALL (-O)
718 Try to correct the spelling of all arguments in a line.
719
720 The shell variable CORRECT_IGNORE_FILE may be set to a pattern
721 to match file names that will never be offered as corrections.
722
723 DVORAK Use the Dvorak keyboard instead of the standard qwerty keyboard
724 as a basis for examining spelling mistakes for the CORRECT and
725 CORRECT_ALL options and the spell-word editor command.
726
727 FLOW_CONTROL <D>
728 If this option is unset, output flow control via start/stop
729 characters (usually assigned to ^S/^Q) is disabled in the
730 shell's editor.
731
732 IGNORE_EOF (-7)
733 Do not exit on end-of-file. Require the use of exit or logout
734 instead. However, ten consecutive EOFs will cause the shell to
735 exit anyway, to avoid the shell hanging if its tty goes away.
736
737 Also, if this option is set and the Zsh Line Editor is used,
738 widgets implemented by shell functions can be bound to EOF (nor‐
739 mally Control-D) without printing the normal warning message.
740 This works only for normal widgets, not for completion widgets.
741
742 INTERACTIVE_COMMENTS (-k) <K> <S>
743 Allow comments even in interactive shells.
744
745 HASH_CMDS <D>
746 Note the location of each command the first time it is executed.
747 Subsequent invocations of the same command will use the saved
748 location, avoiding a path search. If this option is unset, no
749 path hashing is done at all. However, when CORRECT is set, com‐
750 mands whose names do not appear in the functions or aliases hash
751 tables are hashed in order to avoid reporting them as spelling
752 errors.
753
754 HASH_DIRS <D>
755 Whenever a command name is hashed, hash the directory containing
756 it, as well as all directories that occur earlier in the path.
757 Has no effect if neither HASH_CMDS nor CORRECT is set.
758
759 HASH_EXECUTABLES_ONLY
760 When hashing commands because of HASH_CMDS, check that the file
761 to be hashed is actually an executable. This option is unset by
762 default as if the path contains a large number of commands, or
763 consists of many remote files, the additional tests can take a
764 long time. Trial and error is needed to show if this option is
765 beneficial.
766
767 MAIL_WARNING (-U)
768 Print a warning message if a mail file has been accessed since
769 the shell last checked.
770
771 PATH_DIRS (-Q)
772 Perform a path search even on command names with slashes in
773 them. Thus if `/usr/local/bin' is in the user's path, and he or
774 she types `X11/xinit', the command `/usr/local/bin/X11/xinit'
775 will be executed (assuming it exists). Commands explicitly
776 beginning with `/', `./' or `../' are not subject to the path
777 search. This also applies to the `.' and source builtins.
778
779 Note that subdirectories of the current directory are always
780 searched for executables specified in this form. This takes
781 place before any search indicated by this option, and regardless
782 of whether `.' or the current directory appear in the command
783 search path.
784
785 PATH_SCRIPT <K> <S>
786 If this option is not set, a script passed as the first
787 non-option argument to the shell must contain the name of the
788 file to open. If this option is set, and the script does not
789 specify a directory path, the script is looked for first in the
790 current directory, then in the command path. See the section
791 INVOCATION in zsh(1).
792
793 PRINT_EIGHT_BIT
794 Print eight bit characters literally in completion lists, etc.
795 This option is not necessary if your system correctly returns
796 the printability of eight bit characters (see ctype(3)).
797
798 PRINT_EXIT_VALUE (-1)
799 Print the exit value of programs with non-zero exit status.
800 This is only available at the command line in interactive
801 shells.
802
803 RC_QUOTES
804 Allow the character sequence `''' to signify a single quote
805 within singly quoted strings. Note this does not apply in
806 quoted strings using the format $'...', where a backslashed sin‐
807 gle quote can be used.
808
809 RM_STAR_SILENT (-H) <K> <S>
810 Do not query the user before executing `rm *' or `rm path/*'.
811
812 RM_STAR_WAIT
813 If querying the user before executing `rm *' or `rm path/*',
814 first wait ten seconds and ignore anything typed in that time.
815 This avoids the problem of reflexively answering `yes' to the
816 query when one didn't really mean it. The wait and query can
817 always be avoided by expanding the `*' in ZLE (with tab).
818
819 SHORT_LOOPS <C> <Z>
820 Allow the short forms of for, repeat, select, if, and function
821 constructs.
822
823 SUN_KEYBOARD_HACK (-L)
824 If a line ends with a backquote, and there are an odd number of
825 backquotes on the line, ignore the trailing backquote. This is
826 useful on some keyboards where the return key is too small, and
827 the backquote key lies annoyingly close to it. As an alterna‐
828 tive the variable KEYBOARD_HACK lets you choose the character to
829 be removed.
830
831 Job Control
832 AUTO_CONTINUE
833 With this option set, stopped jobs that are removed from the job
834 table with the disown builtin command are automatically sent a
835 CONT signal to make them running.
836
837 AUTO_RESUME (-W)
838 Treat single word simple commands without redirection as candi‐
839 dates for resumption of an existing job.
840
841 BG_NICE (-6) <C> <Z>
842 Run all background jobs at a lower priority. This option is set
843 by default.
844
845 CHECK_JOBS <Z>
846 Report the status of background and suspended jobs before exit‐
847 ing a shell with job control; a second attempt to exit the shell
848 will succeed. NO_CHECK_JOBS is best used only in combination
849 with NO_HUP, else such jobs will be killed automatically.
850
851 The check is omitted if the commands run from the previous com‐
852 mand line included a `jobs' command, since it is assumed the
853 user is aware that there are background or suspended jobs. A
854 `jobs' command run from one of the hook functions defined in the
855 section SPECIAL FUNCTIONS in zshmisc(1) is not counted for this
856 purpose.
857
858 CHECK_RUNNING_JOBS <Z>
859 Check for both running and suspended jobs when CHECK_JOBS is
860 enabled. When this option is disabled, zsh checks only for sus‐
861 pended jobs, which matches the default behavior of bash.
862
863 This option has no effect unless CHECK_JOBS is set.
864
865 HUP <Z>
866 Send the HUP signal to running jobs when the shell exits.
867
868 LONG_LIST_JOBS (-R)
869 Print job notifications in the long format by default.
870
871 MONITOR (-m, ksh: -m)
872 Allow job control. Set by default in interactive shells.
873
874 NOTIFY (-5, ksh: -b) <Z>
875 Report the status of background jobs immediately, rather than
876 waiting until just before printing a prompt.
877
878 POSIX_JOBS <K> <S>
879 This option makes job control more compliant with the POSIX
880 standard.
881
882 When the option is not set, the MONITOR option is unset on entry
883 to subshells, so that job control is no longer active. When the
884 option is set, the MONITOR option and job control remain active
885 in the subshell, but note that the subshell has no access to
886 jobs in the parent shell.
887
888 When the option is not set, jobs put in the background or fore‐
889 ground with bg or fg are displayed with the same information
890 that would be reported by jobs. When the option is set, only
891 the text is printed. The output from jobs itself is not
892 affected by the option.
893
894 When the option is not set, job information from the parent
895 shell is saved for output within a subshell (for example, within
896 a pipeline). When the option is set, the output of jobs is
897 empty until a job is started within the subshell.
898
899 In previous versions of the shell, it was necessary to enable
900 POSIX_JOBS in order for the builtin command wait to return the
901 status of background jobs that had already exited. This is no
902 longer the case.
903
904 Prompting
905 PROMPT_BANG <K>
906 If set, `!' is treated specially in prompt expansion. See
907 EXPANSION OF PROMPT SEQUENCES in zshmisc(1).
908
909 PROMPT_CR (+V) <D>
910 Print a carriage return just before printing a prompt in the
911 line editor. This is on by default as multi-line editing is
912 only possible if the editor knows where the start of the line
913 appears.
914
915 PROMPT_SP <D>
916 Attempt to preserve a partial line (i.e. a line that did not end
917 with a newline) that would otherwise be covered up by the com‐
918 mand prompt due to the PROMPT_CR option. This works by out‐
919 putting some cursor-control characters, including a series of
920 spaces, that should make the terminal wrap to the next line when
921 a partial line is present (note that this is only successful if
922 your terminal has automatic margins, which is typical).
923
924 When a partial line is preserved, by default you will see an
925 inverse+bold character at the end of the partial line: a `%'
926 for a normal user or a `#' for root. If set, the shell parame‐
927 ter PROMPT_EOL_MARK can be used to customize how the end of par‐
928 tial lines are shown.
929
930 NOTE: if the PROMPT_CR option is not set, enabling this option
931 will have no effect. This option is on by default.
932
933 PROMPT_PERCENT <C> <Z>
934 If set, `%' is treated specially in prompt expansion. See
935 EXPANSION OF PROMPT SEQUENCES in zshmisc(1).
936
937 PROMPT_SUBST <K> <S>
938 If set, parameter expansion, command substitution and arithmetic
939 expansion are performed in prompts. Substitutions within
940 prompts do not affect the command status.
941
942 TRANSIENT_RPROMPT
943 Remove any right prompt from display when accepting a command
944 line. This may be useful with terminals with other cut/paste
945 methods.
946
947 Scripts and Functions
948 ALIAS_FUNC_DEF <S>
949 By default, zsh does not allow the definition of functions using
950 the `name ()' syntax if name was expanded as an alias: this
951 causes an error. This is usually the desired behaviour, as oth‐
952 erwise the combination of an alias and a function based on the
953 same definition can easily cause problems.
954
955 When this option is set, aliases can be used for defining func‐
956 tions.
957
958 For example, consider the following definitions as they might
959 occur in a startup file.
960
961 alias foo=bar
962 foo() {
963 print This probably does not do what you expect.
964 }
965
966 Here, foo is expanded as an alias to bar before the () is
967 encountered, so the function defined would be named bar. By
968 default this is instead an error in native mode. Note that
969 quoting any part of the function name, or using the keyword
970 function, avoids the problem, so is recommended when the func‐
971 tion name can also be an alias.
972
973 C_BASES
974 Output hexadecimal numbers in the standard C format, for example
975 `0xFF' instead of the usual `16#FF'. If the option OCTAL_ZEROES
976 is also set (it is not by default), octal numbers will be
977 treated similarly and hence appear as `077' instead of `8#77'.
978 This option has no effect on the choice of the output base, nor
979 on the output of bases other than hexadecimal and octal. Note
980 that these formats will be understood on input irrespective of
981 the setting of C_BASES.
982
983 C_PRECEDENCES
984 This alters the precedence of arithmetic operators to be more
985 like C and other programming languages; the section ARITHMETIC
986 EVALUATION in zshmisc(1) has an explicit list.
987
988 DEBUG_BEFORE_CMD <D>
989 Run the DEBUG trap before each command; otherwise it is run
990 after each command. Setting this option mimics the behaviour of
991 ksh 93; with the option unset the behaviour is that of ksh 88.
992
993 ERR_EXIT (-e, ksh: -e)
994 If a command has a non-zero exit status, execute the ZERR trap,
995 if set, and exit. This is disabled while running initialization
996 scripts.
997
998 The behaviour is also disabled inside DEBUG traps. In this case
999 the option is handled specially: it is unset on entry to the
1000 trap. If the option DEBUG_BEFORE_CMD is set, as it is by
1001 default, and the option ERR_EXIT is found to have been set on
1002 exit, then the command for which the DEBUG trap is being exe‐
1003 cuted is skipped. The option is restored after the trap exits.
1004
1005 Non-zero status in a command list containing && or || is ignored
1006 for commands not at the end of the list. Hence
1007
1008 false && true
1009
1010 does not trigger exit.
1011
1012 Exiting due to ERR_EXIT has certain interactions with asynchro‐
1013 nous jobs noted in the section JOBS in zshmisc(1).
1014
1015 ERR_RETURN
1016 If a command has a non-zero exit status, return immediately from
1017 the enclosing function. The logic is similar to that for
1018 ERR_EXIT, except that an implicit return statement is executed
1019 instead of an exit. This will trigger an exit at the outermost
1020 level of a non-interactive script.
1021
1022 Normally this option inherits the behaviour of ERR_EXIT that
1023 code followed by `&&' `||' does not trigger a return. Hence in
1024 the following:
1025
1026 summit || true
1027
1028 no return is forced as the combined effect always has a zero
1029 return status.
1030
1031 Note. however, that if summit in the above example is itself a
1032 function, code inside it is considered separately: it may force
1033 a return from summit (assuming the option remains set within
1034 summit), but not from the enclosing context. This behaviour is
1035 different from ERR_EXIT which is unaffected by function scope.
1036
1037 EVAL_LINENO <Z>
1038 If set, line numbers of expressions evaluated using the builtin
1039 eval are tracked separately of the enclosing environment. This
1040 applies both to the parameter LINENO and the line number output
1041 by the prompt escape %i. If the option is set, the prompt
1042 escape %N will output the string `(eval)' instead of the script
1043 or function name as an indication. (The two prompt escapes are
1044 typically used in the parameter PS4 to be output when the option
1045 XTRACE is set.) If EVAL_LINENO is unset, the line number of the
1046 surrounding script or function is retained during the evalua‐
1047 tion.
1048
1049 EXEC (+n, ksh: +n) <D>
1050 Do execute commands. Without this option, commands are read and
1051 checked for syntax errors, but not executed. This option cannot
1052 be turned off in an interactive shell, except when `-n' is sup‐
1053 plied to the shell at startup.
1054
1055 FUNCTION_ARGZERO <C> <Z>
1056 When executing a shell function or sourcing a script, set $0
1057 temporarily to the name of the function/script. Note that tog‐
1058 gling FUNCTION_ARGZERO from on to off (or off to on) does not
1059 change the current value of $0. Only the state upon entry to
1060 the function or script has an effect. Compare POSIX_ARGZERO.
1061
1062 LOCAL_LOOPS
1063 When this option is not set, the effect of break and continue
1064 commands may propagate outside function scope, affecting loops
1065 in calling functions. When the option is set in a calling func‐
1066 tion, a break or a continue that is not caught within a called
1067 function (regardless of the setting of the option within that
1068 function) produces a warning and the effect is cancelled.
1069
1070 LOCAL_OPTIONS <K>
1071 If this option is set at the point of return from a shell func‐
1072 tion, most options (including this one) which were in force upon
1073 entry to the function are restored; options that are not
1074 restored are PRIVILEGED and RESTRICTED. Otherwise, only this
1075 option, and the LOCAL_LOOPS, XTRACE and PRINT_EXIT_VALUE options
1076 are restored. Hence if this is explicitly unset by a shell
1077 function the other options in force at the point of return will
1078 remain so. A shell function can also guarantee itself a known
1079 shell configuration with a formulation like `emulate -L zsh';
1080 the -L activates LOCAL_OPTIONS.
1081
1082 LOCAL_PATTERNS
1083 If this option is set at the point of return from a shell func‐
1084 tion, the state of pattern disables, as set with the builtin
1085 command `disable -p', is restored to what it was when the func‐
1086 tion was entered. The behaviour of this option is similar to
1087 the effect of LOCAL_OPTIONS on options; hence `emulate -L sh'
1088 (or indeed any other emulation with the -L option) activates
1089 LOCAL_PATTERNS.
1090
1091 LOCAL_TRAPS <K>
1092 If this option is set when a signal trap is set inside a func‐
1093 tion, then the previous status of the trap for that signal will
1094 be restored when the function exits. Note that this option must
1095 be set prior to altering the trap behaviour in a function;
1096 unlike LOCAL_OPTIONS, the value on exit from the function is
1097 irrelevant. However, it does not need to be set before any
1098 global trap for that to be correctly restored by a function.
1099 For example,
1100
1101 unsetopt localtraps
1102 trap - INT
1103 fn() { setopt localtraps; trap '' INT; sleep 3; }
1104
1105 will restore normal handling of SIGINT after the function exits.
1106
1107 MULTI_FUNC_DEF <Z>
1108 Allow definitions of multiple functions at once in the form `fn1
1109 fn2...()'; if the option is not set, this causes a parse error.
1110 Definition of multiple functions with the function keyword is
1111 always allowed. Multiple function definitions are not often
1112 used and can cause obscure errors.
1113
1114 MULTIOS <Z>
1115 Perform implicit tees or cats when multiple redirections are
1116 attempted (see the section `Redirection').
1117
1118 OCTAL_ZEROES <S>
1119 Interpret any integer constant beginning with a 0 as octal, per
1120 IEEE Std 1003.2-1992 (ISO 9945-2:1993). This is not enabled by
1121 default as it causes problems with parsing of, for example, date
1122 and time strings with leading zeroes.
1123
1124 Sequences of digits indicating a numeric base such as the `08'
1125 component in `08#77' are always interpreted as decimal, regard‐
1126 less of leading zeroes.
1127
1128 PIPE_FAIL
1129 By default, when a pipeline exits the exit status recorded by
1130 the shell and returned by the shell variable $? reflects that of
1131 the rightmost element of a pipeline. If this option is set, the
1132 exit status instead reflects the status of the rightmost element
1133 of the pipeline that was non-zero, or zero if all elements
1134 exited with zero status.
1135
1136 SOURCE_TRACE
1137 If set, zsh will print an informational message announcing the
1138 name of each file it loads. The format of the output is similar
1139 to that for the XTRACE option, with the message <sourcetrace>.
1140 A file may be loaded by the shell itself when it starts up and
1141 shuts down (Startup/Shutdown Files) or by the use of the
1142 `source' and `dot' builtin commands.
1143
1144 TYPESET_SILENT
1145 If this is unset, executing any of the `typeset' family of com‐
1146 mands with no options and a list of parameters that have no val‐
1147 ues to be assigned but already exist will display the value of
1148 the parameter. If the option is set, they will only be shown
1149 when parameters are selected with the `-m' option. The option
1150 `-p' is available whether or not the option is set.
1151
1152 VERBOSE (-v, ksh: -v)
1153 Print shell input lines as they are read.
1154
1155 XTRACE (-x, ksh: -x)
1156 Print commands and their arguments as they are executed. The
1157 output is preceded by the value of $PS4, formatted as described
1158 in the section EXPANSION OF PROMPT SEQUENCES in zshmisc(1).
1159
1160 Shell Emulation
1161 APPEND_CREATE <K> <S>
1162 This option only applies when NO_CLOBBER (-C) is in effect.
1163
1164 If this option is not set, the shell will report an error when a
1165 append redirection (>>) is used on a file that does not already
1166 exists (the traditional zsh behaviour of NO_CLOBBER). If the
1167 option is set, no error is reported (POSIX behaviour).
1168
1169 BASH_REMATCH
1170 When set, matches performed with the =~ operator will set the
1171 BASH_REMATCH array variable, instead of the default MATCH and
1172 match variables. The first element of the BASH_REMATCH array
1173 will contain the entire matched text and subsequent elements
1174 will contain extracted substrings. This option makes more sense
1175 when KSH_ARRAYS is also set, so that the entire matched portion
1176 is stored at index 0 and the first substring is at index 1.
1177 Without this option, the MATCH variable contains the entire
1178 matched text and the match array variable contains substrings.
1179
1180 BSD_ECHO <S>
1181 Make the echo builtin compatible with the BSD echo(1) command.
1182 This disables backslashed escape sequences in echo strings
1183 unless the -e option is specified.
1184
1185 CONTINUE_ON_ERROR
1186 If a fatal error is encountered (see the section ERRORS in zsh‐
1187 misc(1)), and the code is running in a script, the shell will
1188 resume execution at the next statement in the script at the top
1189 level, in other words outside all functions or shell constructs
1190 such as loops and conditions. This mimics the behaviour of
1191 interactive shells, where the shell returns to the line editor
1192 to read a new command; it was the normal behaviour in versions
1193 of zsh before 5.0.1.
1194
1195 CSH_JUNKIE_HISTORY <C>
1196 A history reference without an event specifier will always refer
1197 to the previous command. Without this option, such a history
1198 reference refers to the same event as the previous history ref‐
1199 erence on the current command line, defaulting to the previous
1200 command.
1201
1202 CSH_JUNKIE_LOOPS <C>
1203 Allow loop bodies to take the form `list; end' instead of `do
1204 list; done'.
1205
1206 CSH_JUNKIE_QUOTES <C>
1207 Changes the rules for single- and double-quoted text to match
1208 that of csh. These require that embedded newlines be preceded
1209 by a backslash; unescaped newlines will cause an error message.
1210 In double-quoted strings, it is made impossible to escape `$',
1211 ``' or `"' (and `\' itself no longer needs escaping). Command
1212 substitutions are only expanded once, and cannot be nested.
1213
1214 CSH_NULLCMD <C>
1215 Do not use the values of NULLCMD and READNULLCMD when running
1216 redirections with no command. This make such redirections fail
1217 (see the section `Redirection').
1218
1219 KSH_ARRAYS <K> <S>
1220 Emulate ksh array handling as closely as possible. If this
1221 option is set, array elements are numbered from zero, an array
1222 parameter without subscript refers to the first element instead
1223 of the whole array, and braces are required to delimit a sub‐
1224 script (`${path[2]}' rather than just `$path[2]') or to apply
1225 modifiers to any parameter (`${PWD:h}' rather than `$PWD:h').
1226
1227 KSH_AUTOLOAD <K> <S>
1228 Emulate ksh function autoloading. This means that when a func‐
1229 tion is autoloaded, the corresponding file is merely executed,
1230 and must define the function itself. (By default, the function
1231 is defined to the contents of the file. However, the most com‐
1232 mon ksh-style case - of the file containing only a simple defi‐
1233 nition of the function - is always handled in the ksh-compatible
1234 manner.)
1235
1236 KSH_OPTION_PRINT <K>
1237 Alters the way options settings are printed: instead of separate
1238 lists of set and unset options, all options are shown, marked
1239 `on' if they are in the non-default state, `off' otherwise.
1240
1241 KSH_TYPESET
1242 This option is now obsolete: a better appropximation to the be‐
1243 haviour of other shells is obtained with the reserved word
1244 interface to declare, export, float, integer, local, readonly
1245 and typeset. Note that the option is only applied when the
1246 reserved word interface is not in use.
1247
1248 Alters the way arguments to the typeset family of commands,
1249 including declare, export, float, integer, local and readonly,
1250 are processed. Without this option, zsh will perform normal
1251 word splitting after command and parameter expansion in argu‐
1252 ments of an assignment; with it, word splitting does not take
1253 place in those cases.
1254
1255 KSH_ZERO_SUBSCRIPT
1256 Treat use of a subscript of value zero in array or string
1257 expressions as a reference to the first element, i.e. the ele‐
1258 ment that usually has the subscript 1. Ignored if KSH_ARRAYS is
1259 also set.
1260
1261 If neither this option nor KSH_ARRAYS is set, accesses to an
1262 element of an array or string with subscript zero return an
1263 empty element or string, while attempts to set element zero of
1264 an array or string are treated as an error. However, attempts
1265 to set an otherwise valid subscript range that includes zero
1266 will succeed. For example, if KSH_ZERO_SUBSCRIPT is not set,
1267
1268 array[0]=(element)
1269
1270 is an error, while
1271
1272 array[0,1]=(element)
1273
1274 is not and will replace the first element of the array.
1275
1276 This option is for compatibility with older versions of the
1277 shell and is not recommended in new code.
1278
1279 POSIX_ALIASES <K> <S>
1280 When this option is set, reserved words are not candidates for
1281 alias expansion: it is still possible to declare any of them as
1282 an alias, but the alias will never be expanded. Reserved words
1283 are described in the section RESERVED WORDS in zshmisc(1).
1284
1285 Alias expansion takes place while text is being read; hence when
1286 this option is set it does not take effect until the end of any
1287 function or other piece of shell code parsed as one unit. Note
1288 this may cause differences from other shells even when the
1289 option is in effect. For example, when running a command with
1290 `zsh -c', or even `zsh -o posixaliases -c', the entire command
1291 argument is parsed as one unit, so aliases defined within the
1292 argument are not available even in later lines. If in doubt,
1293 avoid use of aliases in non-interactive code.
1294
1295 POSIX_ARGZERO
1296 This option may be used to temporarily disable FUNCTION_ARGZERO
1297 and thereby restore the value of $0 to the name used to invoke
1298 the shell (or as set by the -c command line option). For com‐
1299 patibility with previous versions of the shell, emulations use
1300 NO_FUNCTION_ARGZERO instead of POSIX_ARGZERO, which may result
1301 in unexpected scoping of $0 if the emulation mode is changed
1302 inside a function or script. To avoid this, explicitly enable
1303 POSIX_ARGZERO in the emulate command:
1304
1305 emulate sh -o POSIX_ARGZERO
1306
1307 Note that NO_POSIX_ARGZERO has no effect unless FUNCTION_ARGZERO
1308 was already enabled upon entry to the function or script.
1309
1310 POSIX_BUILTINS <K> <S>
1311 When this option is set the command builtin can be used to exe‐
1312 cute shell builtin commands. Parameter assignments specified
1313 before shell functions and special builtins are kept after the
1314 command completes unless the special builtin is prefixed with
1315 the command builtin. Special builtins are ., :, break, con‐
1316 tinue, declare, eval, exit, export, integer, local, readonly,
1317 return, set, shift, source, times, trap and unset.
1318
1319 In addition, various error conditions associated with the above
1320 builtins or exec cause a non-interactive shell to exit and an
1321 interactive shell to return to its top-level processing.
1322
1323 Furthermore, functions and shell builtins are not executed after
1324 an exec prefix; the command to be executed must be an external
1325 command found in the path.
1326
1327 Furthermore, the getopts builtin behaves in a POSIX-compatible
1328 fashion in that the associated variable OPTIND is not made local
1329 to functions.
1330
1331 Moreover, the warning and special exit code from [[ -o non_exis‐
1332 tent_option ]] are suppressed.
1333
1334 POSIX_IDENTIFIERS <K> <S>
1335 When this option is set, only the ASCII characters a to z, A to
1336 Z, 0 to 9 and _ may be used in identifiers (names of shell
1337 parameters and modules).
1338
1339 In addition, setting this option limits the effect of parameter
1340 substitution with no braces, so that the expression $# is
1341 treated as the parameter $# even if followed by a valid parame‐
1342 ter name. When it is unset, zsh allows expressions of the form
1343 $#name to refer to the length of $name, even for special vari‐
1344 ables, for example in expressions such as $#- and $#*.
1345
1346 Another difference is that with the option set assignment to an
1347 unset variable in arithmetic context causes the variable to be
1348 created as a scalar rather than a numeric type. So after `unset
1349 t; (( t = 3 ))'. without POSIX_IDENTIFIERS set t has integer
1350 type, while with it set it has scalar type.
1351
1352 When the option is unset and multibyte character support is
1353 enabled (i.e. it is compiled in and the option MULTIBYTE is
1354 set), then additionally any alphanumeric characters in the local
1355 character set may be used in identifiers. Note that scripts and
1356 functions written with this feature are not portable, and also
1357 that both options must be set before the script or function is
1358 parsed; setting them during execution is not sufficient as the
1359 syntax variable=value has already been parsed as a command
1360 rather than an assignment.
1361
1362 If multibyte character support is not compiled into the shell
1363 this option is ignored; all octets with the top bit set may be
1364 used in identifiers. This is non-standard but is the tradi‐
1365 tional zsh behaviour.
1366
1367 POSIX_STRINGS <K> <S>
1368 This option affects processing of quoted strings. Currently it
1369 only affects the behaviour of null characters, i.e. character 0
1370 in the portable character set corresponding to US ASCII.
1371
1372 When this option is not set, null characters embedded within
1373 strings of the form $'...' are treated as ordinary characters.
1374 The entire string is maintained within the shell and output to
1375 files where necessary, although owing to restrictions of the
1376 library interface the string is truncated at the null character
1377 in file names, environment variables, or in arguments to exter‐
1378 nal programs.
1379
1380 When this option is set, the $'...' expression is truncated at
1381 the null character. Note that remaining parts of the same
1382 string beyond the termination of the quotes are not truncated.
1383
1384 For example, the command line argument a$'b\0c'd is treated with
1385 the option off as the characters a, b, null, c, d, and with the
1386 option on as the characters a, b, d.
1387
1388 POSIX_TRAPS <K> <S>
1389 When this option is set, the usual zsh behaviour of executing
1390 traps for EXIT on exit from shell functions is suppressed. In
1391 that case, manipulating EXIT traps always alters the global trap
1392 for exiting the shell; the LOCAL_TRAPS option is ignored for the
1393 EXIT trap. Furthermore, a return statement executed in a trap
1394 with no argument passes back from the function the value from
1395 the surrounding context, not from code executed within the trap.
1396
1397 SH_FILE_EXPANSION <K> <S>
1398 Perform filename expansion (e.g., ~ expansion) before parameter
1399 expansion, command substitution, arithmetic expansion and brace
1400 expansion. If this option is unset, it is performed after brace
1401 expansion, so things like `~$USERNAME' and `~{pfalstad,rc}' will
1402 work.
1403
1404 SH_NULLCMD <K> <S>
1405 Do not use the values of NULLCMD and READNULLCMD when doing
1406 redirections, use `:' instead (see the section `Redirection').
1407
1408 SH_OPTION_LETTERS <K> <S>
1409 If this option is set the shell tries to interpret single letter
1410 options (which are used with set and setopt) like ksh does.
1411 This also affects the value of the - special parameter.
1412
1413 SH_WORD_SPLIT (-y) <K> <S>
1414 Causes field splitting to be performed on unquoted parameter
1415 expansions. Note that this option has nothing to do with word
1416 splitting. (See the section `Parameter Expansion'.)
1417
1418 TRAPS_ASYNC
1419 While waiting for a program to exit, handle signals and run
1420 traps immediately. Otherwise the trap is run after a child
1421 process has exited. Note this does not affect the point at
1422 which traps are run for any case other than when the shell is
1423 waiting for a child process.
1424
1425 Shell State
1426 INTERACTIVE (-i, ksh: -i)
1427 This is an interactive shell. This option is set upon initiali‐
1428 sation if the standard input is a tty and commands are being
1429 read from standard input. (See the discussion of SHIN_STDIN.)
1430 This heuristic may be overridden by specifying a state for this
1431 option on the command line. The value of this option can only
1432 be changed via flags supplied at invocation of the shell. It
1433 cannot be changed once zsh is running.
1434
1435 LOGIN (-l, ksh: -l)
1436 This is a login shell. If this option is not explicitly set,
1437 the shell becomes a login shell if the first character of the
1438 argv[0] passed to the shell is a `-'.
1439
1440 PRIVILEGED (-p, ksh: -p)
1441 Turn on privileged mode. Typically this is used when script is
1442 to be run with elevated privileges. This should be done as fol‐
1443 lows directly with the -p option to zsh so that it takes effect
1444 during startup.
1445
1446 #!/bin/zsh -p
1447
1448 The option is enabled automatically on startup if the effective
1449 user (group) ID is not equal to the real user (group) ID. In
1450 this case, turning the option off causes the effective user and
1451 group IDs to be set to the real user and group IDs. Be aware
1452 that if that fails the shell may be running with different IDs
1453 than was intended so a script should check for failure and act
1454 accordingly, for example:
1455
1456 unsetopt privileged || exit
1457
1458 The PRIVILEGED option disables sourcing user startup files. If
1459 zsh is invoked as `sh' or `ksh' with this option set,
1460 /etc/suid_profile is sourced (after /etc/profile on interactive
1461 shells). Sourcing ~/.profile is disabled and the contents of the
1462 ENV variable is ignored. This option cannot be changed using the
1463 -m option of setopt and unsetopt, and changing it inside a func‐
1464 tion always changes it globally regardless of the LOCAL_OPTIONS
1465 option.
1466
1467 RESTRICTED (-r)
1468 Enables restricted mode. This option cannot be changed using
1469 unsetopt, and setting it inside a function always changes it
1470 globally regardless of the LOCAL_OPTIONS option. See the sec‐
1471 tion `Restricted Shell'.
1472
1473 SHIN_STDIN (-s, ksh: -s)
1474 Commands are being read from the standard input. Commands are
1475 read from standard input if no command is specified with -c and
1476 no file of commands is specified. If SHIN_STDIN is set explic‐
1477 itly on the command line, any argument that would otherwise have
1478 been taken as a file to run will instead be treated as a normal
1479 positional parameter. Note that setting or unsetting this
1480 option on the command line does not necessarily affect the state
1481 the option will have while the shell is running - that is purely
1482 an indicator of whether or not commands are actually being read
1483 from standard input. The value of this option can only be
1484 changed via flags supplied at invocation of the shell. It can‐
1485 not be changed once zsh is running.
1486
1487 SINGLE_COMMAND (-t, ksh: -t)
1488 If the shell is reading from standard input, it exits after a
1489 single command has been executed. This also makes the shell
1490 non-interactive, unless the INTERACTIVE option is explicitly set
1491 on the command line. The value of this option can only be
1492 changed via flags supplied at invocation of the shell. It can‐
1493 not be changed once zsh is running.
1494
1495 Zle
1496 BEEP (+B) <D>
1497 Beep on error in ZLE.
1498
1499 COMBINING_CHARS
1500 Assume that the terminal displays combining characters cor‐
1501 rectly. Specifically, if a base alphanumeric character is fol‐
1502 lowed by one or more zero-width punctuation characters, assume
1503 that the zero-width characters will be displayed as modifica‐
1504 tions to the base character within the same width. Not all ter‐
1505 minals handle this. If this option is not set, zero-width char‐
1506 acters are displayed separately with special mark-up.
1507
1508 If this option is set, the pattern test [[:WORD:]] matches a
1509 zero-width punctuation character on the assumption that it will
1510 be used as part of a word in combination with a word character.
1511 Otherwise the base shell does not handle combining characters
1512 specially.
1513
1514 EMACS If ZLE is loaded, turning on this option has the equivalent
1515 effect of `bindkey -e'. In addition, the VI option is unset.
1516 Turning it off has no effect. The option setting is not guaran‐
1517 teed to reflect the current keymap. This option is provided for
1518 compatibility; bindkey is the recommended interface.
1519
1520 OVERSTRIKE
1521 Start up the line editor in overstrike mode.
1522
1523 SINGLE_LINE_ZLE (-M) <K>
1524 Use single-line command line editing instead of multi-line.
1525
1526 Note that although this is on by default in ksh emulation it
1527 only provides superficial compatibility with the ksh line editor
1528 and reduces the effectiveness of the zsh line editor. As it has
1529 no effect on shell syntax, many users may wish to disable this
1530 option when using ksh emulation interactively.
1531
1532 VI If ZLE is loaded, turning on this option has the equivalent
1533 effect of `bindkey -v'. In addition, the EMACS option is unset.
1534 Turning it off has no effect. The option setting is not guaran‐
1535 teed to reflect the current keymap. This option is provided for
1536 compatibility; bindkey is the recommended interface.
1537
1538 ZLE (-Z)
1539 Use the zsh line editor. Set by default in interactive shells
1540 connected to a terminal.
1541
1543 Some options have alternative names. These aliases are never used for
1544 output, but can be used just like normal option names when specifying
1545 options to the shell.
1546
1547 BRACE_EXPAND
1548 NO_IGNORE_BRACES (ksh and bash compatibility)
1549
1550 DOT_GLOB
1551 GLOB_DOTS (bash compatibility)
1552
1553 HASH_ALL
1554 HASH_CMDS (bash compatibility)
1555
1556 HIST_APPEND
1557 APPEND_HISTORY (bash compatibility)
1558
1559 HIST_EXPAND
1560 BANG_HIST (bash compatibility)
1561
1562 LOG NO_HIST_NO_FUNCTIONS (ksh compatibility)
1563
1564 MAIL_WARN
1565 MAIL_WARNING (bash compatibility)
1566
1567 ONE_CMD
1568 SINGLE_COMMAND (bash compatibility)
1569
1570 PHYSICAL
1571 CHASE_LINKS (ksh and bash compatibility)
1572
1573 PROMPT_VARS
1574 PROMPT_SUBST (bash compatibility)
1575
1576 STDIN SHIN_STDIN (ksh compatibility)
1577
1578 TRACK_ALL
1579 HASH_CMDS (ksh compatibility)
1580
1582 Default set
1583 -0 CORRECT
1584 -1 PRINT_EXIT_VALUE
1585 -2 NO_BAD_PATTERN
1586 -3 NO_NOMATCH
1587 -4 GLOB_DOTS
1588 -5 NOTIFY
1589 -6 BG_NICE
1590 -7 IGNORE_EOF
1591 -8 MARK_DIRS
1592 -9 AUTO_LIST
1593 -B NO_BEEP
1594 -C NO_CLOBBER
1595 -D PUSHD_TO_HOME
1596 -E PUSHD_SILENT
1597 -F NO_GLOB
1598 -G NULL_GLOB
1599 -H RM_STAR_SILENT
1600 -I IGNORE_BRACES
1601 -J AUTO_CD
1602 -K NO_BANG_HIST
1603 -L SUN_KEYBOARD_HACK
1604 -M SINGLE_LINE_ZLE
1605 -N AUTO_PUSHD
1606 -O CORRECT_ALL
1607 -P RC_EXPAND_PARAM
1608 -Q PATH_DIRS
1609 -R LONG_LIST_JOBS
1610 -S REC_EXACT
1611 -T CDABLE_VARS
1612 -U MAIL_WARNING
1613 -V NO_PROMPT_CR
1614 -W AUTO_RESUME
1615 -X LIST_TYPES
1616 -Y MENU_COMPLETE
1617 -Z ZLE
1618 -a ALL_EXPORT
1619 -e ERR_EXIT
1620 -f NO_RCS
1621 -g HIST_IGNORE_SPACE
1622 -h HIST_IGNORE_DUPS
1623 -i INTERACTIVE
1624 -k INTERACTIVE_COMMENTS
1625 -l LOGIN
1626 -m MONITOR
1627 -n NO_EXEC
1628 -p PRIVILEGED
1629 -r RESTRICTED
1630 -s SHIN_STDIN
1631 -t SINGLE_COMMAND
1632 -u NO_UNSET
1633 -v VERBOSE
1634 -w CHASE_LINKS
1635 -x XTRACE
1636 -y SH_WORD_SPLIT
1637
1638 sh/ksh emulation set
1639 -C NO_CLOBBER
1640 -T TRAPS_ASYNC
1641 -X MARK_DIRS
1642 -a ALL_EXPORT
1643 -b NOTIFY
1644 -e ERR_EXIT
1645 -f NO_GLOB
1646 -i INTERACTIVE
1647 -l LOGIN
1648 -m MONITOR
1649 -n NO_EXEC
1650 -p PRIVILEGED
1651 -r RESTRICTED
1652 -s SHIN_STDIN
1653 -t SINGLE_COMMAND
1654 -u NO_UNSET
1655 -v VERBOSE
1656 -x XTRACE
1657
1658 Also note
1659 -A Used by set for setting arrays
1660 -b Used on the command line to specify end of option processing
1661 -c Used on the command line to specify a single command
1662 -m Used by setopt for pattern-matching option setting
1663 -o Used in all places to allow use of long option names
1664 -s Used by set to sort positional parameters
1665
1666
1667
1668zsh 5.7.1 February 3, 2019 ZSHOPTIONS(1)