1ZSHZLE(1)                   General Commands Manual                  ZSHZLE(1)
2
3
4

NAME

6       zshzle - zsh command line editor
7

DESCRIPTION

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

KEYMAPS

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

ZLE BUILTINS

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 -T [ tc function | -r tc | -L ]
319       zle widget [ -n num ] [ -Nw ] [ -K keymap ] args ...
320              The zle builtin performs a number of different actions  concern‐
321              ing ZLE.
322
323              With no options and no arguments, only the return status will be
324              set.  It is zero if ZLE is currently active and widgets could be
325              invoked using this builtin command and non-zero otherwise.  Note
326              that even if non-zero status  is  returned,  zle  may  still  be
327              active  as  part  of  the completion system; this does not allow
328              direct calls to ZLE widgets.
329
330              Otherwise, which operation it performs depends on its options:
331
332              -l [ -L | -a ]
333                     List all existing user-defined widgets.  If the -L option
334                     is  used,  list in the form of zle commands to create the
335                     widgets.
336
337                     When combined with the -a option, all  widget  names  are
338                     listed,  including  the builtin ones. In this case the -L
339                     option is ignored.
340
341                     If at least one string is given, and -a is present or  -L
342                     is  not used, nothing will be printed.  The return status
343                     will be zero if all strings are names of existing widgets
344                     and  non-zero  if  at least one string is not a name of a
345                     defined widget.  If -a is also present, all widget  names
346                     are  used  for  the comparison including builtin widgets,
347                     else only user-defined widgets are used.
348
349                     If at least one string is present and the  -L  option  is
350                     used, user-defined widgets matching any string are listed
351                     in the form of zle commands to create the widgets.
352
353              -D widget ...
354                     Delete the named widgets.
355
356              -A old-widget new-widget
357                     Make the new-widget name an alias for old-widget, so that
358                     both  names  refer  to  the  same widget.  The names have
359                     equal standing; if either is deleted, the other  remains.
360                     If there is already a widget with the new-widget name, it
361                     is deleted.
362
363              -N widget [ function ]
364                     Create a user-defined widget.  If there is already a wid‐
365                     get with the specified name, it is overwritten.  When the
366                     new widget is invoked from within the editor, the  speci‐
367                     fied  shell  function  is called.  If no function name is
368                     specified, it defaults to the same name  as  the  widget.
369                     For  further information, see the section Widgets in zsh‐
370                     zle(1).
371
372              -C widget completion-widget function
373                     Create a user-defined completion widget named widget. The
374                     completion  widget  will behave like the built-in comple‐
375                     tion-widget whose name is given as completion-widget.  To
376                     generate  the  completions,  the  shell function function
377                     will be called.  For further  information,  see  zshcomp‐
378                     wid(1).
379
380              -R [ -c ] [ display-string ] [ string ... ]
381                     Redisplay  the  command  line;  this is to be called from
382                     within a user-defined widget to allow changes  to  become
383                     visible.   If  a  display-string  is given and not empty,
384                     this is shown in the status line (immediately  below  the
385                     line being edited).
386
387                     If  the  optional strings are given they are listed below
388                     the prompt in  the  same  way  as  completion  lists  are
389                     printed.  If  no  strings  are given but the -c option is
390                     used such a list is cleared.
391
392                     Note that this option is only useful for widgets that  do
393                     not  exit  immediately after using it because the strings
394                     displayed will be erased immediately  after  return  from
395                     the widget.
396
397                     This  command  can  safely be called outside user defined
398                     widgets; if zle is active, the display will be refreshed,
399                     while  if  zle  is not active, the command has no effect.
400                     In this case there will usually be no other arguments.
401
402                     The status is zero if zle was active, else one.
403
404              -M string
405                     As with the -R option, the string will be displayed below
406                     the  command  line; unlike the -R option, the string will
407                     not be put into the  status  line  but  will  instead  be
408                     printed  normally  below the prompt.  This means that the
409                     string will still be displayed after the  widget  returns
410                     (until it is overwritten by subsequent commands).
411
412              -U string
413                     This  pushes  the characters in the string onto the input
414                     stack of ZLE.  After the widget currently  executed  fin‐
415                     ishes  ZLE will behave as if the characters in the string
416                     were typed by the user.
417
418                     As ZLE uses a stack, if this option  is  used  repeatedly
419                     the  last  string pushed onto the stack will be processed
420                     first.  However, the characters in each  string  will  be
421                     processed  in  the  order  in  which  they  appear in the
422                     string.
423
424              -K keymap
425                     Selects the keymap named keymap.  An error  message  will
426                     be displayed if there is no such keymap.
427
428                     This  keymap selection affects the interpretation of fol‐
429                     lowing keystrokes within this  invocation  of  ZLE.   Any
430                     following  invocation  (e.g., the next command line) will
431                     start as usual with the `main' keymap selected.
432
433              -F [ -L ] [ fd [ handler ] ]
434                     Only available if your system supports one of the  `poll'
435                     or `select' system calls; most modern systems do.
436
437                     Installs handler (the name of a shell function) to handle
438                     input from file descriptor fd.  When zle is attempting to
439                     read data, it will examine both the terminal and the list
440                     of handled fd's.  If data becomes available on a  handled
441                     fd,  zle will call handler with the fd which is ready for
442                     reading as the only argument.  If  the  handler  produces
443                     output  to  the  terminal, it should call `zle -I' before
444                     doing so (see below).  The handler should not attempt  to
445                     read  from  the terminal.  Note that zle makes no attempt
446                     to check  whether  this  fd  is  actually  readable  when
447                     installing  the  handler.   The  user must make their own
448                     arrangements for handling the file descriptor when zle is
449                     not active.
450
451                     Any  number  of  handlers for any number of readable file
452                     descriptors may be installed.  Installing a  handler  for
453                     an  fd  which is already handled causes the existing han‐
454                     dler to be replaced.
455
456                     If no handler is given, but an fd is present, any handler
457                     for  that fd is removed.  If there is none, an error mes‐
458                     sage is printed and status 1 is returned.
459
460                     If no arguments are given, or the -L option is  supplied,
461                     a  list  of  handlers  is  printed in a form which can be
462                     stored for later execution.
463
464                     An fd (but not a handler) may optionally  be  given  with
465                     the  -L  option; in this case, the function will list the
466                     handler if any, else silently return status 1.
467
468                     Note that this feature should be used with care.   Activ‐
469                     ity  on one of the fd's which is not properly handled can
470                     cause the terminal to become unusable.
471
472                     Here is a simple example of using this feature.   A  con‐
473                     nection  to  a  remote TCP port is created using the ztcp
474                     command; see the description of the zsh/net/tcp module in
475                     zshmodules(1).   Then a handler is installed which simply
476                     prints out any data which  arrives  on  this  connection.
477                     Note that `select' will indicate that the file descriptor
478                     needs handling if the remote side has closed the  connec‐
479                     tion; we handle that by testing for a failed read.
480                            if ztcp pwspc 2811; then
481                              tcpfd=$REPLY
482                              handler() {
483                                zle -I
484                                local line
485                                if ! read -r line <&$1; then
486                                  # select marks this fd if we reach EOF,
487                                  # so handle this specially.
488                                  print "[Read on fd $1 failed, removing.]" >&2
489                                  zle -F $1
490                                  return 1
491                                fi
492                                print -r - $line
493                              }
494                              zle -F $tcpfd handler
495                            fi
496
497              -I     Unusually,  this  option  is most useful outside ordinary
498                     widget functions, though it may be used within if  normal
499                     output  to  the terminal is required.  It invalidates the
500                     current zle display in preparation for output;  typically
501                     this  will  be from a trap function.  It has no effect if
502                     zle is not active.  When a trap exits, the  shell  checks
503                     to  see if the display needs restoring, hence the follow‐
504                     ing will print output in such a way as not to disturb the
505                     line being edited:
506
507                            TRAPUSR1() {
508                                # Invalidate zle display
509                              [[ -o zle ]] && zle -I
510                                # Show output
511                              print Hello
512                            }
513
514                     In  general,  the  trap function may need to test whether
515                     zle is active before using this method (as shown  in  the
516                     example),  since  the  zsh/zle  module  may  not  even be
517                     loaded; if it is not, the command can be skipped.
518
519                     It is possible to call `zle -I' several times before con‐
520                     trol  is returned to the editor; the display will only be
521                     invalidated the first time to minimise disruption.
522
523                     Note that there are normally better ways of  manipulating
524                     the  display  from  within zle widgets; see, for example,
525                     `zle -R' above.
526
527                     The returned status is zero if zle was invalidated,  even
528                     though  this may have been by a previous call to `zle -I'
529                     or by a system notification.  To test if a zle widget may
530                     be  called  at  this point, execute zle with no arguments
531                     and examine the return status.
532
533              -T     This is used to add, list or remove internal  transforma‐
534                     tions on the processing performed by the line editor.  It
535                     is typically used only for debugging or  testing  and  is
536                     therefore of little interest to the general user.
537
538                     `zle  -T  transformation  func'  specifies that the given
539                     transformation (see below) is effected by shell  function
540                     func.
541
542                     `zle -Tr transformation' removes the given transformation
543                     if it was present (it is not an error if none was).
544
545                     `zle -TL' can be used to list  all  transformations  cur‐
546                     rently in operation.
547
548                     Currently  the  only  transformation is tc.  This is used
549                     instead of outputting  termcap  codes  to  the  terminal.
550                     When  the  transformation is in operation the shell func‐
551                     tion is passed the termcap code that would be  output  as
552                     its  first  argument; if the operation required a numeric
553                     argument, that is passed as a second argument.  The func‐
554                     tion  should  set  the shell variable REPLY to the trans‐
555                     formed termcap code.  Typically this is used  to  produce
556                     some  simply  formatted  version of the code and optional
557                     argument for debugging or testing.  Note that this trans‐
558                     formation is not applied to other non-printing characters
559                     such as carriage returns and newlines.
560
561              widget [ -n num ] [ -Nw ] [ -K keymap ] args ...
562                     Invoke the specified widget.  This can only be done  when
563                     ZLE   is   active;   normally   this  will  be  within  a
564                     user-defined widget.
565
566                     With the options -n and -N, the current  numerical  argu‐
567                     ment  will  be  saved and then restored after the call to
568                     widget; `-n num' sets the numerical argument  temporarily
569                     to  num,  while  `-N'  sets it to the default, i.e. as if
570                     there were none.
571
572                     With the option -K, keymap will be used  as  the  current
573                     keymap  during the execution of the widget.  The previous
574                     keymap will be restored when the widget exits.
575
576                     Normally, calling a widget in this way does not  set  the
577                     special  parameter WIDGET and related parameters, so that
578                     the environment appears as if the top-level widget called
579                     by  the user were still active.  With the option -w, WID‐
580                     GET and related parameters are set to reflect the  widget
581                     being executed by the zle call.
582
583                     Any  further arguments will be passed to the widget; note
584                     that as standard argument handling is performed, any gen‐
585                     eral  argument list should be preceded by --.  If it is a
586                     shell function,  these  are  passed  down  as  positional
587                     parameters; for builtin widgets it is up to the widget in
588                     question what it does with them.  Currently arguments are
589                     only handled by the incremental-search commands, the his‐
590                     tory-search-forward and -backward and  the  corresponding
591                     functions prefixed by vi-, and by universal-argument.  No
592                     error is flagged if the command does not  use  the  argu‐
593                     ments, or only uses some of them.
594
595                     The  return status reflects the success or failure of the
596                     operation carried out by  the  widget,  or  if  it  is  a
597                     user-defined  widget the return status of the shell func‐
598                     tion.
599
600                     A non-zero return status causes the shell  to  beep  when
601                     the  widget  exits,  unless the BEEP options was unset or
602                     the widget was called via the zle  command.   Thus  if  a
603                     user defined widget requires an immediate beep, it should
604                     call the beep widget directly.
605

WIDGETS

607       All actions in the editor are performed by `widgets'.  A  widget's  job
608       is  simply  to  perform  some  small action.  The ZLE commands that key
609       sequences in keymaps are bound to are in fact widgets.  Widgets can  be
610       user-defined or built in.
611
612       The  standard  widgets  built  into  ZLE are listed in Standard Widgets
613       below.  Other built-in widgets can be defined  by  other  modules  (see
614       zshmodules(1)).  Each built-in widget has two names: its normal canoni‐
615       cal name, and the same name preceded by a `.'.  The `.'  name  is  spe‐
616       cial: it can't be rebound to a different widget.  This makes the widget
617       available even when its usual name has been redefined.
618
619       User-defined widgets are defined using `zle  -N',  and  implemented  as
620       shell  functions.  When the widget is executed, the corresponding shell
621       function is executed, and can perform editing (or other)  actions.   It
622       is recommended that user-defined widgets should not have names starting
623       with `.'.
624

