1ZSHZLE(1) General Commands Manual ZSHZLE(1)
2
3
4
6 zshzle - zsh command line editor
7
9 If the ZLE option is set (which it is by default in interactive shells)
10 and the shell input is attached to the terminal, the user is able to
11 edit command lines.
12
13 There are two display modes. The first, multiline mode, is the
14 default. It only works if the TERM parameter is set to a valid termi‐
15 nal type that can move the cursor up. The second, single line mode, is
16 used if TERM is invalid or incapable of moving the cursor up, or if the
17 SINGLE_LINE_ZLE option is set. This mode is similar to ksh, and uses
18 no termcap sequences. If TERM is "emacs", the ZLE option will be unset
19 by default.
20
21 The parameters BAUD, COLUMNS, and LINES are also used by the line edi‐
22 tor. See Parameters Used By The Shell in zshparam(1).
23
24 The parameter zle_highlight is also used by the line editor; see Char‐
25 acter Highlighting below. Highlighting of special characters and the
26 region between the cursor and the mark (as set with set-mark-command in
27 Emacs mode) is enabled by default; consult this reference for more
28 information. Irascible conservatives will wish to know that all high‐
29 lighting may be disabled by the following setting:
30
31 zle_highlight=(none)
32
34 A keymap in ZLE contains a set of bindings between key sequences and
35 ZLE commands. The empty key sequence cannot be bound.
36
37 There can be any number of keymaps at any time, and each keymap has one
38 or more names. If all of a keymap's names are deleted, it disappears.
39 bindkey can be used to manipulate keymap names.
40
41 Initially, there are six keymaps:
42
43 emacs EMACS emulation
44 viins vi emulation - insert mode
45 vicmd vi emulation - command mode
46 isearch
47 incremental search mode
48 command
49 read a command name
50 .safe fallback keymap
51
52 The `.safe' keymap is special. It can never be altered, and the name
53 can never be removed. However, it can be linked to other names, which
54 can be removed. In the future other special keymaps may be added;
55 users should avoid using names beginning with `.' for their own
56 keymaps.
57
58 In addition to these names, either `emacs' or `viins' is also linked to
59 the name `main'. If one of the VISUAL or EDITOR environment variables
60 contain the string `vi' when the shell starts up then it will be
61 `viins', otherwise it will be `emacs'. bindkey's -e and -v options
62 provide a convenient way to override this default choice.
63
64 When the editor starts up, it will select the `main' keymap. If that
65 keymap doesn't exist, it will use `.safe' instead.
66
67 In the `.safe' keymap, each single key is bound to self-insert, except
68 for ^J (line feed) and ^M (return) which are bound to accept-line.
69 This is deliberately not pleasant to use; if you are using it, it means
70 you deleted the main keymap, and you should put it back.
71
72 Reading Commands
73 When ZLE is reading a command from the terminal, it may read a sequence
74 that is bound to some command and is also a prefix of a longer bound
75 string. In this case ZLE will wait a certain time to see if more char‐
76 acters are typed, and if not (or they don't match any longer string) it
77 will execute the binding. This timeout is defined by the KEYTIMEOUT
78 parameter; its default is 0.4 sec. There is no timeout if the prefix
79 string is not itself bound to a command.
80
81 The key timeout is also applied when ZLE is reading the bytes from a
82 multibyte character string when it is in the appropriate mode. (This
83 requires that the shell was compiled with multibyte mode enabled; typi‐
84 cally also the locale has characters with the UTF-8 encoding, although
85 any multibyte encoding known to the operating system is supported.) If
86 the second or a subsequent byte is not read within the timeout period,
87 the shell acts as if ? were typed and resets the input state.
88
89 As well as ZLE commands, key sequences can be bound to other strings,
90 by using `bindkey -s'. When such a sequence is read, the replacement
91 string is pushed back as input, and the command reading process starts
92 again using these fake keystrokes. This input can itself invoke fur‐
93 ther replacement strings, but in order to detect loops the process will
94 be stopped if there are twenty such replacements without a real command
95 being read.
96
97 A key sequence typed by the user can be turned into a command name for
98 use in user-defined widgets with the read-command widget, described
99 below.
100
102 The ZLE module contains three related builtin commands. The bindkey
103 command manipulates keymaps and key bindings; the vared command invokes
104 ZLE on the value of a shell parameter; and the zle command manipulates
105 editing widgets and allows command line access to ZLE commands from
106 within shell functions.
107
108 bindkey [ options ] -l [ -L ] [ keymap ... ]
109 bindkey [ options ] -d
110 bindkey [ options ] -D keymap ...
111 bindkey [ options ] -A old-keymap new-keymap
112 bindkey [ options ] -N new-keymap [ old-keymap ]
113 bindkey [ options ] -m
114 bindkey [ options ] -r in-string ...
115 bindkey [ options ] -s in-string out-string ...
116 bindkey [ options ] in-string command ...
117 bindkey [ options ] [ in-string ]
118 bindkey's options can be divided into three categories: keymap
119 selection for the current command, operation selection, and oth‐
120 ers. The keymap selection options are:
121
122 -e Selects keymap `emacs' for any operations by the current
123 command, and also links `emacs' to `main' so that it is
124 selected by default the next time the editor starts.
125
126 -v Selects keymap `viins' for any operations by the current
127 command, and also links `viins' to `main' so that it is
128 selected by default the next time the editor starts.
129
130 -a Selects keymap `vicmd' for any operations by the current
131 command.
132
133 -M keymap
134 The keymap specifies a keymap name that is selected for
135 any operations by the current command.
136
137 If a keymap selection is required and none of the options above
138 are used, the `main' keymap is used. Some operations do not
139 permit a keymap to be selected, namely:
140
141 -l List all existing keymap names; if any arguments are
142 given, list just those keymaps.
143
144 If the -L option is also used, list in the form of bind‐
145 key commands to create or link the keymaps. `bindkey -lL
146 main' shows which keymap is linked to `main', if any, and
147 hence if the standard emacs or vi emulation is in effect.
148 This option does not show the .safe keymap because it
149 cannot be created in that fashion; however, neither is
150 `bindkey -lL .safe' reported as an error, it simply out‐
151 puts nothing.
152
153 -d Delete all existing keymaps and reset to the default
154 state.
155
156 -D keymap ...
157 Delete the named keymaps.
158
159 -A old-keymap new-keymap
160 Make the new-keymap name an alias for old-keymap, so that
161 both names refer to the same keymap. The names have
162 equal standing; if either is deleted, the other remains.
163 If there is already a keymap with the new-keymap name, it
164 is deleted.
165
166 -N new-keymap [ old-keymap ]
167 Create a new keymap, named new-keymap. If a keymap
168 already has that name, it is deleted. If an old-keymap
169 name is given, the new keymap is initialized to be a
170 duplicate of it, otherwise the new keymap will be empty.
171
172 To use a newly created keymap, it should be linked to main.
173 Hence the sequence of commands to create and use a new keymap
174 `mymap' initialized from the emacs keymap (which remains
175 unchanged) is:
176
177 bindkey -N mymap emacs
178 bindkey -A mymap main
179
180 Note that while `bindkey -A newmap main' will work when newmap
181 is emacs or viins, it will not work for vicmd, as switching from
182 vi insert to command mode becomes impossible.
183
184 The following operations act on the `main' keymap if no keymap
185 selection option was given:
186
187 -m Add the built-in set of meta-key bindings to the selected
188 keymap. Only keys that are unbound or bound to
189 self-insert are affected.
190
191 -r in-string ...
192 Unbind the specified in-strings in the selected keymap.
193 This is exactly equivalent to binding the strings to
194 undefined-key.
195
196 When -R is also used, interpret the in-strings as ranges.
197
198 When -p is also used, the in-strings specify prefixes.
199 Any binding that has the given in-string as a prefix, not
200 including the binding for the in-string itself, if any,
201 will be removed. For example,
202
203 bindkey -rpM viins '^['
204
205 will remove all bindings in the vi-insert keymap begin‐
206 ning with an escape character (probably cursor keys), but
207 leave the binding for the escape character itself (proba‐
208 bly vi-cmd-mode). This is incompatible with the option
209 -R.
210
211 -s in-string out-string ...
212 Bind each in-string to each out-string. When in-string
213 is typed, out-string will be pushed back and treated as
214 input to the line editor. When -R is also used, inter‐
215 pret the in-strings as ranges.
216
217 in-string command ...
218 Bind each in-string to each command. When -R is used,
219 interpret the in-strings as ranges.
220
221 [ in-string ]
222 List key bindings. If an in-string is specified, the
223 binding of that string in the selected keymap is dis‐
224 played. Otherwise, all key bindings in the selected
225 keymap are displayed. (As a special case, if the -e or
226 -v option is used alone, the keymap is not displayed -
227 the implicit linking of keymaps is the only thing that
228 happens.)
229
230 When the option -p is used, the in-string must be
231 present. The listing shows all bindings which have the
232 given key sequence as a prefix, not including any bind‐
233 ings for the key sequence itself.
234
235 When the -L option is used, the list is in the form of
236 bindkey commands to create the key bindings.
237
238 When the -R option is used as noted above, a valid range consists of
239 two characters, with an optional `-' between them. All characters
240 between the two specified, inclusive, are bound as specified.
241
242 For either in-string or out-string, the following escape sequences are
243 recognised:
244
245 \a bell character
246 \b backspace
247 \e, \E escape
248 \f form feed
249 \n linefeed (newline)
250 \r carriage return
251 \t horizontal tab
252 \v vertical tab
253 \NNN character code in octal
254 \xNN character code in hexadecimal
255 \M[-]X character with meta bit set
256 \C[-]X control character
257 ^X control character
258
259 In all other cases, `\' escapes the following character. Delete is
260 written as `^?'. Note that `\M^?' and `^\M?' are not the same, and
261 that (unlike emacs), the bindings `\M-X' and `\eX' are entirely dis‐
262 tinct, although they are initialized to the same bindings by `bindkey
263 -m'.
264
265 vared [ -Aache ] [ -p prompt ] [ -r rprompt ]
266 [ -M main-keymap ] [ -m vicmd-keymap ]
267 [ -t tty ] name
268 The value of the parameter name is loaded into the edit buffer,
269 and the line editor is invoked. When the editor exits, name is
270 set to the string value returned by the editor. When the -c
271 flag is given, the parameter is created if it doesn't already
272 exist. The -a flag may be given with -c to create an array
273 parameter, or the -A flag to create an associative array. If
274 the type of an existing parameter does not match the type to be
275 created, the parameter is unset and recreated.
276
277 If an array or array slice is being edited, separator characters
278 as defined in $IFS will be shown quoted with a backslash, as
279 will backslashes themselves. Conversely, when the edited text
280 is split into an array, a backslash quotes an immediately fol‐
281 lowing separator character or backslash; no other special han‐
282 dling of backslashes, or any handling of quotes, is performed.
283
284 Individual elements of existing array or associative array
285 parameters may be edited by using subscript syntax on name. New
286 elements are created automatically, even without -c.
287
288 If the -p flag is given, the following string will be taken as
289 the prompt to display at the left. If the -r flag is given, the
290 following string gives the prompt to display at the right. If
291 the -h flag is specified, the history can be accessed from ZLE.
292 If the -e flag is given, typing ^D (Control-D) on an empty line
293 causes vared to exit immediately with a non-zero return value.
294
295 The -M option gives a keymap to link to the main keymap during
296 editing, and the -m option gives a keymap to link to the vicmd
297 keymap during editing. For vi-style editing, this allows a pair
298 of keymaps to override viins and vicmd. For emacs-style edit‐
299 ing, only -M is normally needed but the -m option may still be
300 used. On exit, the previous keymaps will be restored.
301
302 If `-t tty' is given, tty is the name of a terminal device to be
303 used instead of the default /dev/tty. If tty does not refer to
304 a terminal an error is reported.
305
306 zle
307 zle -l [ -L | -a ] [ string ... ]
308 zle -D widget ...
309 zle -A old-widget new-widget
310 zle -N widget [ function ]
311 zle -C widget completion-widget function
312 zle -R [ -c ] [ display-string ] [ string ... ]
313 zle -M string
314 zle -U string
315 zle -K keymap
316 zle -F [ -L ] [ fd [ handler ] ]
317 zle -I
318 zle widget [ -n num ] [ -Nw ] [ -K keymap ] args ...
319 The zle builtin performs a number of different actions concern‐
320 ing ZLE.
321
322 With no options and no arguments, only the return status will be
323 set. It is zero if ZLE is currently active and widgets could be
324 invoked using this builtin command and non-zero otherwise. Note
325 that even if non-zero status is returned, zle may still be
326 active as part of the completion system; this does not allow
327 direct calls to ZLE widgets.
328
329 Otherwise, which operation it performs depends on its options:
330
331 -l [ -L | -a ]
332 List all existing user-defined widgets. If the -L option
333 is used, list in the form of zle commands to create the
334 widgets.
335
336 When combined with the -a option, all widget names are
337 listed, including the builtin ones. In this case the -L
338 option is ignored.
339
340 If at least one string is given, nothing will be printed
341 but the return status will be zero if all strings are
342 names of existing widgets (or of user-defined widgets if
343 the -a flag is not given) and non-zero if at least one
344 string is not a name of an defined widget.
345
346 -D widget ...
347 Delete the named widgets.
348
349 -A old-widget new-widget
350 Make the new-widget name an alias for old-widget, so that
351 both names refer to the same widget. The names have
352 equal standing; if either is deleted, the other remains.
353 If there is already a widget with the new-widget name, it
354 is deleted.
355
356 -N widget [ function ]
357 Create a user-defined widget. If there is already a wid‐
358 get with the specified name, it is overwritten. When the
359 new widget is invoked from within the editor, the speci‐
360 fied shell function is called. If no function name is
361 specified, it defaults to the same name as the widget.
362 For further information, see the section Widgets in zsh‐
363 zle(1).
364
365 -C widget completion-widget function
366 Create a user-defined completion widget named widget. The
367 completion widget will behave like the built-in comple‐
368 tion-widget whose name is given as completion-widget. To
369 generate the completions, the shell function function
370 will be called. For further information, see zshcomp‐
371 wid(1).
372
373 -R [ -c ] [ display-string ] [ string ... ]
374 Redisplay the command line; this is to be called from
375 within a user-defined widget to allow changes to become
376 visible. If a display-string is given and not empty,
377 this is shown in the status line (immediately below the
378 line being edited).
379
380 If the optional strings are given they are listed below
381 the prompt in the same way as completion lists are
382 printed. If no strings are given but the -c option is
383 used such a list is cleared.
384
385 Note that this option is only useful for widgets that do
386 not exit immediately after using it because the strings
387 displayed will be erased immediately after return from
388 the widget.
389
390 This command can safely be called outside user defined
391 widgets; if zle is active, the display will be refreshed,
392 while if zle is not active, the command has no effect.
393 In this case there will usually be no other arguments.
394
395 The status is zero if zle was active, else one.
396
397 -M string
398 As with the -R option, the string will be displayed below
399 the command line; unlike the -R option, the string will
400 not be put into the status line but will instead be
401 printed normally below the prompt. This means that the
402 string will still be displayed after the widget returns
403 (until it is overwritten by subsequent commands).
404
405 -U string
406 This pushes the characters in the string onto the input
407 stack of ZLE. After the widget currently executed fin‐
408 ishes ZLE will behave as if the characters in the string
409 were typed by the user.
410
411 As ZLE uses a stack, if this option is used repeatedly
412 the last string pushed onto the stack will be processed
413 first. However, the characters in each string will be
414 processed in the order in which they appear in the
415 string.
416
417 -K keymap
418 Selects the keymap named keymap. An error message will
419 be displayed if there is no such keymap.
420
421 This keymap selection affects the interpretation of fol‐
422 lowing keystrokes within this invocation of ZLE. Any
423 following invocation (e.g., the next command line) will
424 start as usual with the `main' keymap selected.
425
426 -F [ -L ] [ fd [ handler ] ]
427 Only available if your system supports one of the `poll'
428 or `select' system calls; most modern systems do.
429
430 Installs handler (the name of a shell function) to handle
431 input from file descriptor fd. When zle is attempting to
432 read data, it will examine both the terminal and the list
433 of handled fd's. If data becomes available on a handled
434 fd, zle will call handler with the fd which is ready for
435 reading as the only argument. If the handler produces
436 output to the terminal, it should call `zle -I' before
437 doing so (see below). The handler should not attempt to
438 read from the terminal. Note that zle makes no attempt
439 to check whether this fd is actually readable when
440 installing the handler. The user must make their own
441 arrangements for handling the file descriptor when zle is
442 not active.
443
444 Any number of handlers for any number of readable file
445 descriptors may be installed. Installing a handler for
446 an fd which is already handled causes the existing han‐
447 dler to be replaced.
448
449 If no handler is given, but an fd is present, any handler
450 for that fd is removed. If there is none, an error mes‐
451 sage is printed and status 1 is returned.
452
453 If no arguments are given, or the -L option is supplied,
454 a list of handlers is printed in a form which can be
455 stored for later execution.
456
457 An fd (but not a handler) may optionally be given with
458 the -L option; in this case, the function will list the
459 handler if any, else silently return status 1.
460
461 Note that this feature should be used with care. Activ‐
462 ity on one of the fd's which is not properly handled can
463 cause the terminal to become unusable.
464
465 Here is a simple example of using this feature. A con‐
466 nection to a remote TCP port is created using the ztcp
467 command; see the description of the zsh/net/tcp module in
468 zshmodules(1). Then a handler is installed which simply
469 prints out any data which arrives on this connection.
470 Note that `select' will indicate that the file descriptor
471 needs handling if the remote side has closed the connec‐
472 tion; we handle that by testing for a failed read.
473 if ztcp pwspc 2811; then
474 tcpfd=$REPLY
475 handler() {
476 zle -I
477 local line
478 if ! read -r line <&$1; then
479 # select marks this fd if we reach EOF,
480 # so handle this specially.
481 print "[Read on fd $1 failed, removing.]" >&2
482 zle -F $1
483 return 1
484 fi
485 print -r - $line
486 }
487 zle -F $tcpfd handler
488 fi
489
490 -I Unusually, this option is most useful outside ordinary
491 widget functions, though it may be used within if normal
492 output to the terminal is required. It invalidates the
493 current zle display in preparation for output; typically
494 this will be from a trap function. It has no effect if
495 zle is not active. When a trap exits, the shell checks
496 to see if the display needs restoring, hence the follow‐
497 ing will print output in such a way as not to disturb the
498 line being edited:
499
500 TRAPUSR1() {
501 # Invalidate zle display
502 [[ -o zle ]] && zle -I
503 # Show output
504 print Hello
505 }
506
507 In general, the trap function may need to test whether
508 zle is active before using this method (as shown in the
509 example), since the zsh/zle module may not even be
510 loaded; if it is not, the command can be skipped.
511
512 It is possible to call `zle -I' several times before con‐
513 trol is returned to the editor; the display will only be
514 invalidated the first time to minimise disruption.
515
516 Note that there are normally better ways of manipulating
517 the display from within zle widgets; see, for example,
518 `zle -R' above.
519
520 The returned status is zero if zle was invalidated, even
521 though this may have been by a previous call to `zle -I'
522 or by a system notification. To test if a zle widget may
523 be called at this point, execute zle with no arguments
524 and examine the return status.
525
526 widget [ -n num ] [ -Nw ] [ -K keymap ] args ...
527 Invoke the specified widget. This can only be done when
528 ZLE is active; normally this will be within a
529 user-defined widget.
530
531 With the options -n and -N, the current numerical argu‐
532 ment will be saved and then restored after the call to
533 widget; `-n num' sets the numerical argument temporarily
534 to num, while `-N' sets it to the default, i.e. as if
535 there were none.
536
537 With the option -K, keymap will be used as the current
538 keymap during the execution of the widget. The previous
539 keymap will be restored when the widget exits.
540
541 Normally, calling a widget in this way does not set the
542 special parameter WIDGET and related parameters, so that
543 the environment appears as if the top-level widget called
544 by the user were still active. With the option -w, WID‐
545 GET and related parameters are set to reflect the widget
546 being executed by the zle call.
547
548 Any further arguments will be passed to the widget; note
549 that as standard argument handling is performed, any gen‐
550 eral argument list should be preceded by --. If it is a
551 shell function, these are passed down as positional
552 parameters; for builtin widgets it is up to the widget in
553 question what it does with them. Currently arguments are
554 only handled by the incremental-search commands, the his‐
555 tory-search-forward and -backward and the corresponding
556 functions prefixed by vi-, and by universal-argument. No
557 error is flagged if the command does not use the argu‐
558 ments, or only uses some of them.
559
560 The return status reflects the success or failure of the
561 operation carried out by the widget, or if it is a
562 user-defined widget the return status of the shell func‐
563 tion.
564
565 A non-zero return status causes the shell to beep when
566 the widget exits, unless the BEEP options was unset or
567 the widget was called via the zle command. Thus if a
568 user defined widget requires an immediate beep, it should
569 call the beep widget directly.
570
572 All actions in the editor are performed by `widgets'. A widget's job
573 is simply to perform some small action. The ZLE commands that key
574 sequences in keymaps are bound to are in fact widgets. Widgets can be
575 user-defined or built in.
576
577 The standard widgets built into ZLE are listed in Standard Widgets
578 below. Other built-in widgets can be defined by other modules (see
579 zshmodules(1)). Each built-in widget has two names: its normal canoni‐
580 cal name, and the same name preceded by a `.'. The `.' name is spe‐
581 cial: it can't be rebound to a different widget. This makes the widget
582 available even when its usual name has been redefined.
583
584 User-defined widgets are defined using `zle -N', and implemented as
585 shell functions. When the widget is executed, the corresponding shell
586 function is executed, and can perform editing (or other) actions. It
587 is recommended that user-defined widgets should not have names starting
588 with `.'.
589
591 User-defined widgets, being implemented as shell functions, can execute
592 any normal shell command. They can also run other widgets (whether
593 built-in or user-defined) using the zle builtin command. The standard
594 input of the function is closed to prevent external commands from unin‐
595 tentionally blocking ZLE by reading from the terminal, but read -k or
596 read -q can be used to read characters. Finally, they can examine and
597 edit the ZLE buffer being edited by reading and setting the special
598 parameters described below.
599
600 These special parameters are always available in widget functions, but
601 are not in any way special outside ZLE. If they have some normal value
602 outside ZLE, that value is temporarily inaccessible, but will return
603 when the widget function exits. These special parameters in fact have
604 local scope, like parameters created in a function using local.
605
606 Inside completion widgets and traps called while ZLE is active, these
607 parameters are available read-only.
608
609 BUFFER (scalar)
610 The entire contents of the edit buffer. If it is written to,
611 the cursor remains at the same offset, unless that would put it
612 outside the buffer.
613
614 BUFFERLINES (integer)
615 The number of screen lines needed for the edit buffer currently
616 displayed on screen (i.e. without any changes to the preceding
617 parameters done after the last redisplay); read-only.
618
619 CONTEXT (scalar)
620 The context in which zle was called to read a line; read-only.
621 One of the values:
622 start The start of a command line (at prompt PS1).
623
624 cont A continuation to a command line (at prompt PS2).
625
626 select In a select loop.
627
628 vared Editing a variable in vared.
629
630 CURSOR (integer)
631 The offset of the cursor, within the edit buffer. This is in
632 the range 0 to $#BUFFER, and is by definition equal to
633 $#LBUFFER. Attempts to move the cursor outside the buffer will
634 result in the cursor being moved to the appropriate end of the
635 buffer.
636
637 CUTBUFFER (scalar)
638 The last item cut using one of the `kill-' commands; the string
639 which the next yank would insert in the line. Later entries in
640 the kill ring are in the array killring. Note that the command
641 `zle copy-region-as-kill string' can be used to set the text of
642 the cut buffer from a shell function and cycle the kill ring in
643 the same way as interactively killing text.
644
645 HISTNO (integer)
646 The current history number. Setting this has the same effect as
647 moving up or down in the history to the corresponding history
648 line. An attempt to set it is ignored if the line is not stored
649 in the history. Note this is not the same as the parameter
650 HISTCMD, which always gives the number of the history line being
651 added to the main shell's history. HISTNO refers to the line
652 being retrieved within zle.
653
654 KEYMAP (scalar)
655 The name of the currently selected keymap; read-only.
656
657 KEYS (scalar)
658 The keys typed to invoke this widget, as a literal string;
659 read-only.
660
661 killring (array)
662 The array of previously killed items, with the most recently
663 killed first. This gives the items that would be retrieved by a
664 yank-pop in the same order. Note, however, that the most
665 recently killed item is in $CUTBUFFER; $killring shows the array
666 of previous entries.
667
668 The default size for the kill ring is eight, however the length
669 may be changed by normal array operations. Any empty string in
670 the kill ring is ignored by the yank-pop command, hence the size
671 of the array effectively sets the maximum length of the kill
672 ring, while the number of non-zero strings gives the current
673 length, both as seen by the user at the command line.
674
675 LASTABORTEDSEARCH (scalar)
676 The last search string used by an interactive search that was
677 aborted by the user (status 3 returned by the search widget).
678
679 LASTSEARCH (scalar)
680 The last search string used by an interactive search; read-only.
681 This is set even if the search failed (status 0, 1 or 2 returned
682 by the search widget), but not if it was aborted by the user.
683
684 LASTWIDGET (scalar)
685 The name of the last widget that was executed; read-only.
686
687 LBUFFER (scalar)
688 The part of the buffer that lies to the left of the cursor posi‐
689 tion. If it is assigned to, only that part of the buffer is
690 replaced, and the cursor remains between the new $LBUFFER and
691 the old $RBUFFER.
692
693 MARK (integer)
694 Like CURSOR, but for the mark.
695
696 NUMERIC (integer)
697 The numeric argument. If no numeric argument was given, this
698 parameter is unset. When this is set inside a widget function,
699 builtin widgets called with the zle builtin command will use the
700 value assigned. If it is unset inside a widget function, builtin
701 widgets called behave as if no numeric argument was given.
702
703 PENDING (integer)
704 The number of bytes pending for input, i.e. the number of bytes
705 which have already been typed and can immediately be read. On
706 systems where the shell is not able to get this information,
707 this parameter will always have a value of zero. Read-only.
708
709 PREBUFFER (scalar)
710 In a multi-line input at the secondary prompt, this read-only
711 parameter contains the contents of the lines before the one the
712 cursor is currently in.
713
714 PREDISPLAY (scalar)
715 Text to be displayed before the start of the editable text buf‐
716 fer. This does not have to be a complete line; to display a
717 complete line, a newline must be appended explicitly. The text
718 is reset on each new invocation (but not recursive invocation)
719 of zle.
720
721 POSTDISPLAY (scalar)
722 Text to be displayed after the end of the editable text buffer.
723 This does not have to be a complete line; to display a complete
724 line, a newline must be prepended explicitly. The text is reset
725 on each new invocation (but not recursive invocation) of zle.
726
727 RBUFFER (scalar)
728 The part of the buffer that lies to the right of the cursor
729 position. If it is assigned to, only that part of the buffer is
730 replaced, and the cursor remains between the old $LBUFFER and
731 the new $RBUFFER.
732
733 REGION_ACTIVE (integer)
734 Indicates if the region is currently active. It can be assigned
735 0 or 1 to deactivate and activate the region respectively; see
736 Character Highlighting below.
737
738 region_highlight (array)
739 Each element of this array may be set to a string that describes
740 highlighting for an arbitrary region of the command line that
741 will take effect the next time the command line is redisplayed.
742 Highlighting of the non-editable parts of the command line in
743 PREDISPLAY and POSTDISPLAY are possible, but note that the P
744 flag is needed for character indexing to include PREDISPLAY.
745
746 Each string consists of the following parts:
747
748 Optionally, a `P' to signify that the start and end offset that
749 follow include any string set by the PREDISPLAY special
750 parameter; this is needed if the predisplay string itself
751 is to be highlighted. Whitespace may follow the `P'.
752 A start offset in the same units as CURSOR, terminated by
753 whitespace.
754 An end offset in the same units as CURSOR, terminated by
755 whitespace.
756 A highlight specification in the same format as
757 used for contexts in the parameter zle_highlight, see
758 Character Highlighting below; for example, standout or
759 fg=red,bold.
760
761 For example,
762
763 region_highlight=("P0 20 bold")
764
765 specifies that the first twenty characters of the text including
766 any predisplay string should be highlighted in bold.
767
768 Note that the effect of region_highlight is not saved and disap‐
769 pears as soon as the line is accepted. The line editor makes no
770 attempt to keep the highlighting effect synchronised with the
771 line as it is edited; hence region highlighting is best limited
772 to static effects within user widgets.
773
774 WIDGET (scalar)
775 The name of the widget currently being executed; read-only.
776
777 WIDGETFUNC (scalar)
778 The name of the shell function that implements a widget defined
779 with either zle -N or zle -C. In the former case, this is the
780 second argument to the zle -N command that defined the widget,
781 or the first argument if there was no second argument. In the
782 latter case this is the the third argument to the zle -C command
783 that defined the widget. Read-only.
784
785 WIDGETSTYLE (scalar)
786 Describes the implementation behind the completion widget cur‐
787 rently being executed; the second argument that followed zle -C
788 when the widget was defined. This is the name of a builtin com‐
789 pletion widget. For widgets defined with zle -N this is set to
790 the empty string. Read-only.
791
792 ZLE_STATE (scalar)
793 Contains a set of space-separated words that describe the cur‐
794 rent zle state.
795
796 Currently, the only state shown is the insert mode as set by the
797 overwrite-mode or vi-replace widgets. The string contains
798 `insert' if characters to be inserted on the command line move
799 existing characters to the right, `overwrite' if characters to
800 be inserted overwrite existing characters.
801
802 Special Widgets
803 There are a few user-defined widgets which are special to the shell.
804 If they do not exist, no special action is taken. The environment pro‐
805 vided is identical to that for any other editing widget.
806
807 zle-isearch-exit
808 Executed at the end of incremental search at the point where the
809 isearch prompt is removed from the display. See
810 zle-isearch-update for an example.
811
812 zle-isearch-update
813 Executed within incremental search when the display is about to
814 be redrawn. Additional output below the incremental search
815 prompt can be generated by using `zle -M' within the widget.
816 For example,
817
818 zle-isearch-update() { zle -M "Line $HISTNO"; }
819 zle -N zle-isearch-update
820
821 Note the line output by `zle -M' is not deleted on exit from
822 incremental search. This can be done from a zle-isearch-exit
823 widget:
824
825 zle-isearch-exit() { zle -M ""; }
826 zle -N zle-isearch-exit
827
828 zle-line-init
829 Executed every time the line editor is started to read a new
830 line of input. The following example puts the line editor into
831 vi command mode when it starts up.
832
833 zle-line-init() { zle -K vicmd; }
834 zle -N zle-line-init
835
836 (The command inside the function sets the keymap directly; it is
837 equivalent to zle vi-cmd-mode.)
838
839 zle-line-finish
840 This is similar to zle-line-init but is executed every time the
841 line editor has finished reading a line of input.
842
843 zle-keymap-select
844 Executed every time the keymap changes, i.e. the special parame‐
845 ter KEYMAP is set to a different value, while the line editor is
846 active. Initialising the keymap when the line editor starts
847 does not cause the widget to be called.
848
849 The value $KEYMAP within the function reflects the new keymap.
850 The old keymap is passed as the sole argument.
851
852 This can be used for detecting switches between the vi command
853 (vicmd) and insert (usually main) keymaps.
854
856 The following is a list of all the standard widgets, and their default
857 bindings in emacs mode, vi command mode and vi insert mode (the
858 `emacs', `vicmd' and `viins' keymaps, respectively).
859
860 Note that cursor keys are bound to movement keys in all three keymaps;
861 the shell assumes that the cursor keys send the key sequences reported
862 by the terminal-handling library (termcap or terminfo). The key
863 sequences shown in the list are those based on the VT100, common on
864 many modern terminals, but in fact these are not necessarily bound. In
865 the case of the viins keymap, the initial escape character of the
866 sequences serves also to return to the vicmd keymap: whether this hap‐
867 pens is determined by the KEYTIMEOUT parameter, see zshparam(1).
868
869 Movement
870 vi-backward-blank-word (unbound) (B) (unbound)
871 Move backward one word, where a word is defined as a series of
872 non-blank characters.
873
874 backward-char (^B ESC-[D) (unbound) (unbound)
875 Move backward one character.
876
877 vi-backward-char (unbound) (^H h ^?) (ESC-[D)
878 Move backward one character, without changing lines.
879
880 backward-word (ESC-B ESC-b) (unbound) (unbound)
881 Move to the beginning of the previous word.
882
883 emacs-backward-word
884 Move to the beginning of the previous word.
885
886 vi-backward-word (unbound) (b) (unbound)
887 Move to the beginning of the previous word, vi-style.
888
889 beginning-of-line (^A) (unbound) (unbound)
890 Move to the beginning of the line. If already at the beginning
891 of the line, move to the beginning of the previous line, if any.
892
893 vi-beginning-of-line
894 Move to the beginning of the line, without changing lines.
895
896 end-of-line (^E) (unbound) (unbound)
897 Move to the end of the line. If already at the end of the line,
898 move to the end of the next line, if any.
899
900 vi-end-of-line (unbound) ($) (unbound)
901 Move to the end of the line. If an argument is given to this
902 command, the cursor will be moved to the end of the line (argu‐
903 ment - 1) lines down.
904
905 vi-forward-blank-word (unbound) (W) (unbound)
906 Move forward one word, where a word is defined as a series of
907 non-blank characters.
908
909 vi-forward-blank-word-end (unbound) (E) (unbound)
910 Move to the end of the current word, or, if at the end of the
911 current word, to the end of the next word, where a word is
912 defined as a series of non-blank characters.
913
914 forward-char (^F ESC-[C) (unbound) (unbound)
915 Move forward one character.
916
917 vi-forward-char (unbound) (space l) (ESC-[C)
918 Move forward one character.
919
920 vi-find-next-char (^X^F) (f) (unbound)
921 Read a character from the keyboard, and move to the next occur‐
922 rence of it in the line.
923
924 vi-find-next-char-skip (unbound) (t) (unbound)
925 Read a character from the keyboard, and move to the position
926 just before the next occurrence of it in the line.
927
928 vi-find-prev-char (unbound) (F) (unbound)
929 Read a character from the keyboard, and move to the previous
930 occurrence of it in the line.
931
932 vi-find-prev-char-skip (unbound) (T) (unbound)
933 Read a character from the keyboard, and move to the position
934 just after the previous occurrence of it in the line.
935
936 vi-first-non-blank (unbound) (^) (unbound)
937 Move to the first non-blank character in the line.
938
939 vi-forward-word (unbound) (w) (unbound)
940 Move forward one word, vi-style.
941
942 forward-word (ESC-F ESC-f) (unbound) (unbound)
943 Move to the beginning of the next word. The editor's idea of a
944 word is specified with the WORDCHARS parameter.
945
946 emacs-forward-word
947 Move to the end of the next word.
948
949 vi-forward-word-end (unbound) (e) (unbound)
950 Move to the end of the next word.
951
952 vi-goto-column (ESC-|) (|) (unbound)
953 Move to the column specified by the numeric argument.
954
955 vi-goto-mark (unbound) (`) (unbound)
956 Move to the specified mark.
957
958 vi-goto-mark-line (unbound) (') (unbound)
959 Move to beginning of the line containing the specified mark.
960
961 vi-repeat-find (unbound) (;) (unbound)
962 Repeat the last vi-find command.
963
964 vi-rev-repeat-find (unbound) (,) (unbound)
965 Repeat the last vi-find command in the opposite direction.
966
967 History Control
968 beginning-of-buffer-or-history (ESC-<) (unbound) (unbound)
969 Move to the beginning of the buffer, or if already there, move
970 to the first event in the history list.
971
972 beginning-of-line-hist
973 Move to the beginning of the line. If already at the beginning
974 of the buffer, move to the previous history line.
975
976 beginning-of-history
977 Move to the first event in the history list.
978
979 down-line-or-history (^N ESC-[B) (j) (ESC-[B)
980 Move down a line in the buffer, or if already at the bottom
981 line, move to the next event in the history list.
982
983 vi-down-line-or-history (unbound) (+) (unbound)
984 Move down a line in the buffer, or if already at the bottom
985 line, move to the next event in the history list. Then move to
986 the first non-blank character on the line.
987
988 down-line-or-search
989 Move down a line in the buffer, or if already at the bottom
990 line, search forward in the history for a line beginning with
991 the first word in the buffer.
992
993 If called from a function by the zle command with arguments, the
994 first argument is taken as the string for which to search,
995 rather than the first word in the buffer.
996
997 down-history (unbound) (^N) (unbound)
998 Move to the next event in the history list.
999
1000 history-beginning-search-backward
1001 Search backward in the history for a line beginning with the
1002 current line up to the cursor. This leaves the cursor in its
1003 original position.
1004
1005 end-of-buffer-or-history (ESC->) (unbound) (unbound)
1006 Move to the end of the buffer, or if already there, move to the
1007 last event in the history list.
1008
1009 end-of-line-hist
1010 Move to the end of the line. If already at the end of the buf‐
1011 fer, move to the next history line.
1012
1013 end-of-history
1014 Move to the last event in the history list.
1015
1016 vi-fetch-history (unbound) (G) (unbound)
1017 Fetch the history line specified by the numeric argument. This
1018 defaults to the current history line (i.e. the one that isn't
1019 history yet).
1020
1021 history-incremental-search-backward (^R ^Xr) (unbound) (unbound)
1022 Search backward incrementally for a specified string. The
1023 search is case-insensitive if the search string does not have
1024 uppercase letters and no numeric argument was given. The string
1025 may begin with `^' to anchor the search to the beginning of the
1026 line. When called from a user-defined function returns the fol‐
1027 lowing statuses: 0, if the search succeeded; 1, if the search
1028 failed; 2, if the search term was a bad pattern; 3, if the
1029 search was aborted by the send-break command.
1030
1031 A restricted set of editing functions is available in the
1032 mini-buffer. Keys are looked up in the special isearch keymap,
1033 and if not found there in the main keymap (note that by default
1034 the isearch keymap is empty). An interrupt signal, as defined
1035 by the stty setting, will stop the search and go back to the
1036 original line. An undefined key will have the same effect.
1037 Note that the following always perform the same task within
1038 incremental searches and cannot be replaced by user defined wid‐
1039 gets, nor can the set of functions be extended. The supported
1040 functions are:
1041
1042 accept-and-hold
1043 accept-and-infer-next-history
1044 accept-line
1045 accept-line-and-down-history
1046 Perform the usual function after exiting incremental
1047 search. The command line displayed is executed.
1048
1049 backward-delete-char
1050 vi-backward-delete-char
1051 Back up one place in the search history. If the search
1052 has been repeated this does not immediately erase a char‐
1053 acter in the minibuffer.
1054
1055 accept-search
1056 Exit incremental search, retaining the command line but
1057 performing no further action. Note that this function is
1058 not bound by default and has no effect outside incremen‐
1059 tal search.
1060
1061 backward-delete-word
1062 backward-kill-word
1063 vi-backward-kill-word
1064 Back up one character in the minibuffer; if multiple
1065 searches have been performed since the character was
1066 inserted the search history is rewound to the point just
1067 before the character was entered. Hence this has the
1068 effect of repeating backward-delete-char.
1069
1070 clear-screen
1071 Clear the screen, remaining in incremental search mode.
1072
1073 history-incremental-search-backward
1074 Find the next occurrence of the contents of the mini-buf‐
1075 fer.
1076
1077 history-incremental-search-forward
1078 Invert the sense of the search.
1079
1080 magic-space
1081 Inserts a non-magical space.
1082
1083 quoted-insert
1084 vi-quoted-insert
1085 Quote the character to insert into the minibuffer.
1086
1087 redisplay
1088 Redisplay the command line, remaining in incremental
1089 search mode.
1090
1091 vi-cmd-mode
1092 Toggle between the `main' and `vicmd' keymaps; the `main'
1093 keymap (insert mode) will be selected initially.
1094
1095 vi-repeat-search
1096 vi-rev-repeat-search
1097 Repeat the search. The direction of the search is indi‐
1098 cated in the mini-buffer.
1099
1100 Any character that is not bound to one of the above functions,
1101 or self-insert or self-insert-unmeta, will cause the mode to be
1102 exited. The character is then looked up and executed in the
1103 keymap in effect at that point.
1104
1105 When called from a widget function by the zle command, the
1106 incremental search commands can take a string argument. This
1107 will be treated as a string of keys, as for arguments to the
1108 bindkey command, and used as initial input for the command. Any
1109 characters in the string which are unused by the incremental
1110 search will be silently ignored. For example,
1111
1112 zle history-incremental-search-backward forceps
1113
1114 will search backwards for forceps, leaving the minibuffer con‐
1115 taining the string `forceps'.
1116
1117 history-incremental-search-forward (^S ^Xs) (unbound) (unbound)
1118 Search forward incrementally for a specified string. The search
1119 is case-insensitive if the search string does not have uppercase
1120 letters and no numeric argument was given. The string may begin
1121 with `^' to anchor the search to the beginning of the line. The
1122 functions available in the mini-buffer are the same as for his‐
1123 tory-incremental-search-backward.
1124
1125 history-incremental-pattern-search-backward
1126 history-incremental-pattern-search-forward
1127 These widgets behave similarly to the corresponding widgets with
1128 no -pattern, but the search string typed by the user is treated
1129 as a pattern, respecting the current settings of the various
1130 options affecting pattern matching. See FILENAME GENERATION in
1131 zshexpn(1) for a description of patterns. If no numeric argu‐
1132 ment was given lowercase letters in the search string may match
1133 uppercase letters in the history. The string may begin with `^'
1134 to anchor the search to the beginning of the line.
1135
1136 The prompt changes to indicate an invalid pattern; this may sim‐
1137 ply indicate the pattern is not yet complete.
1138
1139 Note that only non-overlapping matches are reported, so an
1140 expression with wildcards may return fewer matches on a line
1141 than are visible by inspection.
1142
1143 history-search-backward (ESC-P ESC-p) (unbound) (unbound)
1144 Search backward in the history for a line beginning with the
1145 first word in the buffer.
1146
1147 If called from a function by the zle command with arguments, the
1148 first argument is taken as the string for which to search,
1149 rather than the first word in the buffer.
1150
1151 vi-history-search-backward (unbound) (/) (unbound)
1152 Search backward in the history for a specified string. The
1153 string may begin with `^' to anchor the search to the beginning
1154 of the line.
1155
1156 A restricted set of editing functions is available in the
1157 mini-buffer. An interrupt signal, as defined by the stty set‐
1158 ting, will stop the search. The functions available in the
1159 mini-buffer are: accept-line, backward-delete-char, vi-back‐
1160 ward-delete-char, backward-kill-word, vi-backward-kill-word,
1161 clear-screen, redisplay, quoted-insert and vi-quoted-insert.
1162
1163 vi-cmd-mode is treated the same as accept-line, and magic-space
1164 is treated as a space. Any other character that is not bound to
1165 self-insert or self-insert-unmeta will beep and be ignored. If
1166 the function is called from vi command mode, the bindings of the
1167 current insert mode will be used.
1168
1169 If called from a function by the zle command with arguments, the
1170 first argument is taken as the string for which to search,
1171 rather than the first word in the buffer.
1172
1173 history-search-forward (ESC-N ESC-n) (unbound) (unbound)
1174 Search forward in the history for a line beginning with the
1175 first word in the buffer.
1176
1177 If called from a function by the zle command with arguments, the
1178 first argument is taken as the string for which to search,
1179 rather than the first word in the buffer.
1180
1181 vi-history-search-forward (unbound) (?) (unbound)
1182 Search forward in the history for a specified string. The
1183 string may begin with `^' to anchor the search to the beginning
1184 of the line. The functions available in the mini-buffer are the
1185 same as for vi-history-search-backward. Argument handling is
1186 also the same as for that command.
1187
1188 infer-next-history (^X^N) (unbound) (unbound)
1189 Search in the history list for a line matching the current one
1190 and fetch the event following it.
1191
1192 insert-last-word (ESC-_ ESC-.) (unbound) (unbound)
1193 Insert the last word from the previous history event at the cur‐
1194 sor position. If a positive numeric argument is given, insert
1195 that word from the end of the previous history event. If the
1196 argument is zero or negative insert that word from the left
1197 (zero inserts the previous command word). Repeating this com‐
1198 mand replaces the word just inserted with the last word from the
1199 history event prior to the one just used; numeric arguments can
1200 be used in the same way to pick a word from that event.
1201
1202 When called from a shell function invoked from a user-defined
1203 widget, the command can take one to three arguments. The first
1204 argument specifies a history offset which applies to successive
1205 calls to this widget: if it is -1, the default behaviour is
1206 used, while if it is 1, successive calls will move forwards
1207 through the history. The value 0 can be used to indicate that
1208 the history line examined by the previous execution of the com‐
1209 mand will be reexamined. Note that negative numbers should be
1210 preceded by a `--' argument to avoid confusing them with
1211 options.
1212
1213 If two arguments are given, the second specifies the word on the
1214 command line in normal array index notation (as a more natural
1215 alternative to the prefix argument). Hence 1 is the first word,
1216 and -1 (the default) is the last word.
1217
1218 If a third argument is given, its value is ignored, but it is
1219 used to signify that the history offset is relative to the cur‐
1220 rent history line, rather than the one remembered after the pre‐
1221 vious invocations of insert-last-word.
1222
1223 For example, the default behaviour of the command corresponds to
1224
1225 zle insert-last-word -- -1 -1
1226
1227 while the command
1228
1229 zle insert-last-word -- -1 1 -
1230
1231 always copies the first word of the line in the history immedi‐
1232 ately before the line being edited. This has the side effect
1233 that later invocations of the widget will be relative to that
1234 line.
1235
1236 vi-repeat-search (unbound) (n) (unbound)
1237 Repeat the last vi history search.
1238
1239 vi-rev-repeat-search (unbound) (N) (unbound)
1240 Repeat the last vi history search, but in reverse.
1241
1242 up-line-or-history (^P ESC-[A) (k) (ESC-[A)
1243 Move up a line in the buffer, or if already at the top line,
1244 move to the previous event in the history list.
1245
1246 vi-up-line-or-history (unbound) (-) (unbound)
1247 Move up a line in the buffer, or if already at the top line,
1248 move to the previous event in the history list. Then move to
1249 the first non-blank character on the line.
1250
1251 up-line-or-search
1252 Move up a line in the buffer, or if already at the top line,
1253 search backward in the history for a line beginning with the
1254 first word in the buffer.
1255
1256 If called from a function by the zle command with arguments, the
1257 first argument is taken as the string for which to search,
1258 rather than the first word in the buffer.
1259
1260 up-history (unbound) (^P) (unbound)
1261 Move to the previous event in the history list.
1262
1263 history-beginning-search-forward
1264 Search forward in the history for a line beginning with the cur‐
1265 rent line up to the cursor. This leaves the cursor in its orig‐
1266 inal position.
1267
1268 Modifying Text
1269 vi-add-eol (unbound) (A) (unbound)
1270 Move to the end of the line and enter insert mode.
1271
1272 vi-add-next (unbound) (a) (unbound)
1273 Enter insert mode after the current cursor position, without
1274 changing lines.
1275
1276 backward-delete-char (^H ^?) (unbound) (unbound)
1277 Delete the character behind the cursor.
1278
1279 vi-backward-delete-char (unbound) (X) (^H)
1280 Delete the character behind the cursor, without changing lines.
1281 If in insert mode, this won't delete past the point where insert
1282 mode was last entered.
1283
1284 backward-delete-word
1285 Delete the word behind the cursor.
1286
1287 backward-kill-line
1288 Kill from the beginning of the line to the cursor position.
1289
1290 backward-kill-word (^W ESC-^H ESC-^?) (unbound) (unbound)
1291 Kill the word behind the cursor.
1292
1293 vi-backward-kill-word (unbound) (unbound) (^W)
1294 Kill the word behind the cursor, without going past the point
1295 where insert mode was last entered.
1296
1297 capitalize-word (ESC-C ESC-c) (unbound) (unbound)
1298 Capitalize the current word and move past it.
1299
1300 vi-change (unbound) (c) (unbound)
1301 Read a movement command from the keyboard, and kill from the
1302 cursor position to the endpoint of the movement. Then enter
1303 insert mode. If the command is vi-change, change the current
1304 line.
1305
1306 vi-change-eol (unbound) (C) (unbound)
1307 Kill to the end of the line and enter insert mode.
1308
1309 vi-change-whole-line (unbound) (S) (unbound)
1310 Kill the current line and enter insert mode.
1311
1312 copy-region-as-kill (ESC-W ESC-w) (unbound) (unbound)
1313 Copy the area from the cursor to the mark to the kill buffer.
1314
1315 If called from a ZLE widget function in the form `zle
1316 copy-region-as-kill string' then string will be taken as the
1317 text to copy to the kill buffer. The cursor, the mark and the
1318 text on the command line are not used in this case.
1319
1320 copy-prev-word (ESC-^_) (unbound) (unbound)
1321 Duplicate the word to the left of the cursor.
1322
1323 copy-prev-shell-word
1324 Like copy-prev-word, but the word is found by using shell pars‐
1325 ing, whereas copy-prev-word looks for blanks. This makes a dif‐
1326 ference when the word is quoted and contains spaces.
1327
1328 vi-delete (unbound) (d) (unbound)
1329 Read a movement command from the keyboard, and kill from the
1330 cursor position to the endpoint of the movement. If the command
1331 is vi-delete, kill the current line.
1332
1333 delete-char
1334 Delete the character under the cursor.
1335
1336 vi-delete-char (unbound) (x) (unbound)
1337 Delete the character under the cursor, without going past the
1338 end of the line.
1339
1340 delete-word
1341 Delete the current word.
1342
1343 down-case-word (ESC-L ESC-l) (unbound) (unbound)
1344 Convert the current word to all lowercase and move past it.
1345
1346 kill-word (ESC-D ESC-d) (unbound) (unbound)
1347 Kill the current word.
1348
1349 gosmacs-transpose-chars
1350 Exchange the two characters behind the cursor.
1351
1352 vi-indent (unbound) (>) (unbound)
1353 Indent a number of lines.
1354
1355 vi-insert (unbound) (i) (unbound)
1356 Enter insert mode.
1357
1358 vi-insert-bol (unbound) (I) (unbound)
1359 Move to the first non-blank character on the line and enter
1360 insert mode.
1361
1362 vi-join (^X^J) (J) (unbound)
1363 Join the current line with the next one.
1364
1365 kill-line (^K) (unbound) (unbound)
1366 Kill from the cursor to the end of the line. If already on the
1367 end of the line, kill the newline character.
1368
1369 vi-kill-line (unbound) (unbound) (^U)
1370 Kill from the cursor back to wherever insert mode was last
1371 entered.
1372
1373 vi-kill-eol (unbound) (D) (unbound)
1374 Kill from the cursor to the end of the line.
1375
1376 kill-region
1377 Kill from the cursor to the mark.
1378
1379 kill-buffer (^X^K) (unbound) (unbound)
1380 Kill the entire buffer.
1381
1382 kill-whole-line (^U) (unbound) (unbound)
1383 Kill the current line.
1384
1385 vi-match-bracket (^X^B) (%) (unbound)
1386 Move to the bracket character (one of {}, () or []) that matches
1387 the one under the cursor. If the cursor is not on a bracket
1388 character, move forward without going past the end of the line
1389 to find one, and then go to the matching bracket.
1390
1391 vi-open-line-above (unbound) (O) (unbound)
1392 Open a line above the cursor and enter insert mode.
1393
1394 vi-open-line-below (unbound) (o) (unbound)
1395 Open a line below the cursor and enter insert mode.
1396
1397 vi-oper-swap-case
1398 Read a movement command from the keyboard, and swap the case of
1399 all characters from the cursor position to the endpoint of the
1400 movement. If the movement command is vi-oper-swap-case, swap
1401 the case of all characters on the current line.
1402
1403 overwrite-mode (^X^O) (unbound) (unbound)
1404 Toggle between overwrite mode and insert mode.
1405
1406 vi-put-before (unbound) (P) (unbound)
1407 Insert the contents of the kill buffer before the cursor. If
1408 the kill buffer contains a sequence of lines (as opposed to
1409 characters), paste it above the current line.
1410
1411 vi-put-after (unbound) (p) (unbound)
1412 Insert the contents of the kill buffer after the cursor. If the
1413 kill buffer contains a sequence of lines (as opposed to charac‐
1414 ters), paste it below the current line.
1415
1416 quoted-insert (^V) (unbound) (unbound)
1417 Insert the next character typed into the buffer literally. An
1418 interrupt character will not be inserted.
1419
1420 vi-quoted-insert (unbound) (unbound) (^Q ^V)
1421 Display a `^' at the cursor position, and insert the next char‐
1422 acter typed into the buffer literally. An interrupt character
1423 will not be inserted.
1424
1425 quote-line (ESC-') (unbound) (unbound)
1426 Quote the current line; that is, put a `'' character at the
1427 beginning and the end, and convert all `'' characters to `'\'''.
1428
1429 quote-region (ESC-") (unbound) (unbound)
1430 Quote the region from the cursor to the mark.
1431
1432 vi-replace (unbound) (R) (unbound)
1433 Enter overwrite mode.
1434
1435 vi-repeat-change (unbound) (.) (unbound)
1436 Repeat the last vi mode text modification. If a count was used
1437 with the modification, it is remembered. If a count is given to
1438 this command, it overrides the remembered count, and is remem‐
1439 bered for future uses of this command. The cut buffer specifi‐
1440 cation is similarly remembered.
1441
1442 vi-replace-chars (unbound) (r) (unbound)
1443 Replace the character under the cursor with a character read
1444 from the keyboard.
1445
1446 self-insert (printable characters) (unbound) (printable characters and
1447 some control characters)
1448 Insert a character into the buffer at the cursor position.
1449
1450 self-insert-unmeta (ESC-^I ESC-^J ESC-^M) (unbound) (unbound)
1451 Insert a character into the buffer after stripping the meta bit
1452 and converting ^M to ^J.
1453
1454 vi-substitute (unbound) (s) (unbound)
1455 Substitute the next character(s).
1456
1457 vi-swap-case (unbound) (~) (unbound)
1458 Swap the case of the character under the cursor and move past
1459 it.
1460
1461 transpose-chars (^T) (unbound) (unbound)
1462 Exchange the two characters to the left of the cursor if at end
1463 of line, else exchange the character under the cursor with the
1464 character to the left.
1465
1466 transpose-words (ESC-T ESC-t) (unbound) (unbound)
1467 Exchange the current word with the one before it.
1468
1469 vi-unindent (unbound) (<) (unbound)
1470 Unindent a number of lines.
1471
1472 up-case-word (ESC-U ESC-u) (unbound) (unbound)
1473 Convert the current word to all caps and move past it.
1474
1475 yank (^Y) (unbound) (unbound)
1476 Insert the contents of the kill buffer at the cursor position.
1477
1478 yank-pop (ESC-y) (unbound) (unbound)
1479 Remove the text just yanked, rotate the kill-ring (the history
1480 of previously killed text) and yank the new top. Only works
1481 following yank or yank-pop.
1482
1483 vi-yank (unbound) (y) (unbound)
1484 Read a movement command from the keyboard, and copy the region
1485 from the cursor position to the endpoint of the movement into
1486 the kill buffer. If the command is vi-yank, copy the current
1487 line.
1488
1489 vi-yank-whole-line (unbound) (Y) (unbound)
1490 Copy the current line into the kill buffer.
1491
1492 vi-yank-eol
1493 Copy the region from the cursor position to the end of the line
1494 into the kill buffer. Arguably, this is what Y should do in vi,
1495 but it isn't what it actually does.
1496
1497 Arguments
1498 digit-argument (ESC-0..ESC-9) (1-9) (unbound)
1499 Start a new numeric argument, or add to the current one. See
1500 also vi-digit-or-beginning-of-line. This only works if bound to
1501 a key sequence ending in a decimal digit.
1502
1503 Inside a widget function, a call to this function treats the
1504 last key of the key sequence which called the widget as the
1505 digit.
1506
1507 neg-argument (ESC--) (unbound) (unbound)
1508 Changes the sign of the following argument.
1509
1510 universal-argument
1511 Multiply the argument of the next command by 4. Alternatively,
1512 if this command is followed by an integer (positive or nega‐
1513 tive), use that as the argument for the next command. Thus dig‐
1514 its cannot be repeated using this command. For example, if this
1515 command occurs twice, followed immediately by forward-char, move
1516 forward sixteen spaces; if instead it is followed by -2, then
1517 forward-char, move backward two spaces.
1518
1519 Inside a widget function, if passed an argument, i.e. `zle uni‐
1520 versal-argument num', the numerical argument will be set to num;
1521 this is equivalent to `NUMERIC=num'.
1522
1523 argument-base
1524 Use the existing numeric argument as a numeric base, which must
1525 be in the range 2 to 36 inclusive. Subsequent use of
1526 digit-argument and universal-argument will input a new prefix in
1527 the given base. The usual hexadecimal convention is used: the
1528 letter a or A corresponds to 10, and so on. Arguments in bases
1529 requiring digits from 10 upwards are more conveniently input
1530 with universal-argument, since ESC-a etc. are not usually bound
1531 to digit-argument.
1532
1533 The function can be used with a command argument inside a
1534 user-defined widget. The following code sets the base to 16 and
1535 lets the user input a hexadecimal argument until a key out of
1536 the digit range is typed:
1537
1538 zle argument-base 16
1539 zle universal-argument
1540
1541 Completion
1542 accept-and-menu-complete
1543 In a menu completion, insert the current completion into the
1544 buffer, and advance to the next possible completion.
1545
1546 complete-word
1547 Attempt completion on the current word.
1548
1549 delete-char-or-list (^D) (unbound) (unbound)
1550 Delete the character under the cursor. If the cursor is at the
1551 end of the line, list possible completions for the current word.
1552
1553 expand-cmd-path
1554 Expand the current command to its full pathname.
1555
1556 expand-or-complete (TAB) (unbound) (TAB)
1557 Attempt shell expansion on the current word. If that fails,
1558 attempt completion.
1559
1560 expand-or-complete-prefix
1561 Attempt shell expansion on the current word up to cursor.
1562
1563 expand-history (ESC-space ESC-!) (unbound) (unbound)
1564 Perform history expansion on the edit buffer.
1565
1566 expand-word (^X*) (unbound) (unbound)
1567 Attempt shell expansion on the current word.
1568
1569 list-choices (ESC-^D) (^D =) (^D)
1570 List possible completions for the current word.
1571
1572 list-expand (^Xg ^XG) (^G) (^G)
1573 List the expansion of the current word.
1574
1575 magic-space
1576 Perform history expansion and insert a space into the buffer.
1577 This is intended to be bound to space.
1578
1579 menu-complete
1580 Like complete-word, except that menu completion is used. See
1581 the MENU_COMPLETE option.
1582
1583 menu-expand-or-complete
1584 Like expand-or-complete, except that menu completion is used.
1585
1586 reverse-menu-complete
1587 Perform menu completion, like menu-complete, except that if a
1588 menu completion is already in progress, move to the previous
1589 completion rather than the next.
1590
1591 end-of-list
1592 When a previous completion displayed a list below the prompt,
1593 this widget can be used to move the prompt below the list.
1594
1595 Miscellaneous
1596 accept-and-hold (ESC-A ESC-a) (unbound) (unbound)
1597 Push the contents of the buffer on the buffer stack and execute
1598 it.
1599
1600 accept-and-infer-next-history
1601 Execute the contents of the buffer. Then search the history
1602 list for a line matching the current one and push the event fol‐
1603 lowing onto the buffer stack.
1604
1605 accept-line (^J ^M) (^J ^M) (^J ^M)
1606 Finish editing the buffer. Normally this causes the buffer to
1607 be executed as a shell command.
1608
1609 accept-line-and-down-history (^O) (unbound) (unbound)
1610 Execute the current line, and push the next history event on the
1611 the buffer stack.
1612
1613 auto-suffix-remove
1614 If the previous action added a suffix (space, slash, etc.) to
1615 the word on the command line, remove it. Otherwise do nothing.
1616 Removing the suffix ends any active menu completion or menu
1617 selection.
1618
1619 This widget is intended to be called from user-defined widgets
1620 to enforce a desired suffix-removal behavior.
1621
1622 auto-suffix-retain
1623 If the previous action added a suffix (space, slash, etc.) to
1624 the word on the command line, force it to be preserved. Other‐
1625 wise do nothing. Retaining the suffix ends any active menu com‐
1626 pletion or menu selection.
1627
1628 This widget is intended to be called from user-defined widgets
1629 to enforce a desired suffix-preservation behavior.
1630
1631 beep Beep, unless the BEEP option is unset.
1632
1633 vi-cmd-mode (^X^V) (unbound) (^[)
1634 Enter command mode; that is, select the `vicmd' keymap. Yes,
1635 this is bound by default in emacs mode.
1636
1637 vi-caps-lock-panic
1638 Hang until any lowercase key is pressed. This is for vi users
1639 without the mental capacity to keep track of their caps lock key
1640 (like the author).
1641
1642 clear-screen (^L ESC-^L) (^L) (^L)
1643 Clear the screen and redraw the prompt.
1644
1645 describe-key-briefly
1646 Reads a key sequence, then prints the function bound to that
1647 sequence.
1648
1649 exchange-point-and-mark (^X^X) (unbound) (unbound)
1650 Exchange the cursor position (point) with the position of the
1651 mark. Unless a negative prefix argument is given, the region
1652 between point and mark is activated so that it can be high‐
1653 lighted. If a zero prefix argument is given, the region is
1654 activated but point and mark are not swapped.
1655
1656 execute-named-cmd (ESC-x) (:) (unbound)
1657 Read the name of an editor command and execute it. A restricted
1658 set of editing functions is available in the mini-buffer. Keys
1659 are looked up in the special command keymap, and if not found
1660 there in the main keymap. An interrupt signal, as defined by
1661 the stty setting, will abort the function. Note that the fol‐
1662 lowing always perform the same task within the exe‐
1663 cuted-named-cmd environment and cannot be replaced by user
1664 defined widgets, nor can the set of functions be extended. The
1665 allowed functions are: backward-delete-char, vi-back‐
1666 ward-delete-char, clear-screen, redisplay, quoted-insert,
1667 vi-quoted-insert, backward-kill-word, vi-backward-kill-word,
1668 kill-whole-line, vi-kill-line, backward-kill-line, list-choices,
1669 delete-char-or-list, complete-word, accept-line, expand-or-com‐
1670 plete and expand-or-complete-prefix.
1671
1672 kill-region kills the last word, and vi-cmd-mode is treated the
1673 same as accept-line. The space and tab characters, if not bound
1674 to one of these functions, will complete the name and then list
1675 the possibilities if the AUTO_LIST option is set. Any other
1676 character that is not bound to self-insert or self-insert-unmeta
1677 will beep and be ignored. The bindings of the current insert
1678 mode will be used.
1679
1680 Currently this command may not be redefined or called by name.
1681
1682 execute-last-named-cmd (ESC-z) (unbound) (unbound)
1683 Redo the last function executed with execute-named-cmd.
1684
1685 Currently this command may not be redefined or called by name.
1686
1687 get-line (ESC-G ESC-g) (unbound) (unbound)
1688 Pop the top line off the buffer stack and insert it at the cur‐
1689 sor position.
1690
1691 pound-insert (unbound) (#) (unbound)
1692 If there is no # character at the beginning of the buffer, add
1693 one to the beginning of each line. If there is one, remove a #
1694 from each line that has one. In either case, accept the current
1695 line. The INTERACTIVE_COMMENTS option must be set for this to
1696 have any usefulness.
1697
1698 vi-pound-insert
1699 If there is no # character at the beginning of the current line,
1700 add one. If there is one, remove it. The INTERACTIVE_COMMENTS
1701 option must be set for this to have any usefulness.
1702
1703 push-input
1704 Push the entire current multiline construct onto the buffer
1705 stack and return to the top-level (PS1) prompt. If the current
1706 parser construct is only a single line, this is exactly like
1707 push-line. Next time the editor starts up or is popped with
1708 get-line, the construct will be popped off the top of the buffer
1709 stack and loaded into the editing buffer.
1710
1711 push-line (^Q ESC-Q ESC-q) (unbound) (unbound)
1712 Push the current buffer onto the buffer stack and clear the buf‐
1713 fer. Next time the editor starts up, the buffer will be popped
1714 off the top of the buffer stack and loaded into the editing buf‐
1715 fer.
1716
1717 push-line-or-edit
1718 At the top-level (PS1) prompt, equivalent to push-line. At a
1719 secondary (PS2) prompt, move the entire current multiline con‐
1720 struct into the editor buffer. The latter is equivalent to
1721 push-input followed by get-line.
1722
1723 read-command
1724 Only useful from a user-defined widget. A keystroke is read
1725 just as in normal operation, but instead of the command being
1726 executed the name of the command that would be executed is
1727 stored in the shell parameter REPLY. This can be used as the
1728 argument of a future zle command. If the key sequence is not
1729 bound, status 1 is returned; typically, however, REPLY is set to
1730 undefined-key to indicate a useless key sequence.
1731
1732 recursive-edit
1733 Only useful from a user-defined widget. At this point in the
1734 function, the editor regains control until one of the standard
1735 widgets which would normally cause zle to exit (typically an
1736 accept-line caused by hitting the return key) is executed.
1737 Instead, control returns to the user-defined widget. The status
1738 returned is non-zero if the return was caused by an error, but
1739 the function still continues executing and hence may tidy up.
1740 This makes it safe for the user-defined widget to alter the com‐
1741 mand line or key bindings temporarily.
1742
1743 The following widget, caps-lock, serves as an example.
1744 self-insert-ucase() {
1745 LBUFFER+=${(U)KEYS[-1]}
1746 }
1747
1748 integer stat
1749
1750 zle -N self-insert self-insert-ucase
1751 zle -A caps-lock save-caps-lock
1752 zle -A accept-line caps-lock
1753
1754 zle recursive-edit
1755 stat=$?
1756
1757 zle -A .self-insert self-insert
1758 zle -A save-caps-lock caps-lock
1759 zle -D save-caps-lock
1760
1761 (( stat )) && zle send-break
1762
1763 return $stat
1764 This causes typed letters to be inserted capitalised until
1765 either accept-line (i.e. typically the return key) is typed or
1766 the caps-lock widget is invoked again; the later is handled by
1767 saving the old definition of caps-lock as save-caps-lock and
1768 then rebinding it to invoke accept-line. Note that an error
1769 from the recursive edit is detected as a non-zero return status
1770 and propagated by using the send-break widget.
1771
1772 redisplay (unbound) (^R) (^R)
1773 Redisplays the edit buffer.
1774
1775 reset-prompt (unbound) (unbound) (unbound)
1776 Force the prompts on both the left and right of the screen to be
1777 re-expanded, then redisplay the edit buffer. This reflects
1778 changes both to the prompt variables themselves and changes in
1779 the expansion of the values (for example, changes in time or
1780 directory, or changes to the value of variables referred to by
1781 the prompt).
1782
1783 Otherwise, the prompt is only expanded each time zle starts, and
1784 when the display as been interrupted by output from another part
1785 of the shell (such as a job notification) which causes the com‐
1786 mand line to be reprinted.
1787
1788 send-break (^G ESC-^G) (unbound) (unbound)
1789 Abort the current editor function, e.g. execute-named-command,
1790 or the editor itself, e.g. if you are in vared. Otherwise abort
1791 the parsing of the current line; in this case the aborted line
1792 is available in the shell variable ZLE_LINE_ABORTED.
1793
1794 run-help (ESC-H ESC-h) (unbound) (unbound)
1795 Push the buffer onto the buffer stack, and execute the command
1796 `run-help cmd', where cmd is the current command. run-help is
1797 normally aliased to man.
1798
1799 vi-set-buffer (unbound) (") (unbound)
1800 Specify a buffer to be used in the following command. There are
1801 35 buffers that can be specified: the 26 `named' buffers "a to
1802 "z and the nine `queued' buffers "1 to "9. The named buffers
1803 can also be specified as "A to "Z.
1804
1805 When a buffer is specified for a cut command, the text being cut
1806 replaces the previous contents of the specified buffer. If a
1807 named buffer is specified using a capital, the newly cut text is
1808 appended to the buffer instead of overwriting it.
1809
1810 If no buffer is specified for a cut command, "1 is used, and the
1811 contents of "1 to "8 are each shifted along one buffer; the con‐
1812 tents of "9 is lost.
1813
1814 vi-set-mark (unbound) (m) (unbound)
1815 Set the specified mark at the cursor position.
1816
1817 set-mark-command (^@) (unbound) (unbound)
1818 Set the mark at the cursor position. If called with a negative
1819 prefix argument, do not set the mark but deactivate the region
1820 so that it is no longer highlighted (it is still usable for
1821 other purposes). Otherwise the region is marked as active.
1822
1823 spell-word (ESC-$ ESC-S ESC-s) (unbound) (unbound)
1824 Attempt spelling correction on the current word.
1825
1826 undefined-key
1827 This command is executed when a key sequence that is not bound
1828 to any command is typed. By default it beeps.
1829
1830 undo (^_ ^Xu ^X^U) (unbound) (unbound)
1831 Incrementally undo the last text modification.
1832
1833 redo Incrementally redo undone text modifications.
1834
1835 vi-undo-change (unbound) (u) (unbound)
1836 Undo the last text modification. If repeated, redo the modifi‐
1837 cation.
1838
1839 what-cursor-position (^X=) (unbound) (unbound)
1840 Print the character under the cursor, its code as an octal, dec‐
1841 imal and hexadecimal number, the current cursor position within
1842 the buffer and the column of the cursor in the current line.
1843
1844 where-is
1845 Read the name of an editor command and and print the listing of
1846 key sequences that invoke the specified command. A restricted
1847 set of editing functions is available in the mini-buffer. Keys
1848 are looked up in the special command keymap, and if not found
1849 there in the main keymap.
1850
1851 which-command (ESC-?) (unbound) (unbound)
1852 Push the buffer onto the buffer stack, and execute the command
1853 `which-command cmd'. where cmd is the current command.
1854 which-command is normally aliased to whence.
1855
1856 vi-digit-or-beginning-of-line (unbound) (0) (unbound)
1857 If the last command executed was a digit as part of an argument,
1858 continue the argument. Otherwise, execute vi-beginning-of-line.
1859
1861 The line editor has the ability to highlight characters or regions of
1862 the line that have a particular significance. This is controlled by
1863 the array parameter zle_highlight, if it has been set by the user.
1864
1865 If the parameter contains the single entry none all highlighting is
1866 turned off. Note the parameter is still expected to be an array.
1867
1868 Otherwise each entry of the array should consist of a word indicating a
1869 context for highlighting, then a colon, then a comma-separated list of
1870 the types of highlighting to apply in that context.
1871
1872 The contexts available for highlighting are the following:
1873
1874 default
1875 Any text within the command line not affected by any other high‐
1876 lighting. Text outside the editable area of the command line is
1877 not affected.
1878
1879 isearch
1880 When one of the incremental history search widgets is active,
1881 the area of the command line matched by the search string or
1882 pattern.
1883
1884 region The region between the cursor (point) and the mark as set with
1885 set-mark-command. The region is only highlighted if it is
1886 active, which is the case if set-mark-command or
1887 exchange-point-and-mark has been called and the line has not
1888 been subsequently modified. The region can be deactivated by
1889 calling set-mark-command with a negative prefix argument, or
1890 reactivated by calling exchange-point-and-mark with a zero pre‐
1891 fix argument. Note that whether or not the region is active has
1892 no effect on its use within widgets, it simply determines
1893 whether it is highlighted.
1894
1895 special
1896 Individual characters that have no direct printable representa‐
1897 tion but are shown in a special manner by the line editor.
1898 These characters are described below.
1899
1900 suffix This context is used in completion for characters that are
1901 marked as suffixes that will be removed if the completion ends
1902 at that point, the most obvious example being a slash (/) after
1903 a directory name. Note that suffix removal is configurable; the
1904 circumstances under which the suffix will be removed may differ
1905 for different completions.
1906
1907 zle_highlight may contain additional fields for controlling how termi‐
1908 nal sequences to change colours are output. Each of the following is
1909 followed by a colon and a string in the same form as for key bindings.
1910 This will not be necessary for the vast majority of terminals as the
1911 defaults shown in parentheses are widely used.
1912
1913 fg_start_code (\e[3)
1914 The start of the escape sequence for the foreground colour.
1915 This is followed by an ASCII digit representing the colour.
1916
1917 fg_default_code (9)
1918 The number to use instead of the colour to reset the default
1919 foreground colour.
1920
1921 fg_end_code (m)
1922 The end of the escape sequence for the foreground colour.
1923
1924 bg_start_code (\e[4)
1925 The start of the escape sequence for the background colour.
1926 This is followed by an ASCII digit representing the colour.
1927
1928 bg_default_code (9)
1929 The number to use instead of the colour to reset the default
1930 background colour.
1931
1932 bg_end_code (m)
1933 The end of the escape sequence for the background colour.
1934
1935 The available types of highlighting are the following. Note that not
1936 all types of highlighting are available on all terminals:
1937
1938 none No highlighting is applied to the given context. It is not use‐
1939 ful for this to appear with other types of highlighting; it is
1940 used to override a default.
1941
1942 fg=colour
1943 The foreground colour should be set to colour, a decimal integer
1944 or the name of one of the eight most widely-supported colours.
1945
1946 Not all terminals support this and, of those that do, not all
1947 provide facilities to test the support, hence the user should
1948 decide based on the terminal type. Most terminals support the
1949 colours black, red, green, yellow, blue, magenta, cyan and
1950 white, which can be set by name. In addition. default may be
1951 used to set the terminal's default foreground colour. Abbrevia‐
1952 tions are allowed; b or bl selects black. Some terminals may
1953 generate additional colours if the bold attribute is also
1954 present.
1955
1956 On recent terminals and on systems with an up-to-date terminal
1957 database the number of colours supported may be tested by the
1958 command `echotc Co'; if this succeeds, it indicates a limit on
1959 the number of colours which will be enforced by the line editor.
1960 The number of colours is in any case limited to 256 (i.e. the
1961 range 0 to 255).
1962
1963 Colour is also known as color.
1964
1965 bg=colour
1966 The background colour should be set to colour. This works simi‐
1967 larly to the foreground colour, except the background is not
1968 usually affected by the bold attribute.
1969
1970 bold The characters in the given context are shown in a bold font.
1971 Not all terminals distinguish bold fonts.
1972
1973 standout
1974 The characters in the given context are shown in the terminal's
1975 standout mode. The actual effect is specific to the terminal;
1976 on many terminals it is inverse video. On some such terminals,
1977 where the cursor does not blink it appears with standout mode
1978 negated, making it less than clear where the cursor actually is.
1979 On such terminals one of the other effects may be preferable for
1980 highlighting the region and matched search string.
1981
1982 underline
1983 The characters in the given context are shown underlined. Some
1984 terminals show the foreground in a different colour instead; in
1985 this case whitespace will not be highlighted.
1986
1987 The characters described above as `special' are as follows. The for‐
1988 matting described here is used irrespective of whether the characters
1989 are highlighted:
1990
1991 ASCII control characters
1992 Control characters in the ASCII range are shown as `^' followed
1993 by the base character.
1994
1995 Unprintable multibyte characters
1996 This item applies to control characters not in the ASCII range,
1997 plus other characters as follows. If the MULTIBYTE option is in
1998 effect, multibyte characters not in the ASCII character set that
1999 are reported as having zero width are treated as combining char‐
2000 acters when the option COMBINING_CHARS is on. If the option is
2001 off, or if a character appears where a combining character is
2002 not valid, the character is treated as unprintable.
2003
2004 Unprintable multibyte characters are shown as a hexadecimal num‐
2005 ber between angle brackets. The number is the code point of the
2006 character in the wide character set; this may or may not be Uni‐
2007 code, depending on the operating system.
2008
2009 Invalid multibyte characters
2010 If the MULTIBYTE option is in effect, any sequence of one or
2011 more bytes that does not form a valid character in the current
2012 character set is treated as a series of bytes each shown as a
2013 special character. This case can be distinguished from other
2014 unprintable characters as the bytes are represented as two hexa‐
2015 decimal digits between angle brackets, as distinct from the four
2016 or eight digits that are used for unprintable characters that
2017 are nonetheless valid in the current character set.
2018
2019 Not all systems support this: for it to work, the system's rep‐
2020 resentation of wide characters must be code values from the Uni‐
2021 versal Character Set, as defined by IS0 10646 (also known as
2022 Unicode).
2023
2024 If zle_highlight is not set or no value applies to a particular con‐
2025 text, the defaults applied are equivalent to
2026
2027 zle_highlight=(region:standout special:standout
2028 suffix:bold isearch:underline)
2029
2030 i.e. both the region and special characters are shown in standout mode.
2031
2032 Within widgets, arbitrary regions may be highlighted by setting the
2033 special array parameter region_highlight; see above.
2034
2035zsh 4.3.11 December 20, 2010 ZSHZLE(1)