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

KEYMAPS

25       A keymap in ZLE contains a set of bindings between  key  sequences  and
26       ZLE commands.  The empty key sequence cannot be bound.
27
28       There can be any number of keymaps at any time, and each keymap has one
29       or more names.  If all of a keymap's names are deleted, it  disappears.
30       bindkey can be used to manipulate keymap names.
31
32       Initially, there are four keymaps:
33
34       emacs  EMACS emulation
35       viins  vi emulation - insert mode
36       vicmd  vi emulation - command mode
37       .safe  fallback keymap
38
39       The  `.safe'  keymap is special.  It can never be altered, and the name
40       can never be removed.  However, it can be linked to other names,  which
41       can  be  removed.   In  the  future other special keymaps may be added;
42       users should avoid  using  names  beginning  with  `.'  for  their  own
43       keymaps.
44
45       In  addition  to  these  four  names, either `emacs' or `viins' is also
46       linked to the name `main'.  If one of the VISUAL or EDITOR  environment
47       variables contain the string `vi' when the shell starts up then it will
48       be `viins', otherwise it will be `emacs'.  bindkey's -e and -v  options
49       provide a convenient way to override this default choice.
50
51       When  the  editor starts up, it will select the `main' keymap.  If that
52       keymap doesn't exist, it will use `.safe' instead.
53
54       In the `.safe' keymap, each single key is bound to self-insert,  except
55       for  ^J  (line  feed)  and  ^M (return) which are bound to accept-line.
56       This is deliberately not pleasant to use; if you are using it, it means
57       you deleted the main keymap, and you should put it back.
58
59   Reading Commands
60       When ZLE is reading a command from the terminal, it may read a sequence
61       that is bound to some command and is also a prefix of  a  longer  bound
62       string.  In this case ZLE will wait a certain time to see if more char‐
63       acters are typed, and if not (or they don't match any longer string) it
64       will  execute  the  binding.  This timeout is defined by the KEYTIMEOUT
65       parameter; its default is 0.4 sec.  There is no timeout if  the  prefix
66       string is not itself bound to a command.
67
68       As  well  as ZLE commands, key sequences can be bound to other strings,
69       by using `bindkey -s'.  When such a sequence is read,  the  replacement
70       string  is pushed back as input, and the command reading process starts
71       again using these fake keystrokes.  This input can itself  invoke  fur‐
72       ther replacement strings, but in order to detect loops the process will
73       be stopped if there are twenty such replacements without a real command
74       being read.
75

ZLE BUILTINS