USER-DEFINED WIDGETS

626       User-defined widgets, being implemented as shell functions, can execute
627       any  normal  shell  command.   They can also run other widgets (whether
628       built-in or user-defined) using the zle builtin command.  The  standard
629       input of the function is closed to prevent external commands from unin‐
630       tentionally blocking ZLE by reading from the terminal, but read  -k  or
631       read  -q can be used to read characters.  Finally, they can examine and
632       edit the ZLE buffer being edited by reading  and  setting  the  special
633       parameters described below.
634
635       These  special parameters are always available in widget functions, but
636       are not in any way special outside ZLE.  If they have some normal value
637       outside  ZLE,  that  value is temporarily inaccessible, but will return
638       when the widget function exits.  These special parameters in fact  have
639       local scope, like parameters created in a function using local.
640
641       Inside  completion  widgets and traps called while ZLE is active, these
642       parameters are available read-only.
643
644       BUFFER (scalar)
645              The entire contents of the edit buffer.  If it  is  written  to,
646              the  cursor remains at the same offset, unless that would put it
647              outside the buffer.
648
649       BUFFERLINES (integer)
650              The number of screen lines needed for the edit buffer  currently
651              displayed  on  screen (i.e. without any changes to the preceding
652              parameters done after the last redisplay); read-only.
653
654       CONTEXT (scalar)
655              The context in which zle was called to read a  line;  read-only.
656              One of the values:
657       start  The start of a command line (at prompt PS1).
658
659       cont   A continuation to a command line (at prompt PS2).
660
661       select In a select loop.
662
663       vared  Editing a variable in vared.
664
665       CURSOR (integer)
666              The  offset  of  the cursor, within the edit buffer.  This is in
667              the  range  0  to  $#BUFFER,  and  is  by  definition  equal  to
668              $#LBUFFER.   Attempts to move the cursor outside the buffer will
669              result in the cursor being moved to the appropriate end  of  the
670              buffer.
671
672       CUTBUFFER (scalar)
673              The  last item cut using one of the `kill-' commands; the string
674              which the next yank would insert in the line.  Later entries  in
675              the  kill ring are in the array killring.  Note that the command
676              `zle copy-region-as-kill string' can be used to set the text  of
677              the  cut buffer from a shell function and cycle the kill ring in
678              the same way as interactively killing text.
679
680       HISTNO (integer)
681              The current history number.  Setting this has the same effect as
682              moving  up  or  down in the history to the corresponding history
683              line.  An attempt to set it is ignored if the line is not stored
684              in  the  history.   Note  this  is not the same as the parameter
685              HISTCMD, which always gives the number of the history line being
686              added  to  the  main shell's history.  HISTNO refers to the line
687              being retrieved within zle.
688
689       KEYMAP (scalar)
690              The name of the currently selected keymap; read-only.
691
692       KEYS (scalar)
693              The keys typed to invoke  this  widget,  as  a  literal  string;
694              read-only.
695
696       killring (array)
697              The  array  of  previously  killed items, with the most recently
698              killed first.  This gives the items that would be retrieved by a
699              yank-pop  in  the  same  order.   Note,  however,  that the most
700              recently killed item is in $CUTBUFFER; $killring shows the array
701              of previous entries.
702
703              The  default size for the kill ring is eight, however the length
704              may be changed by normal array operations.  Any empty string  in
705              the kill ring is ignored by the yank-pop command, hence the size
706              of the array effectively sets the maximum  length  of  the  kill
707              ring,  while  the  number  of non-zero strings gives the current
708              length, both as seen by the user at the command line.
709
710       LASTABORTEDSEARCH (scalar)
711              The last search string used by an interactive  search  that  was
712              aborted by the user (status 3 returned by the search widget).
713
714       LASTSEARCH (scalar)
715              The last search string used by an interactive search; read-only.
716              This is set even if the search failed (status 0, 1 or 2 returned
717              by the search widget), but not if it was aborted by the user.
718
719       LASTWIDGET (scalar)
720              The name of the last widget that was executed; read-only.
721
722       LBUFFER (scalar)
723              The part of the buffer that lies to the left of the cursor posi‐
724              tion.  If it is assigned to, only that part  of  the  buffer  is
725              replaced,  and  the  cursor remains between the new $LBUFFER and
726              the old $RBUFFER.
727
728       MARK (integer)
729              Like CURSOR, but for the mark.
730
731       NUMERIC (integer)
732              The numeric argument. If no numeric  argument  was  given,  this
733              parameter  is  unset. When this is set inside a widget function,
734              builtin widgets called with the zle builtin command will use the
735              value assigned. If it is unset inside a widget function, builtin
736              widgets called behave as if no numeric argument was given.
737
738       PENDING (integer)
739              The number of bytes pending for input, i.e. the number of  bytes
740              which  have  already  been typed and can immediately be read. On
741              systems where the shell is not able  to  get  this  information,
742              this parameter will always have a value of zero.  Read-only.
743
744       PREBUFFER (scalar)
745              In  a  multi-line  input at the secondary prompt, this read-only
746              parameter contains the contents of the lines before the one  the
747              cursor is currently in.
748
749       PREDISPLAY (scalar)
750              Text  to be displayed before the start of the editable text buf‐
751              fer.  This does not have to be a complete  line;  to  display  a
752              complete  line, a newline must be appended explicitly.  The text
753              is reset on each new invocation (but not  recursive  invocation)
754              of zle.
755
756       POSTDISPLAY (scalar)
757              Text  to be displayed after the end of the editable text buffer.
758              This does not have to be a complete line; to display a  complete
759              line, a newline must be prepended explicitly.  The text is reset
760              on each new invocation (but not recursive invocation) of zle.
761
762       RBUFFER (scalar)
763              The part of the buffer that lies to  the  right  of  the  cursor
764              position.  If it is assigned to, only that part of the buffer is
765              replaced, and the cursor remains between the  old  $LBUFFER  and
766              the new $RBUFFER.
767
768       REGION_ACTIVE (integer)
769              Indicates if the region is currently active.  It can be assigned
770              0 or 1 to deactivate and activate the region  respectively;  see
771              Character Highlighting below.
772
773       region_highlight (array)
774              Each element of this array may be set to a string that describes
775              highlighting for an arbitrary region of the  command  line  that
776              will  take effect the next time the command line is redisplayed.
777              Highlighting of the non-editable parts of the  command  line  in
778              PREDISPLAY  and  POSTDISPLAY  are  possible, but note that the P
779              flag is needed for character indexing to include PREDISPLAY.
780
781              Each string consists of the following parts:
782
783              Optionally, a `P' to signify that the start and end offset that
784                     follow include any string set by the  PREDISPLAY  special
785                     parameter; this is needed if the predisplay string itself
786                     is to be highlighted.  Whitespace may follow the `P'.
787              A start offset in the same units as CURSOR, terminated by
788                     whitespace.
789              An end offset in the same units as CURSOR, terminated by
790                     whitespace.
791              A highlight specification in the same format as
792                     used for contexts in  the  parameter  zle_highlight,  see
793                     Character  Highlighting  below;  for example, standout or
794                     fg=red,bold.
795
796              For example,
797
798                     region_highlight=("P0 20 bold")
799
800              specifies that the first twenty characters of the text including
801              any predisplay string should be highlighted in bold.
802
803              Note that the effect of region_highlight is not saved and disap‐
804              pears as soon as the line is accepted.
805
806       UNDO_CHANGE_NO (integer)
807              A number representing the state of the undo history.   The  only
808              use  of  this  is  passing  as an argument to the undo widget in
809              order to undo back to the recorded point.  Read-only.
810
811       WIDGET (scalar)
812              The name of the widget currently being executed; read-only.
813
814       WIDGETFUNC (scalar)
815              The name of the shell function that implements a widget  defined
816              with  either  zle -N or zle -C.  In the former case, this is the
817              second argument to the zle -N command that defined  the  widget,
818              or  the  first argument if there was no second argument.  In the
819              latter case this is the third argument to  the  zle  -C  command
820              that defined the widget.  Read-only.
821
822       WIDGETSTYLE (scalar)
823              Describes  the  implementation behind the completion widget cur‐
824              rently being executed; the second argument that followed zle  -C
825              when the widget was defined.  This is the name of a builtin com‐
826              pletion widget.  For widgets defined with zle -N this is set  to
827              the empty string.  Read-only.
828
829       ZLE_STATE (scalar)
830              Contains  a  set of space-separated words that describe the cur‐
831              rent zle state.
832
833              Currently, the states shown are the insert mode as  set  by  the
834              overwrite-mode  or  vi-replace  widgets and whether history com‐
835              mands  will  visit  imported  entries  as  controlled   by   the
836              set-local-history widget.  The string contains `insert' if char‐
837              acters to be inserted on the command line move existing  charac‐
838              ters  to  the  right or `overwrite' if characters to be inserted
839              overwrite existing characters.  It  contains  `localhistory'  if
840              only  local  history commands will be visited or `globalhistory'
841              if imported history commands will also be visited.
842
843              The substrings are sorted in alphabetical order so that  if  you
844              want  to test for two specific substrings in a future-proof way,
845              you can do match by doing:
846
847                     if [[ $ZLE_STATE == *insert*globalhistory* ]]; then ...; fi
848
849   Special Widgets
850       There are a few user-defined widgets which are special  to  the  shell.
851       If they do not exist, no special action is taken.  The environment pro‐
852       vided is identical to that for any other editing widget.
853
854       zle-isearch-exit
855              Executed at the end of incremental search at the point where the
856              isearch    prompt    is   removed   from   the   display.    See
857              zle-isearch-update for an example.
858
859       zle-isearch-update
860              Executed within incremental search when the display is about  to
861              be  redrawn.   Additional  output  below  the incremental search
862              prompt can be generated by using `zle  -M'  within  the  widget.
863              For example,
864
865                     zle-isearch-update() { zle -M "Line $HISTNO"; }
866                     zle -N zle-isearch-update
867
868              Note  the  line  output  by `zle -M' is not deleted on exit from
869              incremental search.  This can be done  from  a  zle-isearch-exit
870              widget:
871
872                     zle-isearch-exit() { zle -M ""; }
873                     zle -N zle-isearch-exit
874
875       zle-line-init
876              Executed  every  time  the  line editor is started to read a new
877              line of input.  The following example puts the line editor  into
878              vi command mode when it starts up.
879
880                     zle-line-init() { zle -K vicmd; }
881                     zle -N zle-line-init
882
883              (The command inside the function sets the keymap directly; it is
884              equivalent to zle vi-cmd-mode.)
885
886       zle-line-finish
887              This is similar to zle-line-init but is executed every time  the
888              line editor has finished reading a line of input.
889
890       zle-history-line-set
891              Executed when the history line changes.
892
893       zle-keymap-select
894              Executed every time the keymap changes, i.e. the special parame‐
895              ter KEYMAP is set to a different value, while the line editor is
896              active.   Initialising  the  keymap  when the line editor starts
897              does not cause the widget to be called.
898
899              The value $KEYMAP within the function reflects the  new  keymap.
900              The old keymap is passed as the sole argument.
901
902              This  can  be used for detecting switches between the vi command
903              (vicmd) and insert (usually main) keymaps.
904