77       The  ZLE  module  contains  three related builtin commands. The bindkey
78       command manipulates keymaps and key bindings; the vared command invokes
79       ZLE  on the value of a shell parameter; and the zle command manipulates
80       editing widgets and allows command line access  to  ZLE  commands  from
81       within shell functions.
82
83       bindkey [ options ] -l
84       bindkey [ options ] -d
85       bindkey [ options ] -D keymap ...
86       bindkey [ options ] -A old-keymap new-keymap
87       bindkey [ options ] -N new-keymap [ old-keymap ]
88       bindkey [ options ] -m
89       bindkey [ options ] -r in-string ...
90       bindkey [ options ] -s in-string out-string ...
91       bindkey [ options ] in-string command ...
92       bindkey [ options ] [ in-string ]
93              bindkey's  options  can be divided into three categories: keymap
94              selection, operation selection, and others.  The  keymap  selec‐
95              tion options are:
96
97              -e     Selects keymap `emacs', and also links it to `main'.
98
99              -v     Selects keymap `viins', and also links it to `main'.
100
101              -a     Selects keymap `vicmd'.
102
103              -M keymap
104                     The keymap specifies a keymap name.
105
106              If  a keymap selection is required and none of the options above
107              are used, the `main' keymap is used.   Some  operations  do  not
108              permit a keymap to be selected, namely:
109
110              -l     List all existing keymap names.  If the -L option is also
111                     used, list in the form of bindkey commands to create  the
112                     keymaps.
113
114              -d     Delete  all  existing  keymaps  and  reset to the default
115                     state.
116
117              -D keymap ...
118                     Delete the named keymaps.
119
120              -A old-keymap new-keymap
121                     Make the new-keymap name an alias for old-keymap, so that
122                     both  names  refer  to  the  same keymap.  The names have
123                     equal standing; if either is deleted, the other  remains.
124                     If there is already a keymap with the new-keymap name, it
125                     is deleted.
126
127              -N new-keymap [ old-keymap ]
128                     Create a new  keymap,  named  new-keymap.   If  a  keymap
129                     already  has  that name, it is deleted.  If an old-keymap
130                     name is given, the new keymap  is  initialized  to  be  a
131                     duplicate of it, otherwise the new keymap will be empty.
132
133              To  use  a  newly  created  keymap, it should be linked to main.
134              Hence the sequence of commands to create and use  a  new  keymap
135              `mymap'   initialized  from  the  emacs  keymap  (which  remains
136              unchanged) is:
137
138                     bindkey -N mymap emacs
139                     bindkey -A mymap main
140
141              Note that while `bindkey -A newmap main' will work  when  newmap
142              is emacs or viins, it will not work for vicmd, as switching from
143              vi insert to command mode becomes impossible.
144
145              The following operations act on the `main' keymap if  no  keymap
146              selection option was given:
147
148              -m     Add the built-in set of meta-key bindings to the selected
149                     keymap.   Only  keys  that  are  unbound  or   bound   to
150                     self-insert are affected.
151
152              -r in-string ...
153                     Unbind  the  specified in-strings in the selected keymap.
154                     This is exactly equivalent  to  binding  the  strings  to
155                     undefined-key.
156
157                     When -R is also used, interpret the in-strings as ranges.
158
159                     When  -p  is  also used, the in-strings specify prefixes.
160                     Any binding that has the given in-string as a prefix, not
161                     including  the  binding for the in-string itself, if any,
162                     will be removed.  For example,
163
164                            bindkey -rpM viins '^['
165
166                     will remove all bindings in the vi-insert  keymap  begin‐
167                     ning with an escape character (probably cursor keys), but
168                     leave the binding for the escape character itself (proba‐
169                     bly  vi-cmd-mode).   This is incompatible with the option
170                     -R.
171
172              -s in-string out-string ...
173                     Bind each in-string to each out-string.   When  in-string
174                     is  typed,  out-string will be pushed back and treated as
175                     input to the line editor.  When -R is also  used,  inter‐
176                     pret the in-strings as ranges.
177
178              in-string command ...
179                     Bind  each  in-string  to each command.  When -R is used,
180                     interpret the in-strings as ranges.
181
182              [ in-string ]
183                     List key bindings.  If an  in-string  is  specified,  the
184                     binding  of  that  string  in the selected keymap is dis‐
185                     played.  Otherwise, all  key  bindings  in  the  selected
186                     keymap  are  displayed.  (As a special case, if the -e or
187                     -v option is used alone, the keymap is  not  displayed  -
188                     the  implicit  linking  of keymaps is the only thing that
189                     happens.)
190
191                     When the  option  -p  is  used,  the  in-string  must  be
192                     present.   The  listing shows all bindings which have the
193                     given key sequence as a prefix, not including  any  bind‐
194                     ings for the key sequence itself.
195
196                     When  the  -L  option is used, the list is in the form of
197                     bindkey commands to create the key bindings.
198
199       When the -R option is used as noted above, a valid  range  consists  of
200       two  characters,  with  an  optional  `-' between them.  All characters
201       between the two specified, inclusive, are bound as specified.
202
203       For either in-string or out-string, the following escape sequences  are
204       recognised:
205
206       \a     bell character
207       \b     backspace
208       \e, \E escape
209       \f     form feed
210       \n     linefeed (newline)
211       \r     carriage return
212       \t     horizontal tab
213       \v     vertical tab
214       \NNN   character code in octal
215       \xNN   character code in hexadecimal
216       \M[-]X character with meta bit set
217       \C[-]X control character
218       ^X     control character
219
220       In  all  other  cases,  `\' escapes the following character.  Delete is
221       written as `^?'.  Note that `\M^?' and `^\M?' are  not  the  same,  and
222       that  (unlike  emacs),  the bindings `\M-X' and `\eX' are entirely dis‐
223       tinct, although they are initialized to the same bindings  by  `bindkey
224       -m'.
225
226       vared [ -Aache ] [ -p prompt ] [ -r rprompt ]
227         [ -M main-keymap ] [ -m vicmd-keymap ] name
228              The  value of the parameter name is loaded into the edit buffer,
229              and the line editor is invoked.  When the editor exits, name  is
230              set  to  the  string  value returned by the editor.  When the -c
231              flag is given, the parameter is created if  it  doesn't  already
232              exist.   The  -a  flag  may  be given with -c to create an array
233              parameter, or the -A flag to create an  associative  array.   If
234              the  type of an existing parameter does not match the type to be
235              created, the parameter is unset and recreated.
236
237              If an array or array slice is being edited, separator characters
238              as  defined  in  $IFS  will be shown quoted with a backslash, as
239              will backslashes themselves.  Conversely, when the  edited  text
240              is  split  into an array, a backslash quotes an immediately fol‐
241              lowing separator character or backslash; no other  special  han‐
242              dling of backslashes, or any handling of quotes, is performed.
243
244              Individual  elements  of  existing  array  or  associative array
245              parameters may be edited by using subscript syntax on name.  New
246              elements are created automatically, even without -c.
247
248              If  the  -p flag is given, the following string will be taken as
249              the prompt to display at the left.  If the -r flag is given, the
250              following  string  gives the prompt to display at the right.  If
251              the -h flag is specified, the history can be accessed from  ZLE.
252              If  the -e flag is given, typing ^D (Control-D) on an empty line
253              causes vared to exit immediately with a non-zero return value.
254
255              The -M option gives a keymap to link to the main  keymap  during
256              editing,  and  the -m option gives a keymap to link to the vicmd
257              keymap during editing.  For vi-style editing, this allows a pair
258              of  keymaps  to override viins and vicmd.  For emacs-style edit‐
259              ing, only -M is normally needed but the -m option may  still  be
260              used.  On exit, the previous keymaps will be restored.
261
262       zle
263       zle -l [ -L | -a ] [ string ... ]
264       zle -D widget ...
265       zle -A old-widget new-widget
266       zle -N widget [ function ]
267       zle -C widget completion-widget function
268       zle -R [ -c ] [ display-string ] [ string ... ]
269       zle -M string
270       zle -U string
271       zle -K keymap
272       zle -F [ -L ] [ fd [ handler ] ]
273       zle -I
274       zle widget [ -n num ] [ -N ] args ...
275              The  zle builtin performs a number of different actions concern‐
276              ing ZLE.
277
278              With no options and no arguments, only the return status will be
279              set.  It is zero if ZLE is currently active and widgets could be
280              invoked using this builtin command and non-zero otherwise.  Note
281              that  even  if  non-zero  status  is  returned, zle may still be
282              active as part of the completion system;  this  does  not  allow
283              direct calls to ZLE widgets.
284
285              Otherwise, which operation it performs depends on its options:
286
287              -l [ -L | -a ]
288                     List all existing user-defined widgets.  If the -L option
289                     is used, list in the form of zle commands to  create  the
290                     widgets.
291
292                     When  combined  with  the -a option, all widget names are
293                     listed, including the builtin ones. In this case  the  -L
294                     option is ignored.
295
296                     If  at least one string is given, nothing will be printed
297                     but the return status will be zero  if  all  strings  are
298                     names  of existing widgets (or of user-defined widgets if
299                     the -a flag is not given) and non-zero if  at  least  one
300                     string is not a name of an defined widget.
301
302              -D widget ...
303                     Delete the named widgets.
304
305              -A old-widget new-widget
306                     Make the new-widget name an alias for old-widget, so that
307                     both names refer to the  same  widget.   The  names  have
308                     equal  standing; if either is deleted, the other remains.
309                     If there is already a widget with the new-widget name, it
310                     is deleted.
311
312              -N widget [ function ]
313                     Create a user-defined widget.  If there is already a wid‐
314                     get with the specified name, it is overwritten.  When the
315                     new  widget is invoked from within the editor, the speci‐
316                     fied shell function is called.  If no  function  name  is
317                     specified,  it  defaults  to the same name as the widget.
318                     For further information, see the section Widgets in  zsh‐
319                     zle(1).
320
321              -C widget completion-widget function
322                     Create a user-defined completion widget named widget. The
323                     completion widget will behave like the  built-in  comple‐
324                     tion-widget  whose name is given as completion-widget. To
325                     generate the completions,  the  shell  function  function
326                     will  be  called.   For further information, see zshcomp‐
327                     wid(1).
328
329              -R [ -c ] [ display-string ] [ string ... ]
330                     Redisplay the command line; this is  to  be  called  from
331                     within  a  user-defined widget to allow changes to become
332                     visible.  If a display-string is  given  and  not  empty,
333                     this  is  shown in the status line (immediately below the
334                     line being edited).
335
336                     If the optional strings are given they are  listed  below
337                     the  prompt  in  the  same  way  as  completion lists are
338                     printed. If no strings are given but  the  -c  option  is
339                     used such a list is cleared.
340
341                     Note  that this option is only useful for widgets that do
342                     not exit immediately after using it because  the  strings
343                     displayed  will  be  erased immediately after return from
344                     the widget.
345
346                     This command can safely be called  outside  user  defined
347                     widgets; if zle is active, the display will be refreshed,
348                     while if zle is not active, the command  has  no  effect.
349                     In this case there will usually be no other arguments.
350
351                     The status is zero if zle was active, else one.
352
353              -M string
354                     As with the -R option, the string will be displayed below
355                     the command line; unlike the -R option, the  string  will
356                     not  be  put  into  the  status  line but will instead be
357                     printed normally below the prompt.  This means  that  the
358                     string  will  still be displayed after the widget returns
359                     (until it is overwritten by subsequent commands).
360
361              -U string
362                     This pushes the characters in the string onto  the  input
363                     stack  of  ZLE.  After the widget currently executed fin‐
364                     ishes ZLE will behave as if the characters in the  string
365                     were typed by the user.
366
367                     As  ZLE  uses  a stack, if this option is used repeatedly
368                     the last string pushed onto the stack will  be  processed
369                     first.   However,  the  characters in each string will be
370                     processed in the  order  in  which  they  appear  in  the
371                     string.
372
373              -K keymap
374                     Selects  the  keymap named keymap.  An error message will
375                     be displayed if there is no such keymap.
376
377                     This keymap selection affects the interpretation of  fol‐
378                     lowing  keystrokes  within  this  invocation of ZLE.  Any
379                     following invocation (e.g., the next command  line)  will
380                     start as usual with the `main' keymap selected.
381
382              -F [ -L ] [ fd [ handler ] ]
383                     Only  available if your system supports one of the `poll'
384                     or `select' system calls; most modern systems do.
385
386                     Installs handler (the name of a shell function) to handle
387                     input from file descriptor fd.  When zle is attempting to
388                     read data, it will examine both the terminal and the list
389                     of  handled fd's.  If data becomes available on a handled
390                     fd, zle will call handler with the fd which is ready  for
391                     reading  as  the  only argument.  If the handler produces
392                     output to the terminal, it should call  `zle  -I'  before
393                     doing  so (see below).  The handler should not attempt to
394                     read from the terminal.  Note that zle makes  no  attempt
395                     to  check  whether  this  fd  is  actually  readable when
396                     installing the handler.  The user  must  make  their  own
397                     arrangements for handling the file descriptor when zle is
398                     not active.
399
400                     Any number of handlers for any number  of  readable  file
401                     descriptors  may  be installed.  Installing a handler for
402                     an fd which is already handled causes the  existing  han‐
403                     dler to be replaced.
404
405                     If no handler is given, but an fd is present, any handler
406                     for that fd is removed.  If there is none, an error  mes‐
407                     sage is printed and status 1 is returned.
408
409                     If  no arguments are given, or the -L option is supplied,
410                     a list of handlers is printed in  a  form  which  can  be
411                     stored for later execution.
412
413                     An  fd  (but  not a handler) may optionally be given with
414                     the -L option; in this case, the function will  list  the
415                     handler if any, else silently return status 1.
416
417                     Note  that this feature should be used with care.  Activ‐
418                     ity on one of the fd's which is not properly handled  can
419                     cause the terminal to become unusable.
420
421                     Here  is  a simple example of using this feature.  A con‐
422                     nection to a remote TCP port is created  using  the  ztcp
423                     command; see the description of the zsh/net/tcp module in
424                     zshmodules(1).  Then a handler is installed which  simply
425                     prints  out  any  data  which arrives on this connection.
426                     Note that `select' will indicate that the file descriptor
427                     needs  handling if the remote side has closed the connec‐
428                     tion; we handle that by testing for a failed read.
429                            if ztcp pwspc 2811; then
430                              tcpfd=$REPLY
431                              handler() {
432                                zle -I
433                                local line
434                                if ! read -r line <&$1; then
435                                  # select marks this fd if we reach EOF,
436                                  # so handle this specially.
437                                  print "[Read on fd $1 failed, removing.]" >&2
438                                  zle -F $1
439                                  return 1
440                                fi
441                                print -r - $line
442                              }
443                              zle -F $tcpfd handler
444                            fi
445
446              -I     Unusually, this option is most  useful  outside  ordinary
447                     widget  functions, though it may be used within if normal
448                     output to the terminal is required.  It  invalidates  the
449                     current  zle display in preparation for output; typically
450                     this will be from a trap function.  It has no  effect  if
451                     zle  is  not active.  When a trap exits, the shell checks
452                     to see if the display needs restoring, hence the  follow‐
453                     ing will print output in such a way as not to disturb the
454                     line being edited:
455
456                            TRAPUSR1() {
457                                # Invalidate zle display
458                              [[ -o zle ]] && zle -I
459                                # Show output
460                              print Hello
461                            }
462
463                     In general, the trap function may need  to  test  whether
464                     zle  is  active before using this method (as shown in the
465                     example), since  the  zsh/zle  module  may  not  even  be
466                     loaded; if it is not, the command can be skipped.
467
468                     It is possible to call `zle -I' several times before con‐
469                     trol is returned to the editor; the display will only  be
470                     invalidated the first time to minimise disruption.
471
472                     Note  that there are normally better ways of manipulating
473                     the display from within zle widgets;  see,  for  example,
474                     `zle -R' above.
475
476                     The  returned status is zero if zle was invalidated, even
477                     though this may have been by a previous call to `zle  -I'
478                     or by a system notification.  To test if a zle widget may
479                     be called at this point, execute zle  with  no  arguments
480                     and examine the return status.
481
482              widget [ -n num ] [ -N ] args ...
483                     Invoke  the specified widget.  This can only be done when
484                     ZLE  is  active;  normally  this   will   be   within   a
485                     user-defined widget.
486
487                     With  the  options -n and -N, the current numerical argu‐
488                     ment will be saved and then restored after  the  call  to
489                     widget;  `-n num' sets the numerical argument temporarily
490                     to num, while `-N' sets it to the  default,  i.e.  as  if
491                     there were none.
492
493                     Any  further  arguments will be passed to the widget.  If
494                     it is a shell function, these are passed  down  as  posi‐
495                     tional  parameters;  for  builtin widgets it is up to the
496                     widget in question what it  does  with  them.   Currently
497                     arguments are only handled by the incremental-search com‐
498                     mands, the history-search-forward and -backward  and  the
499                     corresponding  functions  prefixed by vi-, and by univer‐
500                     sal-argument.  No error is flagged if  the  command  does
501                     not use the arguments, or only uses some of them.
502
503                     The  return status reflects the success or failure of the
504                     operation carried out by  the  widget,  or  if  it  is  a
505                     user-defined  widget the return status of the shell func‐
506                     tion.
507
508                     A non-zero return status causes the shell  to  beep  when
509                     the  widget  exits,  unless the BEEP options was unset or
510                     the widget was called via the zle  command.   Thus  if  a
511                     user defined widget requires an immediate beep, it should
512                     call the beep widget directly.
513

WIDGETS

515       All actions in the editor are performed by `widgets'.  A  widget's  job
516       is  simply  to  perform  some  small action.  The ZLE commands that key
517       sequences in keymaps are bound to are in fact widgets.  Widgets can  be
518       user-defined or built in.
519
520       The  standard  widgets  built  in to ZLE are listed in Standard Widgets
521       below.  Other built-in widgets can be defined  by  other  modules  (see
522       zshmodules(1)).  Each built-in widget has two names: its normal canoni‐
523       cal name, and the same name preceded by a `.'.  The `.'  name  is  spe‐
524       cial: it can't be rebound to a different widget.  This makes the widget
525       available even when its usual name has been redefined.
526
527       User-defined widgets are defined using `zle  -N',  and  implemented  as
528       shell  functions.  When the widget is executed, the corresponding shell
529       function is executed, and can perform editing (or other)  actions.   It
530       is recommended that user-defined widgets should not have names starting
531       with `.'.
532