STANDARD WIDGETS

906       The following is a list of all the standard widgets, and their  default
907       bindings  in  emacs  mode,  vi  command  mode  and  vi insert mode (the
908       `emacs', `vicmd' and `viins' keymaps, respectively).
909
910       Note that cursor keys are bound to movement keys in all three  keymaps;
911       the  shell assumes that the cursor keys send the key sequences reported
912       by the  terminal-handling  library  (termcap  or  terminfo).   The  key
913       sequences  shown  in  the  list are those based on the VT100, common on
914       many modern terminals, but in fact these are not necessarily bound.  In
915       the  case  of  the  viins  keymap,  the initial escape character of the
916       sequences serves also to return to the vicmd keymap: whether this  hap‐
917       pens is determined by the KEYTIMEOUT parameter, see zshparam(1).
918
919   Movement
920       vi-backward-blank-word (unbound) (B) (unbound)
921              Move  backward  one word, where a word is defined as a series of
922              non-blank characters.
923
924       backward-char (^B ESC-[D) (unbound) (unbound)
925              Move backward one character.
926
927       vi-backward-char (unbound) (^H h ^?) (ESC-[D)
928              Move backward one character, without changing lines.
929
930       backward-word (ESC-B ESC-b) (unbound) (unbound)
931              Move to the beginning of the previous word.
932
933       emacs-backward-word
934              Move to the beginning of the previous word.
935
936       vi-backward-word (unbound) (b) (unbound)
937              Move to the beginning of the previous word, vi-style.
938
939       beginning-of-line (^A) (unbound) (unbound)
940              Move to the beginning of the line.  If already at the  beginning
941              of the line, move to the beginning of the previous line, if any.
942
943       vi-beginning-of-line
944              Move to the beginning of the line, without changing lines.
945
946       end-of-line (^E) (unbound) (unbound)
947              Move to the end of the line.  If already at the end of the line,
948              move to the end of the next line, if any.
949
950       vi-end-of-line (unbound) ($) (unbound)
951              Move to the end of the line.  If an argument is  given  to  this
952              command,  the cursor will be moved to the end of the line (argu‐
953              ment - 1) lines down.
954
955       vi-forward-blank-word (unbound) (W) (unbound)
956              Move forward one word, where a word is defined as  a  series  of
957              non-blank characters.
958
959       vi-forward-blank-word-end (unbound) (E) (unbound)
960              Move  to  the  end of the current word, or, if at the end of the
961              current word, to the end of the  next  word,  where  a  word  is
962              defined as a series of non-blank characters.
963
964       forward-char (^F ESC-[C) (unbound) (unbound)
965              Move forward one character.
966
967       vi-forward-char (unbound) (space l) (ESC-[C)
968              Move forward one character.
969
970       vi-find-next-char (^X^F) (f) (unbound)
971              Read  a character from the keyboard, and move to the next occur‐
972              rence of it in the line.
973
974       vi-find-next-char-skip (unbound) (t) (unbound)
975              Read a character from the keyboard, and  move  to  the  position
976              just before the next occurrence of it in the line.
977
978       vi-find-prev-char (unbound) (F) (unbound)
979              Read  a  character  from  the keyboard, and move to the previous
980              occurrence of it in the line.
981
982       vi-find-prev-char-skip (unbound) (T) (unbound)
983              Read a character from the keyboard, and  move  to  the  position
984              just after the previous occurrence of it in the line.
985
986       vi-first-non-blank (unbound) (^) (unbound)
987              Move to the first non-blank character in the line.
988
989       vi-forward-word (unbound) (w) (unbound)
990              Move forward one word, vi-style.
991
992       forward-word (ESC-F ESC-f) (unbound) (unbound)
993              Move  to the beginning of the next word.  The editor's idea of a
994              word is specified with the WORDCHARS parameter.
995
996       emacs-forward-word
997              Move to the end of the next word.
998
999       vi-forward-word-end (unbound) (e) (unbound)
1000              Move to the end of the next word.
1001
1002       vi-goto-column (ESC-|) (|) (unbound)
1003              Move to the column specified by the numeric argument.
1004
1005       vi-goto-mark (unbound) (`) (unbound)
1006              Move to the specified mark.
1007
1008       vi-goto-mark-line (unbound) (') (unbound)
1009              Move to beginning of the line containing the specified mark.
1010
1011       vi-repeat-find (unbound) (;) (unbound)
1012              Repeat the last vi-find command.
1013
1014       vi-rev-repeat-find (unbound) (,) (unbound)
1015              Repeat the last vi-find command in the opposite direction.
1016
1017   History Control
1018       beginning-of-buffer-or-history (ESC-<) (unbound) (unbound)
1019              Move to the beginning of the buffer, or if already  there,  move
1020              to the first event in the history list.
1021
1022       beginning-of-line-hist
1023              Move  to the beginning of the line.  If already at the beginning
1024              of the buffer, move to the previous history line.
1025
1026       beginning-of-history
1027              Move to the first event in the history list.
1028
1029       down-line-or-history (^N ESC-[B) (j) (ESC-[B)
1030              Move down a line in the buffer, or  if  already  at  the  bottom
1031              line, move to the next event in the history list.
1032
1033       vi-down-line-or-history (unbound) (+) (unbound)
1034              Move  down  a  line  in  the buffer, or if already at the bottom
1035              line, move to the next event in the history list.  Then move  to
1036              the first non-blank character on the line.
1037
1038       down-line-or-search
1039              Move  down  a  line  in  the buffer, or if already at the bottom
1040              line, search forward in the history for a  line  beginning  with
1041              the first word in the buffer.
1042
1043              If called from a function by the zle command with arguments, the
1044              first argument is taken as  the  string  for  which  to  search,
1045              rather than the first word in the buffer.
1046
1047       down-history (unbound) (^N) (unbound)
1048              Move to the next event in the history list.
1049
1050       history-beginning-search-backward
1051              Search  backward  in  the  history for a line beginning with the
1052              current line up to the cursor.  This leaves the  cursor  in  its
1053              original position.
1054
1055       end-of-buffer-or-history (ESC->) (unbound) (unbound)
1056              Move  to the end of the buffer, or if already there, move to the
1057              last event in the history list.
1058
1059       end-of-line-hist
1060              Move to the end of the line.  If already at the end of the  buf‐
1061              fer, move to the next history line.
1062
1063       end-of-history
1064              Move to the last event in the history list.
1065
1066       vi-fetch-history (unbound) (G) (unbound)
1067              Fetch  the history line specified by the numeric argument.  This
1068              defaults to the current history line (i.e. the  one  that  isn't
1069              history yet).
1070
1071       history-incremental-search-backward (^R ^Xr) (unbound) (unbound)
1072              Search  backward  incrementally  for  a  specified  string.  The
1073              search is case-insensitive if the search string  does  not  have
1074              uppercase letters and no numeric argument was given.  The string
1075              may begin with `^' to anchor the search to the beginning of  the
1076              line.  When called from a user-defined function returns the fol‐
1077              lowing statuses: 0, if the search succeeded; 1,  if  the  search
1078              failed;  2,  if  the  search  term  was a bad pattern; 3, if the
1079              search was aborted by the send-break command.
1080
1081              A restricted set  of  editing  functions  is  available  in  the
1082              mini-buffer.   Keys are looked up in the special isearch keymap,
1083              and if not found there in the main keymap (note that by  default
1084              the  isearch  keymap is empty).  An interrupt signal, as defined
1085              by the stty setting, will stop the search and  go  back  to  the
1086              original  line.   An  undefined  key  will have the same effect.
1087              Note that the following always  perform  the  same  task  within
1088              incremental searches and cannot be replaced by user defined wid‐
1089              gets, nor can the set of functions be extended.   The  supported
1090              functions are:
1091
1092              accept-and-hold
1093              accept-and-infer-next-history
1094              accept-line
1095              accept-line-and-down-history
1096                     Perform  the  usual  function  after  exiting incremental
1097                     search.  The command line displayed is executed.
1098
1099              backward-delete-char
1100              vi-backward-delete-char
1101                     Back up one place in the search history.  If  the  search
1102                     has been repeated this does not immediately erase a char‐
1103                     acter in the minibuffer.
1104
1105              accept-search
1106                     Exit incremental search, retaining the command  line  but
1107                     performing no further action.  Note that this function is
1108                     not bound by default and has no effect outside  incremen‐
1109                     tal search.
1110
1111              backward-delete-word
1112              backward-kill-word
1113              vi-backward-kill-word
1114                     Back  up  one  character  in  the minibuffer; if multiple
1115                     searches have been  performed  since  the  character  was
1116                     inserted  the search history is rewound to the point just
1117                     before the character was entered.   Hence  this  has  the
1118                     effect of repeating backward-delete-char.
1119
1120              clear-screen
1121                     Clear the screen, remaining in incremental search mode.
1122
1123              history-incremental-search-backward
1124                     Find the next occurrence of the contents of the mini-buf‐
1125                     fer.
1126
1127              history-incremental-search-forward
1128                     Invert the sense of the search.
1129
1130              magic-space
1131                     Inserts a non-magical space.
1132
1133              quoted-insert
1134              vi-quoted-insert
1135                     Quote the character to insert into the minibuffer.
1136
1137              redisplay
1138                     Redisplay the  command  line,  remaining  in  incremental
1139                     search mode.
1140
1141              vi-cmd-mode
1142                     Toggle between the `main' and `vicmd' keymaps; the `main'
1143                     keymap (insert mode) will be selected initially.
1144
1145              vi-repeat-search
1146              vi-rev-repeat-search
1147                     Repeat the search.  The direction of the search is  indi‐
1148                     cated in the mini-buffer.
1149
1150              Any  character  that is not bound to one of the above functions,
1151              or self-insert or self-insert-unmeta, will cause the mode to  be
1152              exited.   The  character  is  then looked up and executed in the
1153              keymap in effect at that point.
1154
1155              When called from a widget  function  by  the  zle  command,  the
1156              incremental  search  commands  can take a string argument.  This
1157              will be treated as a string of keys, as  for  arguments  to  the
1158              bindkey command, and used as initial input for the command.  Any
1159              characters in the string which are  unused  by  the  incremental
1160              search will be silently ignored.  For example,
1161
1162                     zle history-incremental-search-backward forceps
1163
1164              will  search  backwards for forceps, leaving the minibuffer con‐
1165              taining the string `forceps'.
1166
1167       history-incremental-search-forward (^S ^Xs) (unbound) (unbound)
1168              Search forward incrementally for a specified string.  The search
1169              is case-insensitive if the search string does not have uppercase
1170              letters and no numeric argument was given.  The string may begin
1171              with `^' to anchor the search to the beginning of the line.  The
1172              functions available in the mini-buffer are the same as for  his‐
1173              tory-incremental-search-backward.
1174
1175       history-incremental-pattern-search-backward
1176       history-incremental-pattern-search-forward
1177              These widgets behave similarly to the corresponding widgets with
1178              no -pattern, but the search string typed by the user is  treated
1179              as  a  pattern,  respecting  the current settings of the various
1180              options affecting pattern matching.  See FILENAME GENERATION  in
1181              zshexpn(1)  for  a description of patterns.  If no numeric argu‐
1182              ment was given lowercase letters in the search string may  match
1183              uppercase letters in the history.  The string may begin with `^'
1184              to anchor the search to the beginning of the line.
1185
1186              The prompt changes to indicate an invalid pattern; this may sim‐
1187              ply indicate the pattern is not yet complete.
1188
1189              Note  that  only  non-overlapping  matches  are  reported, so an
1190              expression with wildcards may return fewer  matches  on  a  line
1191              than are visible by inspection.
1192
1193       history-search-backward (ESC-P ESC-p) (unbound) (unbound)
1194              Search  backward  in  the  history for a line beginning with the
1195              first word in the buffer.
1196
1197              If called from a function by the zle command with arguments, the
1198              first  argument  is  taken  as  the  string for which to search,
1199              rather than the first word in the buffer.
1200
1201       vi-history-search-backward (unbound) (/) (unbound)
1202              Search backward in the history  for  a  specified  string.   The
1203              string  may begin with `^' to anchor the search to the beginning
1204              of the line.
1205
1206              A restricted set  of  editing  functions  is  available  in  the
1207              mini-buffer.   An  interrupt signal, as defined by the stty set‐
1208              ting,  will stop the search.  The  functions  available  in  the
1209              mini-buffer  are:  accept-line,  backward-delete-char,  vi-back‐
1210              ward-delete-char,   backward-kill-word,   vi-backward-kill-word,
1211              clear-screen, redisplay, quoted-insert and vi-quoted-insert.
1212
1213              vi-cmd-mode  is treated the same as accept-line, and magic-space
1214              is treated as a space.  Any other character that is not bound to
1215              self-insert  or  self-insert-unmeta will beep and be ignored. If
1216              the function is called from vi command mode, the bindings of the
1217              current insert mode will be used.
1218
1219              If called from a function by the zle command with arguments, the
1220              first argument is taken as  the  string  for  which  to  search,
1221              rather than the first word in the buffer.
1222
1223       history-search-forward (ESC-N ESC-n) (unbound) (unbound)
1224              Search  forward  in  the  history  for a line beginning with the
1225              first word in the buffer.
1226
1227              If called from a function by the zle command with arguments, the
1228              first  argument  is  taken  as  the  string for which to search,
1229              rather than the first word in the buffer.
1230
1231       vi-history-search-forward (unbound) (?) (unbound)
1232              Search forward in the  history  for  a  specified  string.   The
1233              string  may begin with `^' to anchor the search to the beginning
1234              of the line. The functions available in the mini-buffer are  the
1235              same  as  for  vi-history-search-backward.  Argument handling is
1236              also the same as for that command.
1237
1238       infer-next-history (^X^N) (unbound) (unbound)
1239              Search in the history list for a line matching the  current  one
1240              and fetch the event following it.
1241
1242       insert-last-word (ESC-_ ESC-.) (unbound) (unbound)
1243              Insert the last word from the previous history event at the cur‐
1244              sor position.  If a positive numeric argument is  given,  insert
1245              that  word  from  the end of the previous history event.  If the
1246              argument is zero or negative insert  that  word  from  the  left
1247              (zero  inserts  the previous command word).  Repeating this com‐
1248              mand replaces the word just inserted with the last word from the
1249              history  event prior to the one just used; numeric arguments can
1250              be used in the same way to pick a word from that event.
1251
1252              When called from a shell function invoked  from  a  user-defined
1253              widget,  the command can take one to three arguments.  The first
1254              argument specifies a history offset which applies to  successive
1255              calls  to  this  widget:  if  it is -1, the default behaviour is
1256              used, while if it is 1,  successive  calls  will  move  forwards
1257              through  the  history.  The value 0 can be used to indicate that
1258              the history line examined by the previous execution of the  com‐
1259              mand  will  be reexamined.  Note that negative numbers should be
1260              preceded by  a  `--'  argument  to  avoid  confusing  them  with
1261              options.
1262
1263              If two arguments are given, the second specifies the word on the
1264              command line in normal array index notation (as a  more  natural
1265              alternative to the prefix argument).  Hence 1 is the first word,
1266              and -1 (the default) is the last word.
1267
1268              If a third argument is given, its value is ignored,  but  it  is
1269              used  to signify that the history offset is relative to the cur‐
1270              rent history line, rather than the one remembered after the pre‐
1271              vious invocations of insert-last-word.
1272
1273              For example, the default behaviour of the command corresponds to
1274
1275                     zle insert-last-word -- -1 -1
1276
1277              while the command
1278
1279                     zle insert-last-word -- -1 1 -
1280
1281              always  copies the first word of the line in the history immedi‐
1282              ately before the line being edited.  This has  the  side  effect
1283              that  later  invocations  of the widget will be relative to that
1284              line.
1285
1286       vi-repeat-search (unbound) (n) (unbound)
1287              Repeat the last vi history search.
1288
1289       vi-rev-repeat-search (unbound) (N) (unbound)
1290              Repeat the last vi history search, but in reverse.
1291
1292       up-line-or-history (^P ESC-[A) (k) (ESC-[A)
1293              Move up a line in the buffer, or if already  at  the  top  line,
1294              move to the previous event in the history list.
1295
1296       vi-up-line-or-history (unbound) (-) (unbound)
1297              Move  up  a  line  in the buffer, or if already at the top line,
1298              move to the previous event in the history list.   Then  move  to
1299              the first non-blank character on the line.
1300
1301       up-line-or-search
1302              Move  up  a  line  in the buffer, or if already at the top line,
1303              search backward in the history for a  line  beginning  with  the
1304              first word in the buffer.
1305
1306              If called from a function by the zle command with arguments, the
1307              first argument is taken as  the  string  for  which  to  search,
1308              rather than the first word in the buffer.
1309
1310       up-history (unbound) (^P) (unbound)
1311              Move to the previous event in the history list.
1312
1313       history-beginning-search-forward
1314              Search forward in the history for a line beginning with the cur‐
1315              rent line up to the cursor.  This leaves the cursor in its orig‐
1316              inal position.
1317
1318       set-local-history
1319              By  default,  history movement commands visit the imported lines
1320              as well as the local lines. This widget lets you toggle this  on
1321              and  off,  or  set  it  with the numeric argument. Zero for both
1322              local and imported lines and nonzero for only local lines.
1323
1324   Modifying Text
1325       vi-add-eol (unbound) (A) (unbound)
1326              Move to the end of the line and enter insert mode.
1327
1328       vi-add-next (unbound) (a) (unbound)
1329              Enter insert mode after the  current  cursor  position,  without
1330              changing lines.
1331
1332       backward-delete-char (^H ^?) (unbound) (unbound)
1333              Delete the character behind the cursor.
1334
1335       vi-backward-delete-char (unbound) (X) (^H)
1336              Delete  the character behind the cursor, without changing lines.
1337              If in insert mode, this won't delete past the point where insert
1338              mode was last entered.
1339
1340       backward-delete-word
1341              Delete the word behind the cursor.
1342
1343       backward-kill-line
1344              Kill from the beginning of the line to the cursor position.
1345
1346       backward-kill-word (^W ESC-^H ESC-^?) (unbound) (unbound)
1347              Kill the word behind the cursor.
1348
1349       vi-backward-kill-word (unbound) (unbound) (^W)
1350              Kill  the  word  behind the cursor, without going past the point
1351              where insert mode was last entered.
1352
1353       capitalize-word (ESC-C ESC-c) (unbound) (unbound)
1354              Capitalize the current word and move past it.
1355
1356       vi-change (unbound) (c) (unbound)
1357              Read a movement command from the keyboard,  and  kill  from  the
1358              cursor  position  to  the  endpoint of the movement.  Then enter
1359              insert mode.  If the command is vi-change,  change  the  current
1360              line.
1361
1362       vi-change-eol (unbound) (C) (unbound)
1363              Kill to the end of the line and enter insert mode.
1364
1365       vi-change-whole-line (unbound) (S) (unbound)
1366              Kill the current line and enter insert mode.
1367
1368       copy-region-as-kill (ESC-W ESC-w) (unbound) (unbound)
1369              Copy the area from the cursor to the mark to the kill buffer.
1370
1371              If   called  from  a  ZLE  widget  function  in  the  form  `zle
1372              copy-region-as-kill string' then string will  be  taken  as  the
1373              text  to  copy to the kill buffer.  The cursor, the mark and the
1374              text on the command line are not used in this case.
1375
1376       copy-prev-word (ESC-^_) (unbound) (unbound)
1377              Duplicate the word to the left of the cursor.
1378
1379       copy-prev-shell-word
1380              Like copy-prev-word, but the word is found by using shell  pars‐
1381              ing,  whereas copy-prev-word looks for blanks. This makes a dif‐
1382              ference when the word is quoted and contains spaces.
1383
1384       vi-delete (unbound) (d) (unbound)
1385              Read a movement command from the keyboard,  and  kill  from  the
1386              cursor position to the endpoint of the movement.  If the command
1387              is vi-delete, kill the current line.
1388
1389       delete-char
1390              Delete the character under the cursor.
1391
1392       vi-delete-char (unbound) (x) (unbound)
1393              Delete the character under the cursor, without  going  past  the
1394              end of the line.
1395
1396       delete-word
1397              Delete the current word.
1398
1399       down-case-word (ESC-L ESC-l) (unbound) (unbound)
1400              Convert the current word to all lowercase and move past it.
1401
1402       kill-word (ESC-D ESC-d) (unbound) (unbound)
1403              Kill the current word.
1404
1405       gosmacs-transpose-chars
1406              Exchange the two characters behind the cursor.
1407
1408       vi-indent (unbound) (>) (unbound)
1409              Indent a number of lines.
1410
1411       vi-insert (unbound) (i) (unbound)
1412              Enter insert mode.
1413
1414       vi-insert-bol (unbound) (I) (unbound)
1415              Move  to  the  first  non-blank  character on the line and enter
1416              insert mode.
1417
1418       vi-join (^X^J) (J) (unbound)
1419              Join the current line with the next one.
1420
1421       kill-line (^K) (unbound) (unbound)
1422              Kill from the cursor to the end of the line.  If already on  the
1423              end of the line, kill the newline character.
1424
1425       vi-kill-line (unbound) (unbound) (^U)
1426              Kill  from  the  cursor  back  to  wherever insert mode was last
1427              entered.
1428
1429       vi-kill-eol (unbound) (D) (unbound)
1430              Kill from the cursor to the end of the line.
1431
1432       kill-region
1433              Kill from the cursor to the mark.
1434
1435       kill-buffer (^X^K) (unbound) (unbound)
1436              Kill the entire buffer.
1437
1438       kill-whole-line (^U) (unbound) (unbound)
1439              Kill the current line.
1440
1441       vi-match-bracket (^X^B) (%) (unbound)
1442              Move to the bracket character (one of {}, () or []) that matches
1443              the  one  under  the  cursor.  If the cursor is not on a bracket
1444              character, move forward without going past the end of  the  line
1445              to find one, and then go to the matching bracket.
1446
1447       vi-open-line-above (unbound) (O) (unbound)
1448              Open a line above the cursor and enter insert mode.
1449
1450       vi-open-line-below (unbound) (o) (unbound)
1451              Open a line below the cursor and enter insert mode.
1452
1453       vi-oper-swap-case
1454              Read  a movement command from the keyboard, and swap the case of
1455              all characters from the cursor position to the endpoint  of  the
1456              movement.   If  the  movement command is vi-oper-swap-case, swap
1457              the case of all characters on the current line.
1458
1459       overwrite-mode (^X^O) (unbound) (unbound)
1460              Toggle between overwrite mode and insert mode.
1461
1462       vi-put-before (unbound) (P) (unbound)
1463              Insert the contents of the kill buffer before  the  cursor.   If
1464              the  kill  buffer  contains  a  sequence of lines (as opposed to
1465              characters), paste it above the current line.
1466
1467       vi-put-after (unbound) (p) (unbound)
1468              Insert the contents of the kill buffer after the cursor.  If the
1469              kill  buffer contains a sequence of lines (as opposed to charac‐
1470              ters), paste it below the current line.
1471
1472       quoted-insert (^V) (unbound) (unbound)
1473              Insert the next character typed into the buffer  literally.   An
1474              interrupt character will not be inserted.
1475
1476       vi-quoted-insert (unbound) (unbound) (^Q ^V)
1477              Display  a `^' at the cursor position, and insert the next char‐
1478              acter typed into the buffer literally.  An  interrupt  character
1479              will not be inserted.
1480
1481       quote-line (ESC-') (unbound) (unbound)
1482              Quote  the  current  line;  that  is, put a `'' character at the
1483              beginning and the end, and convert all `'' characters to `'\'''.
1484
1485       quote-region (ESC-") (unbound) (unbound)
1486              Quote the region from the cursor to the mark.
1487
1488       vi-replace (unbound) (R) (unbound)
1489              Enter overwrite mode.
1490
1491       vi-repeat-change (unbound) (.) (unbound)
1492              Repeat the last vi mode text modification.  If a count was  used
1493              with the modification, it is remembered.  If a count is given to
1494              this command, it overrides the remembered count, and  is  remem‐
1495              bered  for future uses of this command.  The cut buffer specifi‐
1496              cation is similarly remembered.
1497
1498       vi-replace-chars (unbound) (r) (unbound)
1499              Replace the character under the cursor  with  a  character  read
1500              from the keyboard.
1501
1502       self-insert  (printable characters) (unbound) (printable characters and
1503       some control characters)
1504              Insert a character into the buffer at the cursor position.
1505
1506       self-insert-unmeta (ESC-^I ESC-^J ESC-^M) (unbound) (unbound)
1507              Insert a character into the buffer after stripping the meta  bit
1508              and converting ^M to ^J.
1509
1510       vi-substitute (unbound) (s) (unbound)
1511              Substitute the next character(s).
1512
1513       vi-swap-case (unbound) (~) (unbound)
1514              Swap  the  case  of the character under the cursor and move past
1515              it.
1516
1517       transpose-chars (^T) (unbound) (unbound)
1518              Exchange the two characters to the left of the cursor if at  end
1519              of  line,  else exchange the character under the cursor with the
1520              character to the left.
1521
1522       transpose-words (ESC-T ESC-t) (unbound) (unbound)
1523              Exchange the current word with the one before it.
1524
1525       vi-unindent (unbound) (<) (unbound)
1526              Unindent a number of lines.
1527
1528       up-case-word (ESC-U ESC-u) (unbound) (unbound)
1529              Convert the current word to all caps and move past it.
1530
1531       yank (^Y) (unbound) (unbound)
1532              Insert the contents of the kill buffer at the cursor position.
1533
1534       yank-pop (ESC-y) (unbound) (unbound)
1535              Remove the text just yanked, rotate the kill-ring  (the  history
1536              of  previously  killed  text)  and yank the new top.  Only works
1537              following yank or yank-pop.
1538
1539       vi-yank (unbound) (y) (unbound)
1540              Read a movement command from the keyboard, and copy  the  region
1541              from  the  cursor  position to the endpoint of the movement into
1542              the kill buffer.  If the command is vi-yank,  copy  the  current
1543              line.
1544
1545       vi-yank-whole-line (unbound) (Y) (unbound)
1546              Copy the current line into the kill buffer.
1547
1548       vi-yank-eol
1549              Copy  the region from the cursor position to the end of the line
1550              into the kill buffer.  Arguably, this is what Y should do in vi,
1551              but it isn't what it actually does.
1552
1553   Arguments
1554       digit-argument (ESC-0..ESC-9) (1-9) (unbound)
1555              Start  a  new  numeric argument, or add to the current one.  See
1556              also vi-digit-or-beginning-of-line.  This only works if bound to
1557              a key sequence ending in a decimal digit.
1558
1559              Inside  a  widget  function,  a call to this function treats the
1560              last key of the key sequence which  called  the  widget  as  the
1561              digit.
1562
1563       neg-argument (ESC--) (unbound) (unbound)
1564              Changes the sign of the following argument.
1565
1566       universal-argument
1567              Multiply  the argument of the next command by 4.  Alternatively,
1568              if this command is followed by an  integer  (positive  or  nega‐
1569              tive), use that as the argument for the next command.  Thus dig‐
1570              its cannot be repeated using this command.  For example, if this
1571              command occurs twice, followed immediately by forward-char, move
1572              forward sixteen spaces; if instead it is followed  by  -2,  then
1573              forward-char, move backward two spaces.
1574
1575              Inside  a widget function, if passed an argument, i.e. `zle uni‐
1576              versal-argument num', the numerical argument will be set to num;
1577              this is equivalent to `NUMERIC=num'.
1578
1579       argument-base
1580              Use  the existing numeric argument as a numeric base, which must
1581              be  in  the  range  2  to  36  inclusive.   Subsequent  use   of
1582              digit-argument and universal-argument will input a new prefix in
1583              the given base.  The usual hexadecimal convention is  used:  the
1584              letter  a or A corresponds to 10, and so on.  Arguments in bases
1585              requiring digits from 10 upwards  are  more  conveniently  input
1586              with  universal-argument, since ESC-a etc. are not usually bound
1587              to digit-argument.
1588
1589              The function can be  used  with  a  command  argument  inside  a
1590              user-defined widget.  The following code sets the base to 16 and
1591              lets the user input a hexadecimal argument until a  key  out  of
1592              the digit range is typed:
1593
1594                     zle argument-base 16
1595                     zle universal-argument
1596
1597   Completion
1598       accept-and-menu-complete
1599              In  a  menu  completion,  insert the current completion into the
1600              buffer, and advance to the next possible completion.
1601
1602       complete-word
1603              Attempt completion on the current word.
1604
1605       delete-char-or-list (^D) (unbound) (unbound)
1606              Delete the character under the cursor.  If the cursor is at  the
1607              end of the line, list possible completions for the current word.
1608
1609       expand-cmd-path
1610              Expand the current command to its full pathname.
1611
1612       expand-or-complete (TAB) (unbound) (TAB)
1613              Attempt  shell  expansion  on  the current word.  If that fails,
1614              attempt completion.
1615
1616       expand-or-complete-prefix
1617              Attempt shell expansion on the current word up to cursor.
1618
1619       expand-history (ESC-space ESC-!) (unbound) (unbound)
1620              Perform history expansion on the edit buffer.
1621
1622       expand-word (^X*) (unbound) (unbound)
1623              Attempt shell expansion on the current word.
1624
1625       list-choices (ESC-^D) (^D =) (^D)
1626              List possible completions for the current word.
1627
1628       list-expand (^Xg ^XG) (^G) (^G)
1629              List the expansion of the current word.
1630
1631       magic-space
1632              Perform history expansion and insert a space  into  the  buffer.
1633              This is intended to be bound to space.
1634
1635       menu-complete
1636              Like  complete-word,  except  that menu completion is used.  See
1637              the MENU_COMPLETE option.
1638
1639       menu-expand-or-complete
1640              Like expand-or-complete, except that menu completion is used.
1641
1642       reverse-menu-complete
1643              Perform menu completion, like menu-complete, except  that  if  a
1644              menu  completion  is  already  in progress, move to the previous
1645              completion rather than the next.
1646
1647       end-of-list
1648              When a previous completion displayed a list  below  the  prompt,
1649              this widget can be used to move the prompt below the list.
1650
1651   Miscellaneous
1652       accept-and-hold (ESC-A ESC-a) (unbound) (unbound)
1653              Push  the contents of the buffer on the buffer stack and execute
1654              it.
1655
1656       accept-and-infer-next-history
1657              Execute the contents of the buffer.   Then  search  the  history
1658              list for a line matching the current one and push the event fol‐
1659              lowing onto the buffer stack.
1660
1661       accept-line (^J ^M) (^J ^M) (^J ^M)
1662              Finish editing the buffer.  Normally this causes the  buffer  to
1663              be executed as a shell command.
1664
1665       accept-line-and-down-history (^O) (unbound) (unbound)
1666              Execute the current line, and push the next history event on the
1667              buffer stack.
1668
1669       auto-suffix-remove
1670              If the previous action added a suffix (space,  slash,  etc.)  to
1671              the  word on the command line, remove it.  Otherwise do nothing.
1672              Removing the suffix ends any  active  menu  completion  or  menu
1673              selection.
1674
1675              This  widget  is intended to be called from user-defined widgets
1676              to enforce a desired suffix-removal behavior.
1677
1678       auto-suffix-retain
1679              If the previous action added a suffix (space,  slash,  etc.)  to
1680              the  word on the command line, force it to be preserved.  Other‐
1681              wise do nothing.  Retaining the suffix ends any active menu com‐
1682              pletion or menu selection.
1683
1684              This  widget  is intended to be called from user-defined widgets
1685              to enforce a desired suffix-preservation behavior.
1686
1687       beep   Beep, unless the BEEP option is unset.
1688
1689       vi-cmd-mode (^X^V) (unbound) (^[)
1690              Enter command mode; that is, select the  `vicmd'  keymap.   Yes,
1691              this is bound by default in emacs mode.
1692
1693       vi-caps-lock-panic
1694              Hang  until  any lowercase key is pressed.  This is for vi users
1695              without the mental capacity to keep track of their caps lock key
1696              (like the author).
1697
1698       clear-screen (^L ESC-^L) (^L) (^L)
1699              Clear the screen and redraw the prompt.
1700
1701       describe-key-briefly
1702              Reads  a  key  sequence,  then prints the function bound to that
1703              sequence.
1704
1705       exchange-point-and-mark (^X^X) (unbound) (unbound)
1706              Exchange the cursor position (point) with the  position  of  the
1707              mark.   Unless  a  negative prefix argument is given, the region
1708              between point and mark is activated so  that  it  can  be  high‐
1709              lighted.   If  a  zero  prefix  argument is given, the region is
1710              activated but point and mark are not swapped.
1711
1712       execute-named-cmd (ESC-x) (:) (unbound)
1713              Read the name of an editor command and execute it.  A restricted
1714              set  of editing functions is available in the mini-buffer.  Keys
1715              are looked up in the special command keymap, and  if  not  found
1716              there  in  the  main keymap.  An interrupt signal, as defined by
1717              the stty setting, will abort the function.  Note that  the  fol‐
1718              lowing   always   perform   the   same   task  within  the  exe‐
1719              cuted-named-cmd environment  and  cannot  be  replaced  by  user
1720              defined  widgets, nor can the set of functions be extended.  The
1721              allowed   functions    are:    backward-delete-char,    vi-back‐
1722              ward-delete-char,    clear-screen,   redisplay,   quoted-insert,
1723              vi-quoted-insert,   backward-kill-word,   vi-backward-kill-word,
1724              kill-whole-line, vi-kill-line, backward-kill-line, list-choices,
1725              delete-char-or-list, complete-word, accept-line,  expand-or-com‐
1726              plete and expand-or-complete-prefix.
1727
1728              kill-region  kills the last word, and vi-cmd-mode is treated the
1729              same as accept-line.  The space and tab characters, if not bound
1730              to  one of these functions, will complete the name and then list
1731              the possibilities if the AUTO_LIST option  is  set.   Any  other
1732              character that is not bound to self-insert or self-insert-unmeta
1733              will beep and be ignored.  The bindings of  the  current  insert
1734              mode will be used.
1735
1736              Currently this command may not be redefined or called by name.
1737
1738       execute-last-named-cmd (ESC-z) (unbound) (unbound)
1739              Redo the last function executed with execute-named-cmd.
1740
1741              Currently this command may not be redefined or called by name.
1742
1743       get-line (ESC-G ESC-g) (unbound) (unbound)
1744              Pop  the top line off the buffer stack and insert it at the cur‐
1745              sor position.
1746
1747       pound-insert (unbound) (#) (unbound)
1748              If there is no # character at the beginning of the  buffer,  add
1749              one  to the beginning of each line.  If there is one, remove a #
1750              from each line that has one.  In either case, accept the current
1751              line.   The  INTERACTIVE_COMMENTS option must be set for this to
1752              have any usefulness.
1753
1754       vi-pound-insert
1755              If there is no # character at the beginning of the current line,
1756              add  one.  If there is one, remove it.  The INTERACTIVE_COMMENTS
1757              option must be set for this to have any usefulness.
1758
1759       push-input
1760              Push the entire current  multiline  construct  onto  the  buffer
1761              stack  and return to the top-level (PS1) prompt.  If the current
1762              parser construct is only a single line,  this  is  exactly  like
1763              push-line.   Next  time  the  editor starts up or is popped with
1764              get-line, the construct will be popped off the top of the buffer
1765              stack and loaded into the editing buffer.
1766
1767       push-line (^Q ESC-Q ESC-q) (unbound) (unbound)
1768              Push the current buffer onto the buffer stack and clear the buf‐
1769              fer.  Next time the editor starts up, the buffer will be  popped
1770              off the top of the buffer stack and loaded into the editing buf‐
1771              fer.
1772
1773       push-line-or-edit
1774              At the top-level (PS1) prompt, equivalent to  push-line.   At  a
1775              secondary  (PS2)  prompt, move the entire current multiline con‐
1776              struct into the editor buffer.   The  latter  is  equivalent  to
1777              push-input followed by get-line.
1778
1779       read-command
1780              Only  useful  from  a  user-defined widget.  A keystroke is read
1781              just as in normal operation, but instead of  the  command  being
1782              executed  the  name  of  the  command  that would be executed is
1783              stored in the shell parameter REPLY.  This can be  used  as  the
1784              argument  of  a  future zle command.  If the key sequence is not
1785              bound, status 1 is returned; typically, however, REPLY is set to
1786              undefined-key to indicate a useless key sequence.
1787
1788       recursive-edit
1789              Only  useful  from  a user-defined widget.  At this point in the
1790              function, the editor regains control until one of  the  standard
1791              widgets  which  would  normally  cause zle to exit (typically an
1792              accept-line caused by  hitting  the  return  key)  is  executed.
1793              Instead, control returns to the user-defined widget.  The status
1794              returned is non-zero if the return was caused by an  error,  but
1795              the  function  still  continues executing and hence may tidy up.
1796              This makes it safe for the user-defined widget to alter the com‐
1797              mand line or key bindings temporarily.
1798
1799              The following widget, caps-lock, serves as an example.
1800                     self-insert-ucase() {
1801                       LBUFFER+=${(U)KEYS[-1]}
1802                     }
1803
1804                     integer stat
1805
1806                     zle -N self-insert self-insert-ucase
1807                     zle -A caps-lock save-caps-lock
1808                     zle -A accept-line caps-lock
1809
1810                     zle recursive-edit
1811                     stat=$?
1812
1813                     zle -A .self-insert self-insert
1814                     zle -A save-caps-lock caps-lock
1815                     zle -D save-caps-lock
1816
1817                     (( stat )) && zle send-break
1818
1819                     return $stat
1820              This  causes  typed  letters  to  be  inserted capitalised until
1821              either accept-line (i.e. typically the return key) is  typed  or
1822              the  caps-lock  widget is invoked again; the later is handled by
1823              saving the old definition of  caps-lock  as  save-caps-lock  and
1824              then  rebinding  it  to  invoke accept-line.  Note that an error
1825              from the recursive edit is detected as a non-zero return  status
1826              and propagated by using the send-break widget.
1827
1828       redisplay (unbound) (^R) (^R)
1829              Redisplays the edit buffer.
1830
1831       reset-prompt (unbound) (unbound) (unbound)
1832              Force the prompts on both the left and right of the screen to be
1833              re-expanded, then redisplay  the  edit  buffer.   This  reflects
1834              changes  both  to the prompt variables themselves and changes in
1835              the expansion of the values (for example,  changes  in  time  or
1836              directory,  or  changes to the value of variables referred to by
1837              the prompt).
1838
1839              Otherwise, the prompt is only expanded each time zle starts, and
1840              when the display as been interrupted by output from another part
1841              of the shell (such as a job notification) which causes the  com‐
1842              mand line to be reprinted.
1843
1844       send-break (^G ESC-^G) (unbound) (unbound)
1845              Abort  the  current editor function, e.g. execute-named-command,
1846              or the editor itself, e.g. if you are in vared. Otherwise  abort
1847              the  parsing  of the current line; in this case the aborted line
1848              is available in the shell variable ZLE_LINE_ABORTED.
1849
1850       run-help (ESC-H ESC-h) (unbound) (unbound)
1851              Push the buffer onto the buffer stack, and execute  the  command
1852              `run-help  cmd',  where cmd is the current command.  run-help is
1853              normally aliased to man.
1854
1855       vi-set-buffer (unbound) (") (unbound)
1856              Specify a buffer to be used in the following command.  There are
1857              35  buffers  that can be specified: the 26 `named' buffers "a to
1858              "z and the nine `queued' buffers "1 to "9.   The  named  buffers
1859              can also be specified as "A to "Z.
1860
1861              When a buffer is specified for a cut command, the text being cut
1862              replaces the previous contents of the specified  buffer.   If  a
1863              named buffer is specified using a capital, the newly cut text is
1864              appended to the buffer instead of overwriting it.
1865
1866              If no buffer is specified for a cut command, "1 is used, and the
1867              contents of "1 to "8 are each shifted along one buffer; the con‐
1868              tents of "9 is lost.
1869
1870       vi-set-mark (unbound) (m) (unbound)
1871              Set the specified mark at the cursor position.
1872
1873       set-mark-command (^@) (unbound) (unbound)
1874              Set the mark at the cursor position.  If called with a  negative
1875              prefix  argument,  do not set the mark but deactivate the region
1876              so that it is no longer highlighted  (it  is  still  usable  for
1877              other purposes).  Otherwise the region is marked as active.
1878
1879       spell-word (ESC-$ ESC-S ESC-s) (unbound) (unbound)
1880              Attempt spelling correction on the current word.
1881
1882       undefined-key
1883              This  command  is executed when a key sequence that is not bound
1884              to any command is typed.  By default it beeps.
1885
1886       undo (^_ ^Xu ^X^U) (unbound) (unbound)
1887              Incrementally undo the last text modification.  When called from
1888              a  user-defined  widget, takes an optional argument indicating a
1889              previous  state  of  the  undo  history  as  returned   by   the
1890              UNDO_CHANGE_NO  variable;  modifications  are  undone until that
1891              state is reached.
1892
1893       redo   Incrementally redo undone text modifications.
1894
1895       vi-undo-change (unbound) (u) (unbound)
1896              Undo the last text modification.  If repeated, redo the  modifi‐
1897              cation.
1898
1899       what-cursor-position (^X=) (unbound) (unbound)
1900              Print the character under the cursor, its code as an octal, dec‐
1901              imal and hexadecimal number, the current cursor position  within
1902              the buffer and the column of the cursor in the current line.
1903
1904       where-is
1905              Read  the name of an editor command and print the listing of key
1906              sequences that invoke the specified command.  A  restricted  set
1907              of  editing functions is available in the mini-buffer.  Keys are
1908              looked up in the special command keymap, and if not found  there
1909              in the main keymap.
1910
1911       which-command (ESC-?) (unbound) (unbound)
1912              Push  the  buffer onto the buffer stack, and execute the command
1913              `which-command  cmd'.  where  cmd  is   the   current   command.
1914              which-command is normally aliased to whence.
1915
1916       vi-digit-or-beginning-of-line (unbound) (0) (unbound)
1917              If the last command executed was a digit as part of an argument,
1918              continue the argument.  Otherwise, execute vi-beginning-of-line.
1919

CHARACTER HIGHLIGHTING

1921       The line editor has the ability to highlight characters or  regions  of
1922       the  line  that  have a particular significance.  This is controlled by
1923       the array parameter zle_highlight, if it has been set by the user.
1924
1925       If the parameter contains the single entry  none  all  highlighting  is
1926       turned off.  Note the parameter is still expected to be an array.
1927
1928       Otherwise each entry of the array should consist of a word indicating a
1929       context for highlighting, then a colon, then a comma-separated list  of
1930       the types of highlighting to apply in that context.
1931
1932       The contexts available for highlighting are the following:
1933
1934       default
1935              Any text within the command line not affected by any other high‐
1936              lighting.  Text outside the editable area of the command line is
1937              not affected.
1938
1939       isearch
1940              When  one  of  the incremental history search widgets is active,
1941              the area of the command line matched by  the  search  string  or
1942              pattern.
1943
1944       region The  region  between the cursor (point) and the mark as set with
1945              set-mark-command.  The region  is  only  highlighted  if  it  is
1946              active,    which    is   the   case   if   set-mark-command   or
1947              exchange-point-and-mark has been called and  the  line  has  not
1948              been  subsequently  modified.   The region can be deactivated by
1949              calling set-mark-command with a  negative  prefix  argument,  or
1950              reactivated  by calling exchange-point-and-mark with a zero pre‐
1951              fix argument.  Note that whether or not the region is active has
1952              no  effect  on  its  use  within  widgets,  it simply determines
1953              whether it is highlighted.
1954
1955       special
1956              Individual characters that have no direct printable  representa‐
1957              tion  but  are  shown  in  a  special manner by the line editor.
1958              These characters are described below.
1959
1960       suffix This context is used  in  completion  for  characters  that  are
1961              marked  as  suffixes that will be removed if the completion ends
1962              at that point, the most obvious example being a slash (/)  after
1963              a directory name.  Note that suffix removal is configurable; the
1964              circumstances under which the suffix will be removed may  differ
1965              for different completions.
1966
1967       zle_highlight  may contain additional fields for controlling how termi‐
1968       nal sequences to change colours are output.  Each of the  following  is
1969       followed  by a colon and a string in the same form as for key bindings.
1970       This will not be necessary for the vast majority of  terminals  as  the
1971       defaults shown in parentheses are widely used.
1972
1973       fg_start_code (\e[3)
1974              The  start  of  the  escape  sequence for the foreground colour.
1975              This is followed by an ASCII digit representing the colour.
1976
1977       fg_default_code (9)
1978              The number to use instead of the colour  to  reset  the  default
1979              foreground colour.
1980
1981       fg_end_code (m)
1982              The end of the escape sequence for the foreground colour.
1983
1984       bg_start_code (\e[4)
1985              The  start  of  the  escape  sequence for the background colour.
1986              This is followed by an ASCII digit representing the colour.
1987
1988       bg_default_code (9)
1989              The number to use instead of the colour  to  reset  the  default
1990              background colour.
1991
1992       bg_end_code (m)
1993              The end of the escape sequence for the background colour.
1994
1995       The  available  types of highlighting are the following.  Note that not
1996       all types of highlighting are available on all terminals:
1997
1998       none   No highlighting is applied to the given context.  It is not use‐
1999              ful  for  this to appear with other types of highlighting; it is
2000              used to override a default.
2001
2002       fg=colour
2003              The foreground colour should be set to colour, a decimal integer
2004              or the name of one of the eight most widely-supported colours.
2005
2006              Not  all  terminals  support this and, of those that do, not all
2007              provide facilities to test the support, hence  the  user  should
2008              decide  based  on the terminal type.  Most terminals support the
2009              colours black, red,  green,  yellow,  blue,  magenta,  cyan  and
2010              white,  which  can  be set by name.  In addition. default may be
2011              used to set the terminal's default foreground colour.  Abbrevia‐
2012              tions  are  allowed;  b or bl selects black.  Some terminals may
2013              generate additional  colours  if  the  bold  attribute  is  also
2014              present.
2015
2016              On  recent  terminals and on systems with an up-to-date terminal
2017              database the number of colours supported may be  tested  by  the
2018              command  `echotc  Co'; if this succeeds, it indicates a limit on
2019              the number of colours which will be enforced by the line editor.
2020              The  number  of  colours is in any case limited to 256 (i.e. the
2021              range 0 to 255).
2022
2023              Colour is also known as color.
2024
2025       bg=colour
2026              The background colour should be set to colour.  This works simi‐
2027              larly  to  the  foreground  colour, except the background is not
2028              usually affected by the bold attribute.
2029
2030       bold   The characters in the given context are shown in  a  bold  font.
2031              Not all terminals distinguish bold fonts.
2032
2033       standout
2034              The  characters in the given context are shown in the terminal's
2035              standout mode.  The actual effect is specific to  the  terminal;
2036              on  many terminals it is inverse video.  On some such terminals,
2037              where the cursor does not blink it appears  with  standout  mode
2038              negated, making it less than clear where the cursor actually is.
2039              On such terminals one of the other effects may be preferable for
2040              highlighting the region and matched search string.
2041
2042       underline
2043              The  characters in the given context are shown underlined.  Some
2044              terminals show the foreground in a different colour instead;  in
2045              this case whitespace will not be highlighted.
2046
2047       The  characters  described above as `special' are as follows.  The for‐
2048       matting described here is used irrespective of whether  the  characters
2049       are highlighted:
2050
2051       ASCII control characters
2052              Control  characters in the ASCII range are shown as `^' followed
2053              by the base character.
2054
2055       Unprintable multibyte characters
2056              This item applies to control characters not in the ASCII  range,
2057              plus other characters as follows.  If the MULTIBYTE option is in
2058              effect, multibyte characters not in the ASCII character set that
2059              are reported as having zero width are treated as combining char‐
2060              acters when the option COMBINING_CHARS is on.  If the option  is
2061              off,  or  if  a character appears where a combining character is
2062              not valid, the character is treated as unprintable.
2063
2064              Unprintable multibyte characters are shown as a hexadecimal num‐
2065              ber between angle brackets.  The number is the code point of the
2066              character in the wide character set; this may or may not be Uni‐
2067              code, depending on the operating system.
2068
2069       Invalid multibyte characters
2070              If  the  MULTIBYTE  option  is in effect, any sequence of one or
2071              more bytes that does not form a valid character in  the  current
2072              character  set  is  treated as a series of bytes each shown as a
2073              special character.  This case can be  distinguished  from  other
2074              unprintable characters as the bytes are represented as two hexa‐
2075              decimal digits between angle brackets, as distinct from the four
2076              or  eight  digits  that are used for unprintable characters that
2077              are nonetheless valid in the current character set.
2078
2079              Not all systems support this: for it to work, the system's  rep‐
2080              resentation of wide characters must be code values from the Uni‐
2081              versal Character Set, as defined by IS0  10646  (also  known  as
2082              Unicode).
2083
2084       Wrapped double-width characters
2085              When  a  double-width character appears in the final column of a
2086              line, it is instead shown on the next line. The empty space left
2087              in the original position is highlighted as a special character.
2088
2089       If  zle_highlight  is  not set or no value applies to a particular con‐
2090       text, the defaults applied are equivalent to
2091
2092              zle_highlight=(region:standout special:standout
2093              suffix:bold isearch:underline)
2094
2095       i.e. both the region and special characters are shown in standout mode.
2096
2097       Within widgets, arbitrary regions may be  highlighted  by  setting  the
2098       special array parameter region_highlight; see above.
2099
2100zsh 5.0.2                      December 21, 2012                     ZSHZLE(1)
Impressum