USER-DEFINED WIDGETS

534       User-defined widgets, being implemented as shell functions, can execute
535       any  normal  shell  command.   They can also run other widgets (whether
536       built-in or user-defined) using the zle builtin command.  The  standard
537       input of the function is closed to prevent external commands from unin‐
538       tentionally blocking ZLE by reading from the terminal, but read  -k  or
539       read  -q can be used to read characters.  Finally, they can examine and
540       edit the ZLE buffer being edited by reading  and  setting  the  special
541       parameters described below.
542
543       These  special parameters are always available in widget functions, but
544       are not in any way special outside ZLE.  If they have some normal value
545       outside  ZLE,  that  value is temporarily inaccessible, but will return
546       when the widget function exits.  These special parameters in fact  have
547       local scope, like parameters created in a function using local.
548
549       Inside  completion  widgets and traps called while ZLE is active, these
550       parameters are available read-only.
551
552       BUFFER (scalar)
553              The entire contents of the edit buffer.  If it  is  written  to,
554              the  cursor remains at the same offset, unless that would put it
555              outside the buffer.
556
557       BUFFERLINES (integer)
558              The number of screen lines needed for the edit buffer  currently
559              displayed  on  screen (i.e. without any changes to the preceding
560              parameters done after the last redisplay); read-only.
561
562       CONTEXT (scalar)
563              The context in which zle was called to read a  line;  read-only.
564              One of the values:
565       start  The start of a command line (at prompt PS1).
566
567       cont   A continuation to a command line (at prompt PS2).
568
569       select In a select loop.
570
571       vared  Editing a variable in vared.
572
573       CURSOR (integer)
574              The  offset  of  the cursor, within the edit buffer.  This is in
575              the  range  0  to  $#BUFFER,  and  is  by  definition  equal  to
576              $#LBUFFER.   Attempts to move the cursor outside the buffer will
577              result in the cursor being moved to the appropriate end  of  the
578              buffer.
579
580       CUTBUFFER (scalar)
581              The  last  item to be cut using one of the `kill-' commands; the
582              string which the next yank would insert in the line.
583
584       HISTNO (integer)
585              The current history number.  Setting this has the same effect as
586              moving  up  or  down in the history to the corresponding history
587              line.  An attempt to set it is ignored if the line is not stored
588              in  the  history.   Note  this  is not the same as the parameter
589              HISTCMD, which always gives the number of the history line being
590              added  to  the  main shell's history.  HISTNO refers to the line
591              being retrieved within zle.
592
593       KEYMAP (scalar)
594              The name of the currently selected keymap; read-only.
595
596       KEYS (scalar)
597              The keys typed to invoke  this  widget,  as  a  literal  string;
598              read-only.
599
600       killring (array)
601              The  array  of  previously  killed items, with the most recently
602              killed first.  This gives the items that would be retrieved by a
603              yank-pop in the same order.
604
605              The  default size for the kill ring is eight, however the length
606              may be changed by normal array operations.  Any empty string  in
607              the kill ring is ignored by the yank-pop command, hence the size
608              of the array effectively sets the maximum  length  of  the  kill
609              ring,  while  the  number  of non-zero strings gives the current
610              length, both as seen by the user at the command line.
611
612       LASTSEARCH (scalar)
613              The  last  search  string  used  by  an  interactive  search   ;
614              read-only.
615
616       LASTWIDGET (scalar)
617              The name of the last widget that was executed; read-only.
618
619       LBUFFER (scalar)
620              The part of the buffer that lies to the left of the cursor posi‐
621              tion.  If it is assigned to, only that part  of  the  buffer  is
622              replaced,  and  the  cursor remains between the new $LBUFFER and
623              the old $RBUFFER.
624
625       MARK (integer)
626              Like CURSOR, but for the mark.
627
628       NUMERIC (integer)
629              The numeric argument. If no numeric  argument  was  given,  this
630              parameter  is  unset. When this is set inside a widget function,
631              builtin widgets called with the zle builtin command will use the
632              value assigned. If it is unset inside a widget function, builtin
633              widgets called behave as if no numeric argument was given.
634
635       PENDING (integer)
636              The number of bytes pending for input, i.e. the number of  bytes
637              which  have  already  been typed and can immediately be read. On
638              systems where the shell is not able  to  get  this  information,
639              this parameter will always have a value of zero.  Read-only.
640
641       PREBUFFER (scalar)
642              In  a  multi-line  input at the secondary prompt, this read-only
643              parameter contains the contents of the lines before the one  the
644              cursor is currently in.
645
646       PREDISPLAY (scalar)
647              Text  to be displayed before the start of the editable text buf‐
648              fer.  This does not have to be a complete  line;  to  display  a
649              complete  line,  a  newline  must be appended explicitly.    The
650              text is reset on each new invocation (but not recursive  invoca‐
651              tion) of zle.
652
653       POSTDISPLAY (scalar)
654              Text  to be displayed after the end of the editable text buffer.
655              This does not have to be a complete line; to display a  complete
656              line, a newline must be prepended explicitly.  The text is reset
657              on each new invocation (but not recursive invocation) of zle.
658
659       RBUFFER (scalar)
660              The part of the buffer that lies to  the  right  of  the  cursor
661              position.  If it is assigned to, only that part of the buffer is
662              replaced, and the cursor remains between the  old  $LBUFFER  and
663              the new $RBUFFER.
664
665       WIDGET (scalar)
666              The name of the widget currently being executed; read-only.
667
668       WIDGETFUNC (scalar)
669              The  name of the shell function that implements a widget defined
670              with either zle -N or zle -C.  In the former case, this  is  the
671              second  argument  to the zle -N command that defined the widget,
672              or the first argument if there was no second argument.   In  the
673              latter case this is the the third argument to the zle -C command
674              that defined the widget.  Read-only.
675
676       WIDGETSTYLE (scalar)
677              Describes the implementation behind the completion  widget  cur‐
678              rently  being executed; the second argument that followed zle -C
679              when the widget was defined.  This is the name of a builtin com‐
680              pletion  widget.  For widgets defined with zle -N this is set to
681              the empty string.  Read-only.
682
683   Special Widget
684       There is one user-defined widget which is special to the shell.  If  it
685       does  not  exist, no special action is taken.  The environment provided
686       is identical to that for any other editing widget.
687
688       zle-line-init
689              Executed every time the line editor is started  to  read  a  new
690              line  of input.  The following example puts the line editor into
691              vi command mode when it starts up.
692
693                     zle-line-init() { zle -K vicmd; }
694                     zle -N zle-line-init
695
696              (The command inside the function sets the keymap directly; it is
697              equivalent to zle vi-cmd-mode.)
698

STANDARD WIDGETS

700       The  following is a list of all the standard widgets, and their default
701       bindings in emacs mode,  vi  command  mode  and  vi  insert  mode  (the
702       `emacs', `vicmd' and `viins' keymaps, respectively).
703
704       Note  that cursor keys are bound to movement keys in all three keymaps;
705       the shell assumes that the cursor keys send the key sequences  reported
706       by  the  terminal-handling  library  (termcap  or  terminfo).   The key
707       sequences shown in the list are those based on  the  VT100,  common  on
708       many modern terminals, but in fact these are not necessarily bound.  In
709       the case of the viins keymap,  the  initial  escape  character  of  the
710       sequences  serves also to return to the vicmd keymap: whether this hap‐
711       pens is determined by the KEYTIMEOUT parameter, see zshparam(1).
712
713   Movement
714       vi-backward-blank-word (unbound) (B) (unbound)
715              Move backward one word, where a word is defined as a  series  of
716              non-blank characters.
717
718       backward-char (^B ESC-[D) (unbound) (unbound)
719              Move backward one character.
720
721       vi-backward-char (unbound) (^H h ^?) (ESC-[D)
722              Move backward one character, without changing lines.
723
724       backward-word (ESC-B ESC-b) (unbound) (unbound)
725              Move to the beginning of the previous word.
726
727       emacs-backward-word
728              Move to the beginning of the previous word.
729
730       vi-backward-word (unbound) (b) (unbound)
731              Move to the beginning of the previous word, vi-style.
732
733       beginning-of-line (^A) (unbound) (unbound)
734              Move  to the beginning of the line.  If already at the beginning
735              of the line, move to the beginning of the previous line, if any.
736
737       vi-beginning-of-line
738              Move to the beginning of the line, without changing lines.
739
740       end-of-line (^E) (unbound) (unbound)
741              Move to the end of the line.  If already at the end of the line,
742              move to the end of the next line, if any.
743
744       vi-end-of-line (unbound) ($) (unbound)
745              Move  to  the  end of the line.  If an argument is given to this
746              command, the cursor will be moved to the end of the line  (argu‐
747              ment - 1) lines down.
748
749       vi-forward-blank-word (unbound) (W) (unbound)
750              Move  forward  one  word, where a word is defined as a series of
751              non-blank characters.
752
753       vi-forward-blank-word-end (unbound) (E) (unbound)
754              Move to the end of the current word, or, if at the  end  of  the
755              current  word,  to  the  end  of  the next word, where a word is
756              defined as a series of non-blank characters.
757
758       forward-char (^F ESC-[C) (unbound) (unbound)
759              Move forward one character.
760
761       vi-forward-char (unbound) (space l) (ESC-[C)
762              Move forward one character.
763
764       vi-find-next-char (^X^F) (f) (unbound)
765              Read a character from the keyboard, and move to the next  occur‐
766              rence of it in the line.
767
768       vi-find-next-char-skip (unbound) (t) (unbound)
769              Read  a  character  from  the keyboard, and move to the position
770              just before the next occurrence of it in the line.
771
772       vi-find-prev-char (unbound) (F) (unbound)
773              Read a character from the keyboard, and  move  to  the  previous
774              occurrence of it in the line.
775
776       vi-find-prev-char-skip (unbound) (T) (unbound)
777              Read  a  character  from  the keyboard, and move to the position
778              just after the previous occurrence of it in the line.
779
780       vi-first-non-blank (unbound) (^) (unbound)
781              Move to the first non-blank character in the line.
782
783       vi-forward-word (unbound) (w) (unbound)
784              Move forward one word, vi-style.
785
786       forward-word (ESC-F ESC-f) (unbound) (unbound)
787              Move to the beginning of the next word.  The editor's idea of  a
788              word is specified with the WORDCHARS parameter.
789
790       emacs-forward-word
791              Move to the end of the next word.
792
793       vi-forward-word-end (unbound) (e) (unbound)
794              Move to the end of the next word.
795
796       vi-goto-column (ESC-|) (|) (unbound)
797              Move to the column specified by the numeric argument.
798
799       vi-goto-mark (unbound) (`) (unbound)
800              Move to the specified mark.
801
802       vi-goto-mark-line (unbound) (') (unbound)
803              Move to beginning of the line containing the specified mark.
804
805       vi-repeat-find (unbound) (;) (unbound)
806              Repeat the last vi-find command.
807
808       vi-rev-repeat-find (unbound) (,) (unbound)
809              Repeat the last vi-find command in the opposite direction.
810
811   History Control
812       beginning-of-buffer-or-history (ESC-<) (unbound) (unbound)
813              Move  to  the beginning of the buffer, or if already there, move
814              to the first event in the history list.
815
816       beginning-of-line-hist
817              Move to the beginning of the line.  If already at the  beginning
818              of the buffer, move to the previous history line.
819
820       beginning-of-history
821              Move to the first event in the history list.
822
823       down-line-or-history (^N ESC-[B) (j) (ESC-[B)
824              Move  down  a  line  in  the buffer, or if already at the bottom
825              line, move to the next event in the history list.
826
827       vi-down-line-or-history (unbound) (+) (unbound)
828              Move down a line in the buffer, or  if  already  at  the  bottom
829              line,  move to the next event in the history list.  Then move to
830              the first non-blank character on the line.
831
832       down-line-or-search
833              Move down a line in the buffer, or  if  already  at  the  bottom
834              line,  search  forward  in the history for a line beginning with
835              the first word in the buffer.
836
837              If called from a function by the zle command with arguments, the
838              first  argument  is  taken  as  the  string for which to search,
839              rather than the first word in the buffer.
840
841       down-history (unbound) (^N) (unbound)
842              Move to the next event in the history list.
843
844       history-beginning-search-backward
845              Search backward in the history for a  line  beginning  with  the
846              current  line  up  to the cursor.  This leaves the cursor in its
847              original position.
848
849       end-of-buffer-or-history (ESC->) (unbound) (unbound)
850              Move to the end of the buffer, or if already there, move to  the
851              last event in the history list.
852
853       end-of-line-hist
854              Move  to the end of the line.  If already at the end of the buf‐
855              fer, move to the next history line.
856
857       end-of-history
858              Move to the last event in the history list.
859
860       vi-fetch-history (unbound) (G) (unbound)
861              Fetch the history line specified by the numeric argument.   This
862              defaults  to  the  current history line (i.e. the one that isn't
863              history yet).
864
865       history-incremental-search-backward (^R ^Xr) (unbound) (unbound)
866              Search backward  incrementally  for  a  specified  string.   The
867              search  is  case-insensitive  if the search string does not have
868              uppercase letters and no numeric argument was given.  The string
869              may  begin with `^' to anchor the search to the beginning of the
870              line.
871
872              A restricted set  of  editing  functions  is  available  in  the
873              mini-buffer.   An  interrupt signal, as defined by the stty set‐
874              ting, will stop the search and go back to the original line.  An
875              undefined key will have the same effect. The supported functions
876              are:       backward-delete-char,        vi-backward-delete-char,
877              clear-screen,    redisplay,   quoted-insert,   vi-quoted-insert,
878              accept-and-hold, accept-and-infer-next-history, accept-line  and
879              accept-line-and-down-history.
880
881              magic-space  just  inserts a space.  vi-cmd-mode toggles between
882              the `main' and `vicmd' keymaps; the `main' keymap (insert  mode)
883              will be selected initially.  history-incremental-search-backward
884              will get the next occurrence of the contents of the mini-buffer.
885              history-incremental-search-forward  inverts  the  sense  of  the
886              search.  vi-repeat-search and vi-rev-repeat-search are similarly
887              supported.   The  direction  of  the  search is indicated in the
888              mini-buffer.
889
890              Any multi-character string that is not bound to one of the above
891              functions  will  beep and interrupt the search, leaving the last
892              found line in the buffer. Any single character that is not bound
893              to   one   of   the   above   functions,   or   self-insert   or
894              self-insert-unmeta, will have the same effect but  the  function
895              will be executed.
896
897              When  called  from  a  widget  function  by the zle command, the
898              incremental search commands can take a  string  argument.   This
899              will  be  treated  as  a string of keys, as for arguments to the
900              bindkey command, and used as initial input for the command.  Any
901              characters  in  the  string  which are unused by the incremental
902              search will be silently ignored.  For example,
903
904                     zle history-incremental-search-backward forceps
905
906              will search backwards for forceps, leaving the  minibuffer  con‐
907              taining the string `forceps'.
908
909       history-incremental-search-forward (^S ^Xs) (unbound) (unbound)
910              Search forward incrementally for a specified string.  The search
911              is case-insensitive if the search string does not have uppercase
912              letters and no numeric argument was given.  The string may begin
913              with `^' to anchor the search to the beginning of the line.  The
914              functions  available in the mini-buffer are the same as for his‐
915              tory-incremental-search-backward.
916
917       history-search-backward (ESC-P ESC-p) (unbound) (unbound)
918              Search backward in the history for a  line  beginning  with  the
919              first word in the buffer.
920
921              If called from a function by the zle command with arguments, the
922              first argument is taken as  the  string  for  which  to  search,
923              rather than the first word in the buffer.
924
925       vi-history-search-backward (unbound) (/) (unbound)
926              Search  backward  in  the  history  for a specified string.  The
927              string may begin with `^' to anchor the search to the  beginning
928              of the line.
929
930              A  restricted  set  of  editing  functions  is  available in the
931              mini-buffer.  An interrupt signal, as defined by the  stty  set‐
932              ting,   will  stop  the  search.  The functions available in the
933              mini-buffer  are:  accept-line,  backward-delete-char,  vi-back‐
934              ward-delete-char,   backward-kill-word,   vi-backward-kill-word,
935              clear-screen, redisplay, quoted-insert and vi-quoted-insert.
936
937              vi-cmd-mode is treated the same as accept-line, and  magic-space
938              is treated as a space.  Any other character that is not bound to
939              self-insert or self-insert-unmeta will beep and be  ignored.  If
940              the function is called from vi command mode, the bindings of the
941              current insert mode will be used.
942
943              If called from a function by the zle command with arguments, the
944              first  argument  is  taken  as  the  string for which to search,
945              rather than the first word in the buffer.
946
947       history-search-forward (ESC-N ESC-n) (unbound) (unbound)
948              Search forward in the history for  a  line  beginning  with  the
949              first word in the buffer.
950
951              If called from a function by the zle command with arguments, the
952              first argument is taken as  the  string  for  which  to  search,
953              rather than the first word in the buffer.
954
955       vi-history-search-forward (unbound) (?) (unbound)
956              Search  forward  in  the  history  for  a specified string.  The
957              string may begin with `^' to anchor the search to the  beginning
958              of  the line. The functions available in the mini-buffer are the
959              same as for vi-history-search-backward.   Argument  handling  is
960              also the same as for that command.
961
962       infer-next-history (^X^N) (unbound) (unbound)
963              Search  in  the history list for a line matching the current one
964              and fetch the event following it.
965
966       insert-last-word (ESC-_ ESC-.) (unbound) (unbound)
967              Insert the last word from the previous history event at the cur‐
968              sor  position.   If a positive numeric argument is given, insert
969              that word from the end of the previous history  event.   If  the
970              argument  is  zero  or  negative  insert that word from the left
971              (zero inserts the previous command word).  Repeating  this  com‐
972              mand replaces the word just inserted with the last word from the
973              history event prior to the one just used; numeric arguments  can
974              be used in the same way to pick a word from that event.
975
976              When  called  from  a shell function invoked from a user-defined
977              widget, the command can take one to three arguments.  The  first
978              argument  specifies a history offset which applies to successive
979              calls to this widget: if is -1, the default behaviour  is  used,
980              while  if  it  is 1, successive calls will move forwards through
981              the history.  The value 0 can be used to indicate that the  his‐
982              tory line examined by the previous execution of the command will
983              be reexamined.  Note that negative numbers  should  be  preceded
984              with a `--' argument to avoid confusing them with options.
985
986              If two arguments are given, the second specifies the word on the
987              command line in normal array index notation (as a  more  natural
988              alternative to the prefix argument).  Hence 1 is the first word,
989              and -1 (the default) is the last word.
990
991              If a third argument is given, its value is ignored,  but  it  is
992              used  to signify that the history offset is relative to the cur‐
993              rent history line, rather than the one remembered after the pre‐
994              vious invocations of insert-last-word.
995
996              For example, the default behaviour of the command corresponds to
997
998                     zle insert-last-word -- -1 -1
999
1000              while the command
1001
1002                     zle insert-last-word -- -1 1 -
1003
1004              always  copies the first word of the line in the history immedi‐
1005              ately before the line being edited.  This has  the  side  effect
1006              that  later  invocations  of the widget will be relative to that
1007              line.
1008
1009       vi-repeat-search (unbound) (n) (unbound)
1010              Repeat the last vi history search.
1011
1012       vi-rev-repeat-search (unbound) (N) (unbound)
1013              Repeat the last vi history search, but in reverse.
1014
1015       up-line-or-history (^P ESC-[A) (k) (ESC-[A)
1016              Move up a line in the buffer, or if already  at  the  top  line,
1017              move to the previous event in the history list.
1018
1019       vi-up-line-or-history (unbound) (-) (unbound)
1020              Move  up  a  line  in the buffer, or if already at the top line,
1021              move to the previous event in the history list.   Then  move  to
1022              the first non-blank character on the line.
1023
1024       up-line-or-search
1025              Move  up  a  line  in the buffer, or if already at the top line,
1026              search backward in the history for a  line  beginning  with  the
1027              first word in the buffer.
1028
1029              If called from a function by the zle command with arguments, the
1030              first argument is taken as  the  string  for  which  to  search,
1031              rather than the first word in the buffer.
1032
1033       up-history (unbound) (^P) (unbound)
1034              Move to the previous event in the history list.
1035
1036       history-beginning-search-forward
1037              Search forward in the history for a line beginning with the cur‐
1038              rent line up to the cursor.  This leaves the cursor in its orig‐
1039              inal position.
1040
1041   Modifying Text
1042       vi-add-eol (unbound) (A) (unbound)
1043              Move to the end of the line and enter insert mode.
1044
1045       vi-add-next (unbound) (a) (unbound)
1046              Enter  insert  mode  after  the current cursor position, without
1047              changing lines.
1048
1049       backward-delete-char (^H ^?) (unbound) (unbound)
1050              Delete the character behind the cursor.
1051
1052       vi-backward-delete-char (unbound) (X) (^H)
1053              Delete the character behind the cursor, without changing  lines.
1054              If in insert mode, this won't delete past the point where insert
1055              mode was last entered.
1056
1057       backward-delete-word
1058              Delete the word behind the cursor.
1059
1060       backward-kill-line
1061              Kill from the beginning of the line to the cursor position.
1062
1063       backward-kill-word (^W ESC-^H ESC-^?) (unbound) (unbound)
1064              Kill the word behind the cursor.
1065
1066       vi-backward-kill-word (unbound) (unbound) (^W)
1067              Kill the word behind the cursor, without going  past  the  point
1068              where insert mode was last entered.
1069
1070       capitalize-word (ESC-C ESC-c) (unbound) (unbound)
1071              Capitalize the current word and move past it.
1072
1073       vi-change (unbound) (c) (unbound)
1074              Read  a  movement  command  from the keyboard, and kill from the
1075              cursor position to the endpoint of  the  movement.   Then  enter
1076              insert  mode.   If  the command is vi-change, change the current
1077              line.
1078
1079       vi-change-eol (unbound) (C) (unbound)
1080              Kill to the end of the line and enter insert mode.
1081
1082       vi-change-whole-line (unbound) (S) (unbound)
1083              Kill the current line and enter insert mode.
1084
1085       copy-region-as-kill (ESC-W ESC-w) (unbound) (unbound)
1086              Copy the area from the cursor to the mark to the kill buffer.
1087
1088       copy-prev-word (ESC-^_) (unbound) (unbound)
1089              Duplicate the word to the left of the cursor.
1090
1091       copy-prev-shell-word
1092              Like copy-prev-word, but the word is found by using shell  pars‐
1093              ing,  whereas copy-prev-word looks for blanks. This makes a dif‐
1094              ference when the word is quoted and contains spaces.
1095
1096       vi-delete (unbound) (d) (unbound)
1097              Read a movement command from the keyboard,  and  kill  from  the
1098              cursor position to the endpoint of the movement.  If the command
1099              is vi-delete, kill the current line.
1100
1101       delete-char
1102              Delete the character under the cursor.
1103
1104       vi-delete-char (unbound) (x) (unbound)
1105              Delete the character under the cursor, without  going  past  the
1106              end of the line.
1107
1108       delete-word
1109              Delete the current word.
1110
1111       down-case-word (ESC-L ESC-l) (unbound) (unbound)
1112              Convert the current word to all lowercase and move past it.
1113
1114       kill-word (ESC-D ESC-d) (unbound) (unbound)
1115              Kill the current word.
1116
1117       gosmacs-transpose-chars
1118              Exchange the two characters behind the cursor.
1119
1120       vi-indent (unbound) (>) (unbound)
1121              Indent a number of lines.
1122
1123       vi-insert (unbound) (i) (unbound)
1124              Enter insert mode.
1125
1126       vi-insert-bol (unbound) (I) (unbound)
1127              Move  to  the  first  non-blank  character on the line and enter
1128              insert mode.
1129
1130       vi-join (^X^J) (J) (unbound)
1131              Join the current line with the next one.
1132
1133       kill-line (^K) (unbound) (unbound)
1134              Kill from the cursor to the end of the line.  If already on  the
1135              end of the line, kill the newline character.
1136
1137       vi-kill-line (unbound) (unbound) (^U)
1138              Kill  from  the  cursor  back  to  wherever insert mode was last
1139              entered.
1140
1141       vi-kill-eol (unbound) (D) (unbound)
1142              Kill from the cursor to the end of the line.
1143
1144       kill-region
1145              Kill from the cursor to the mark.
1146
1147       kill-buffer (^X^K) (unbound) (unbound)
1148              Kill the entire buffer.
1149
1150       kill-whole-line (^U) (unbound) (unbound)
1151              Kill the current line.
1152
1153       vi-match-bracket (^X^B) (%) (unbound)
1154              Move to the bracket character (one of {}, () or []) that matches
1155              the  one  under  the  cursor.  If the cursor is not on a bracket
1156              character, move forward without going past the end of  the  line
1157              to find one, and then go to the matching bracket.
1158
1159       vi-open-line-above (unbound) (O) (unbound)
1160              Open a line above the cursor and enter insert mode.
1161
1162       vi-open-line-below (unbound) (o) (unbound)
1163              Open a line below the cursor and enter insert mode.
1164
1165       vi-oper-swap-case
1166              Read  a movement command from the keyboard, and swap the case of
1167              all characters from the cursor position to the endpoint  of  the
1168              movement.   If  the  movement command is vi-oper-swap-case, swap
1169              the case of all characters on the current line.
1170
1171       overwrite-mode (^X^O) (unbound) (unbound)
1172              Toggle between overwrite mode and insert mode.
1173
1174       vi-put-before (unbound) (P) (unbound)
1175              Insert the contents of the kill buffer before  the  cursor.   If
1176              the  kill  buffer  contains  a  sequence of lines (as opposed to
1177              characters), paste it above the current line.
1178
1179       vi-put-after (unbound) (p) (unbound)
1180              Insert the contents of the kill buffer after the cursor.  If the
1181              kill  buffer contains a sequence of lines (as opposed to charac‐
1182              ters), paste it below the current line.
1183
1184       quoted-insert (^V) (unbound) (unbound)
1185              Insert the next character typed into the buffer  literally.   An
1186              interrupt character will not be inserted.
1187
1188       vi-quoted-insert (unbound) (unbound) (^Q ^V)
1189              Display  a `^' at the cursor position, and insert the next char‐
1190              acter typed into the buffer literally.  An  interrupt  character
1191              will not be inserted.
1192
1193       quote-line (ESC-') (unbound) (unbound)
1194              Quote  the  current  line;  that  is, put a `'' character at the
1195              beginning and the end, and convert all `'' characters to `'\'''.
1196
1197       quote-region (ESC-") (unbound) (unbound)
1198              Quote the region from the cursor to the mark.
1199
1200       vi-replace (unbound) (R) (unbound)
1201              Enter overwrite mode.
1202
1203       vi-repeat-change (unbound) (.) (unbound)
1204              Repeat the last vi mode text modification.  If a count was  used
1205              with the modification, it is remembered.  If a count is given to
1206              this command, it overrides the remembered count, and  is  remem‐
1207              bered  for future uses of this command.  The cut buffer specifi‐
1208              cation is similarly remembered.
1209
1210       vi-replace-chars (unbound) (r) (unbound)
1211              Replace the character under the cursor  with  a  character  read
1212              from the keyboard.
1213
1214       self-insert  (printable characters) (unbound) (printable characters and
1215       some control characters)
1216              Insert a character into the buffer at the cursor position.
1217
1218       self-insert-unmeta (ESC-^I ESC-^J ESC-^M) (unbound) (unbound)
1219              Insert a character into the buffer after stripping the meta  bit
1220              and converting ^M to ^J.
1221
1222       vi-substitute (unbound) (s) (unbound)
1223              Substitute the next character(s).
1224
1225       vi-swap-case (unbound) (~) (unbound)
1226              Swap  the  case  of the character under the cursor and move past
1227              it.
1228
1229       transpose-chars (^T) (unbound) (unbound)
1230              Exchange the two characters to the left of the cursor if at  end
1231              of  line,  else exchange the character under the cursor with the
1232              character to the left.
1233
1234       transpose-words (ESC-T ESC-t) (unbound) (unbound)
1235              Exchange the current word with the one before it.
1236
1237       vi-unindent (unbound) (<) (unbound)
1238              Unindent a number of lines.
1239
1240       up-case-word (ESC-U ESC-u) (unbound) (unbound)
1241              Convert the current word to all caps and move past it.
1242
1243       yank (^Y) (unbound) (unbound)
1244              Insert the contents of the kill buffer at the cursor position.
1245
1246       yank-pop (ESC-y) (unbound) (unbound)
1247              Remove the text just yanked, rotate the kill-ring, and yank  the
1248              new top.  Only works following yank or yank-pop.
1249
1250       vi-yank (unbound) (y) (unbound)
1251              Read  a  movement command from the keyboard, and copy the region
1252              from the cursor position to the endpoint of  the  movement  into
1253              the  kill  buffer.   If the command is vi-yank, copy the current
1254              line.
1255
1256       vi-yank-whole-line (unbound) (Y) (unbound)
1257              Copy the current line into the kill buffer.
1258
1259       vi-yank-eol
1260              Copy the region from the cursor position to the end of the  line
1261              into the kill buffer.  Arguably, this is what Y should do in vi,
1262              but it isn't what it actually does.
1263
1264   Arguments
1265       digit-argument (ESC-0..ESC-9) (1-9) (unbound)
1266              Start a new numeric argument, or add to the  current  one.   See
1267              also vi-digit-or-beginning-of-line.  This only works if bound to
1268              a key sequence ending in a decimal digit.
1269
1270              Inside a widget function, a call to  this  function  treats  the
1271              last  key  of  the  key  sequence which called the widget as the
1272              digit.
1273
1274       neg-argument (ESC--) (unbound) (unbound)
1275              Changes the sign of the following argument.
1276
1277       universal-argument
1278              Multiply the argument of the next command by 4.   Alternatively,
1279              if  this  command  is  followed by an integer (positive or nega‐
1280              tive), use that as the argument for the next command.  Thus dig‐
1281              its cannot be repeated using this command.  For example, if this
1282              command occurs twice, followed immediately by forward-char, move
1283              forward  sixteen  spaces;  if instead it is followed by -2, then
1284              forward-char, move backward two spaces.
1285
1286              Inside a widget function, if passed an argument, i.e. `zle  uni‐
1287              versal-argument num', the numerical argument will be set to num;
1288              this is equivalent to `NUMERIC=num'.
1289
1290   Completion
1291       accept-and-menu-complete
1292              In a menu completion, insert the  current  completion  into  the
1293              buffer, and advance to the next possible completion.
1294
1295       complete-word
1296              Attempt completion on the current word.
1297
1298       delete-char-or-list (^D) (unbound) (unbound)
1299              Delete  the character under the cursor.  If the cursor is at the
1300              end of the line, list possible completions for the current word.
1301
1302       expand-cmd-path
1303              Expand the current command to its full pathname.
1304
1305       expand-or-complete (TAB) (unbound) (TAB)
1306              Attempt shell expansion on the current  word.   If  that  fails,
1307              attempt completion.
1308
1309       expand-or-complete-prefix
1310              Attempt shell expansion on the current word up to cursor.
1311
1312       expand-history (ESC-space ESC-!) (unbound) (unbound)
1313              Perform history expansion on the edit buffer.
1314
1315       expand-word (^X*) (unbound) (unbound)
1316              Attempt shell expansion on the current word.
1317
1318       list-choices (ESC-^D) (^D =) (^D)
1319              List possible completions for the current word.
1320
1321       list-expand (^Xg ^XG) (^G) (^G)
1322              List the expansion of the current word.
1323
1324       magic-space
1325              Perform  history  expansion  and insert a space into the buffer.
1326              This is intended to be bound to space.
1327
1328       menu-complete
1329              Like complete-word, except that menu completion  is  used.   See
1330              the MENU_COMPLETE option.
1331
1332       menu-expand-or-complete
1333              Like expand-or-complete, except that menu completion is used.
1334
1335       reverse-menu-complete
1336              Perform  menu  completion,  like menu-complete, except that if a
1337              menu completion is already in progress,  move  to  the  previous
1338              completion rather than the next.
1339
1340       end-of-list
1341              When  a  previous  completion displayed a list below the prompt,
1342              this widget can be used to move the prompt below the list.
1343
1344   Miscellaneous
1345       accept-and-hold (ESC-A ESC-a) (unbound) (unbound)
1346              Push the contents of the buffer on the buffer stack and  execute
1347              it.
1348
1349       accept-and-infer-next-history
1350              Execute  the  contents  of  the buffer.  Then search the history
1351              list for a line matching the current one and push the event fol‐
1352              lowing onto the buffer stack.
1353
1354       accept-line (^J ^M) (^J ^M) (^J ^M)
1355              Finish  editing  the buffer.  Normally this causes the buffer to
1356              be executed as a shell command.
1357
1358       accept-line-and-down-history (^O) (unbound) (unbound)
1359              Execute the current line, and push the next history event on the
1360              the buffer stack.
1361
1362       beep   Beep, unless the BEEP option is unset.
1363
1364       vi-cmd-mode (^X^V) (unbound) (^[)
1365              Enter  command  mode;  that is, select the `vicmd' keymap.  Yes,
1366              this is bound by default in emacs mode.
1367
1368       vi-caps-lock-panic
1369              Hang until any lowercase key is pressed.  This is for  vi  users
1370              without the mental capacity to keep track of their caps lock key
1371              (like the author).
1372
1373       clear-screen (^L ESC-^L) (^L) (^L)
1374              Clear the screen and redraw the prompt.
1375
1376       describe-key-briefly
1377              Reads a key sequence, then prints the  function  bound  to  that
1378              sequence.
1379
1380       exchange-point-and-mark (^X^X) (unbound) (unbound)
1381              Exchange the cursor position with the position of the mark.
1382
1383       execute-named-cmd (ESC-x) (unbound) (unbound)
1384              Read the name of an editor command and execute it.  A restricted
1385              set of editing functions is available in  the  mini-buffer.   An
1386              interrupt signal, as defined by the stty setting, will abort the
1387              function.  The  allowed  functions  are:   backward-delete-char,
1388              vi-backward-delete-char, clear-screen, redisplay, quoted-insert,
1389              vi-quoted-insert,   backward-kill-word,   vi-backward-kill-word,
1390              kill-whole-line, vi-kill-line, backward-kill-line, list-choices,
1391              delete-char-or-list, complete-word, accept-line,  expand-or-com‐
1392              plete and expand-or-complete-prefix.
1393
1394              kill-region  kills the last word, and vi-cmd-mode is treated the
1395              same as accept-line.  The space and tab characters, if not bound
1396              to  one of these functions, will complete the name and then list
1397              the possibilities if the AUTO_LIST option  is  set.   Any  other
1398              character that is not bound to self-insert or self-insert-unmeta
1399              will beep and be ignored.  The bindings of  the  current  insert
1400              mode will be used.
1401
1402              Currently this command may not be redefined or called by name.
1403
1404       execute-last-named-cmd (ESC-z) (unbound) (unbound)
1405              Redo the last function executed with execute-named-cmd.
1406
1407              Currently this command may not be redefined or called by name.
1408
1409       get-line (ESC-G ESC-g) (unbound) (unbound)
1410              Pop  the top line off the buffer stack and insert it at the cur‐
1411              sor position.
1412
1413       pound-insert (unbound) (#) (unbound)
1414              If there is no # character at the beginning of the  buffer,  add
1415              one  to the beginning of each line.  If there is one, remove a #
1416              from each line that has one.  In either case, accept the current
1417              line.   The  INTERACTIVE_COMMENTS option must be set for this to
1418              have any usefulness.
1419
1420       vi-pound-insert
1421              If there is no # character at the beginning of the current line,
1422              add  one.  If there is one, remove it.  The INTERACTIVE_COMMENTS
1423              option must be set for this to have any usefulness.
1424
1425       push-input
1426              Push the entire current  multiline  construct  onto  the  buffer
1427              stack  and return to the top-level (PS1) prompt.  If the current
1428              parser construct is only a single line,  this  is  exactly  like
1429              push-line.   Next  time  the  editor starts up or is popped with
1430              get-line, the construct will be popped off the top of the buffer
1431              stack and loaded into the editing buffer.
1432
1433       push-line (^Q ESC-Q ESC-q) (unbound) (unbound)
1434              Push the current buffer onto the buffer stack and clear the buf‐
1435              fer.  Next time the editor starts up, the buffer will be  popped
1436              off the top of the buffer stack and loaded into the editing buf‐
1437              fer.
1438
1439       push-line-or-edit
1440              At the top-level (PS1) prompt, equivalent to  push-line.   At  a
1441              secondary  (PS2)  prompt, move the entire current multiline con‐
1442              struct into the editor buffer.   The  latter  is  equivalent  to
1443              push-input followed by get-line.
1444
1445       recursive-edit
1446              Only  useful  from  a user-defined widget.  At this point in the
1447              function, the editor regains control until one of  the  standard
1448              widgets  which  would  normally  cause zle to exit (typically an
1449              accept-line caused by  hitting  the  return  key)  is  executed.
1450              Instead, control returns to the user-defined widget.  The status
1451              returned is non-zero if the return was caused by an  error,  but
1452              the  function  still  continues executing and hence may tidy up.
1453              This makes it safe for the user-defined widget to alter the com‐
1454              mand line or key bindings temporarily.
1455
1456              The following widget, caps-lock, serves as an example.
1457                     self-insert-ucase() {
1458                       LBUFFER+=${(U)KEYS[-1]}
1459                     }
1460
1461                     integer stat
1462
1463                     zle -N self-insert self-insert-ucase
1464                     zle -A caps-lock save-caps-lock
1465                     zle -A accept-line caps-lock
1466
1467                     zle recursive-edit
1468                     stat=$?
1469
1470                     zle -A .self-insert self-insert
1471                     zle -A save-caps-lock caps-lock
1472                     zle -D save-caps-lock
1473
1474                     (( stat )) && zle send-break
1475
1476                     return $stat
1477              This  causes  typed  letters  to  be  inserted capitalised until
1478              either accept-line (i.e. typically the return key) is  typed  or
1479              the  caps-lock  widget is invoked again; the later is handled by
1480              saving the old definition of  caps-lock  as  save-caps-lock  and
1481              then  rebinding  it  to  invoke accept-line.  Note that an error
1482              from the recursive edit is detected as a non-zero return  status
1483              and propagated by using the send-break widget.
1484
1485       redisplay (unbound) (^R) (^R)
1486              Redisplays the edit buffer.
1487
1488       reset-prompt (unbound) (unbound) (unbound)
1489              Force the prompts on both the left and right of the screen to be
1490              re-expanded, then redisplay  the  edit  buffer.   This  reflects
1491              changes  both  to the prompt variables themselves and changes in
1492              the expansion of the values (for example,  changes  in  time  or
1493              directory,  or  changes to the value of variables referred to by
1494              the prompt).
1495
1496              Otherwise, the prompt is only expanded each time zle starts, and
1497              when the display as been interrupted by output from another part
1498              of the shell (such as a job notification) which causes the  com‐
1499              mand line to be reprinted.
1500
1501       send-break (^G ESC-^G) (unbound) (unbound)
1502              Abort  the  current editor function, e.g. execute-named-command,
1503              or the editor itself, e.g. if you are in vared. Otherwise  abort
1504              the parsing of the current line.
1505
1506       run-help (ESC-H ESC-h) (unbound) (unbound)
1507              Push  the  buffer onto the buffer stack, and execute the command
1508              `run-help cmd', where cmd is the current command.   run-help  is
1509              normally aliased to man.
1510
1511       vi-set-buffer (unbound) (") (unbound)
1512              Specify a buffer to be used in the following command.  There are
1513              35 buffers that can be specified: the 26 `named' buffers  "a  to
1514              "z  and  the  nine `queued' buffers "1 to "9.  The named buffers
1515              can also be specified as "A to "Z.
1516
1517              When a buffer is specified for a cut command, the text being cut
1518              replaces  the  previous  contents of the specified buffer.  If a
1519              named buffer is specified using a capital, the newly cut text is
1520              appended to the buffer instead of overwriting it.
1521
1522              If no buffer is specified for a cut command, "1 is used, and the
1523              contents of "1 to "8 are each shifted along one buffer; the con‐
1524              tents of "9 is lost.
1525
1526       vi-set-mark (unbound) (m) (unbound)
1527              Set the specified mark at the cursor position.
1528
1529       set-mark-command (^@) (unbound) (unbound)
1530              Set the mark at the cursor position.
1531
1532       spell-word (ESC-$ ESC-S ESC-s) (unbound) (unbound)
1533              Attempt spelling correction on the current word.
1534
1535       undefined-key
1536              This  command  is executed when a key sequence that is not bound
1537              to any command is typed.  By default it beeps.
1538
1539       undo (^_ ^Xu ^X^U) (unbound) (unbound)
1540              Incrementally undo the last text modification.
1541
1542       redo   Incrementally redo undone text modifications.
1543
1544       vi-undo-change (unbound) (u) (unbound)
1545              Undo the last text modification.  If repeated, redo the  modifi‐
1546              cation.
1547
1548       what-cursor-position (^X=) (unbound) (unbound)
1549              Print the character under the cursor, its code as an octal, dec‐
1550              imal and hexadecimal number, the current cursor position  within
1551              the buffer and the column of the cursor in the current line.
1552
1553       where-is
1554              Read  the name of an editor command and and print the listing of
1555              key sequences that invoke the specified command.
1556
1557       which-command (ESC-?) (unbound) (unbound)
1558              Push the buffer onto the buffer stack, and execute  the  command
1559              `which-command   cmd'.   where   cmd  is  the  current  command.
1560              which-command is normally aliased to whence.
1561
1562       vi-digit-or-beginning-of-line (unbound) (0) (unbound)
1563              If the last command executed was a digit as part of an argument,
1564              continue the argument.  Otherwise, execute vi-beginning-of-line.
1565
1566
1567
1568zsh 4.2.6                      November 28, 2005                     ZSHZLE(1)
Impressum