accept-and-hold
(ESC-A ESC-a
) (unbound) (unbound)Push the contents of the buffer on the buffer stack and execute it.
accept-and-infer-next-history
Execute the contents of the buffer. Then search the history list for a line matching the current one and push the event following onto the buffer stack.
accept-line
(^J ^M
) (^J ^M
) (^J ^M
)Finish editing the buffer. Normally this causes the buffer to be executed as a shell command.
accept-line-and-down-history
(^O
) (unbound) (unbound)Execute the current line, and push the next history event on the buffer stack.
auto-suffix-remove
If the previous action added a suffix (space, slash, etc.) to the word on the command line, remove it. Otherwise do nothing. Removing the suffix ends any active menu completion or menu selection.
This widget is intended to be called from user-defined widgets to enforce a desired suffix-removal behavior.
auto-suffix-retain
If the previous action added a suffix (space, slash, etc.) to the word on the command line, force it to be preserved. Otherwise do nothing. Retaining the suffix ends any active menu completion or menu selection.
This widget is intended to be called from user-defined widgets to enforce a desired suffix-preservation behavior.
beep
Beep, unless the BEEP
option is unset.
bracketed-paste
(^[[200~
) (^[[200~
) (^[[200~
)This widget is invoked when text is pasted to the terminal emulator. It is not intended to be bound to actual keys but instead to the special sequence generated by the terminal emulator when text is pasted.
When invoked interactively, the pasted text is inserted to the buffer and placed in the cutbuffer. If a numeric argument is given, shell quoting will be applied to the pasted text before it is inserted.
When a named buffer is specified with vi-set-buffer
("x
),
the pasted text is stored in that named buffer but not inserted.
When called from a widget function as ‘bracketed-paste
name‘, the
pasted text is assigned to the variable name and no other processing is
done.
See also the zle_bracketed_paste
parameter.
vi-cmd-mode
(^X^V
) (unbound) (^[
)Enter command mode; that is, select the ‘vicmd
’ keymap.
Yes, this is bound by default in emacs mode.
vi-caps-lock-panic
Hang until any lowercase key is pressed. This is for vi users without the mental capacity to keep track of their caps lock key (like the author).
clear-screen
(^L ESC-^L
) (^L
) (^L
)Clear the screen and redraw the prompt.
deactivate-region
Make the current region inactive. This disables vim-style visual selection mode if it is active.
describe-key-briefly
Reads a key sequence, then prints the function bound to that sequence.
exchange-point-and-mark
(^X^X
) (unbound) (unbound)Exchange the cursor position (point) with the position of the mark. Unless a negative numeric argument is given, the region between point and mark is activated so that it can be highlighted. If a zero numeric argument is given, the region is activated but point and mark are not swapped.
execute-named-cmd
(ESC-x
) (:
) (unbound)Read the name of an editor command and execute it. Aliasing this
widget with ‘zle -A
’ or replacing it with ‘zle -N
’ has no
effect when interpreting key bindings, but ‘zle execute-named-cmd
’
will invoke such an alias or replacement.
A restricted set of editing functions is available in the
mini-buffer. Keys are looked up in the special
command
keymap, and if not found there in the main keymap.
An interrupt signal, as defined by the stty setting, will
abort the function. Note that the following always
perform the same task within the executed-named-cmd
environment and
cannot be replaced by user defined widgets, nor can the set of functions
be extended. The allowed functions are:
backward-delete-char
,
vi-backward-delete-char
,
clear-screen
,
redisplay
,
quoted-insert
,
vi-quoted-insert
,
backward-kill-word
,
vi-backward-kill-word
,
kill-whole-line
,
vi-kill-line
,
backward-kill-line
,
list-choices
,
delete-char-or-list
,
complete-word
,
accept-line
,
expand-or-complete
and
expand-or-complete-prefix
.
kill-region
kills the last word,
and vi-cmd-mode is treated the same as accept-line.
The space and tab characters, if not bound to one of
these functions, will complete the name and then list the
possibilities if the AUTO_LIST
option is set.
Any other character that is not bound to self-insert
or
self-insert-unmeta
will beep and be ignored.
The bindings of the current insert mode will be used.
Currently this command may not be redefined or called by name.
execute-last-named-cmd
(ESC-z
) (unbound) (unbound)Redo the last function executed with execute-named-cmd
.
Like execute-named-cmd
, this command may not be redefined,
but it may be called by name.
get-line
(ESC-G ESC-g
) (unbound) (unbound)Pop the top line off the buffer stack and insert it at the cursor position.
pound-insert
(unbound) (#
) (unbound)If there is no # character at the beginning of the buffer,
add one to the beginning of each line.
If there is one, remove a # from each line that has one.
In either case, accept the current line.
The INTERACTIVE_COMMENTS
option must be set
for this to have any usefulness.
vi-pound-insert
If there is no # character at the beginning of the current line,
add one. If there is one, remove it.
The INTERACTIVE_COMMENTS
option must be set
for this to have any usefulness.
push-input
Push the entire current multiline construct onto the buffer stack and
return to the top-level (PS1
) prompt.
If the current parser construct is only a single line, this is exactly
like push-line
.
Next time the editor starts up or is popped with get-line
, the
construct will be popped off the top of the buffer stack and loaded
into the editing buffer.
push-line
(^Q ESC-Q ESC-q
) (unbound) (unbound)Push the current buffer onto the buffer stack and clear the buffer. Next time the editor starts up, the buffer will be popped off the top of the buffer stack and loaded into the editing buffer.
push-line-or-edit
At the top-level (PS1
) prompt, equivalent to push-line
.
At a secondary (PS2
) prompt, move the entire current multiline
construct into the editor buffer.
The latter is equivalent to push-input
followed by get-line
.
read-command
Only useful from a user-defined widget. A keystroke is read just as in
normal operation, but instead of the command being executed the name
of the command that would be executed is stored in the shell parameter
REPLY
. This can be used as the argument of a future zle
command. If the key sequence is not bound, status 1 is returned;
typically, however, REPLY
is set to undefined-key
to indicate
a useless key sequence.
recursive-edit
Only useful from a user-defined widget. At this point in the function,
the editor regains control until one of the standard widgets which would
normally cause zle to exit (typically an accept-line
caused by
hitting the return key) is executed. Instead, control returns to the
user-defined widget. The status returned is non-zero if the return was
caused by an error, but the function still continues executing and hence
may tidy up. This makes it safe for the user-defined widget to alter
the command line or key bindings temporarily.
The following widget, caps-lock
, serves as an example.
self-insert-ucase() { LBUFFER+=${(U)KEYS[-1]} } integer stat zle -N self-insert self-insert-ucase zle -A caps-lock save-caps-lock zle -A accept-line caps-lock zle recursive-edit stat=$? zle -A .self-insert self-insert zle -A save-caps-lock caps-lock zle -D save-caps-lock (( stat )) && zle send-break return $stat
This causes typed letters to be inserted capitalised until either
accept-line
(i.e. typically the return key) is typed or the
caps-lock
widget is invoked again; the later is handled by saving
the old definition of caps-lock
as save-caps-lock
and then
rebinding it to invoke accept-line
. Note that an error from the
recursive edit is detected as a non-zero return status and propagated by
using the send-break
widget.
redisplay
(unbound) (^R
) (^R
)Redisplays the edit buffer.
reset-prompt
(unbound) (unbound) (unbound)Force the prompts on both the left and right of the screen to be re-expanded, then redisplay the edit buffer. This reflects changes both to the prompt variables themselves and changes in the expansion of the values (for example, changes in time or directory, or changes to the value of variables referred to by the prompt).
Otherwise, the prompt is only expanded each time zle starts, and when the display has been interrupted by output from another part of the shell (such as a job notification) which causes the command line to be reprinted.
reset-prompt
doesn’t alter the special parameter LASTWIDGET
.
send-break
(^G ESC-^G
) (unbound) (unbound)Abort the current editor function, e.g. execute-named-command
, or the
editor itself, e.g. if you are in vared
. Otherwise abort the parsing of
the current line; in this case the aborted line is available in the shell
variable ZLE_LINE_ABORTED
. If the editor is aborted from within
vared
, the variable ZLE_VARED_ABORTED
is set.
run-help
(ESC-H ESC-h
) (unbound) (unbound)Push the buffer onto the buffer stack, and execute the
command ‘run-help
cmd’, where cmd is the current
command. run-help
is normally aliased to man
.
vi-set-buffer
(unbound) ("
) (unbound)Specify a buffer to be used in the following command.
There are 37 buffers that can be specified:
the 26 ‘named’ buffers "a
to "z
, the ‘yank’ buffer "0
,
the nine ‘queued’ buffers "1
to "9
and the ‘black hole’ buffer
"_
. The named buffers can also be specified as "A
to "Z
.
When a buffer is specified for a cut, change or yank command, the text
concerned replaces the previous contents of the specified buffer. If
a named buffer is specified using a capital, the newly cut text is
appended to the buffer instead of overwriting it. When using the "_
buffer, nothing happens. This can be useful for deleting text without
affecting any buffers.
If no buffer is specified for a cut or change command, "1
is used, and
the contents of "1
to "8
are each shifted along one buffer;
the contents of "9
is lost. If no buffer is specified for a yank
command, "0
is used. Finally, a paste command without a specified
buffer will paste the text from the most recent command regardless of any
buffer that might have been used with that command.
When called from a widget function by the zle
command, the buffer
can optionally be specified with an argument. For example,
zle vi-set-buffer A
vi-set-mark
(unbound) (m
) (unbound)Set the specified mark at the cursor position.
set-mark-command
(^@
) (unbound) (unbound)Set the mark at the cursor position. If called with a negative numeric argument, do not set the mark but deactivate the region so that it is no longer highlighted (it is still usable for other purposes). Otherwise the region is marked as active.
spell-word
(ESC-$ ESC-S ESC-s
) (unbound) (unbound)Attempt spelling correction on the current word.
split-undo
Breaks the undo sequence at the current change. This is useful in vi mode as
changes made in insert mode are coalesced on entering command mode. Similarly,
undo
will normally revert as one all the changes made by a user-defined
widget.
undefined-key
This command is executed when a key sequence that is not bound to any command is typed. By default it beeps.
undo
(^_ ^Xu ^X^U
) (u
) (unbound)Incrementally undo the last text modification. When called from a
user-defined widget, takes an optional argument indicating a previous state
of the undo history as returned by the UNDO_CHANGE_NO
variable;
modifications are undone until that state is reached, subject to
any limit imposed by the UNDO_LIMIT_NO
variable.
Note that when invoked from vi command mode, the full prior change made in insert mode is reverted, the changes having been merged when command mode was selected.
redo
(unbound) (^R
) (unbound)Incrementally redo undone text modifications.
vi-undo-change
(unbound) (unbound) (unbound)Undo the last text modification. If repeated, redo the modification.
visual-mode
(unbound) (v
) (unbound)Toggle vim-style visual selection mode. If line-wise visual mode is currently enabled then it is changed to being character-wise. If used following an operator, it forces the subsequent movement command to be treated as a character-wise movement.
visual-line-mode
(unbound) (V
) (unbound)Toggle vim-style line-wise visual selection mode. If character-wise visual mode is currently enabled then it is changed to being line-wise. If used following an operator, it forces the subsequent movement command to be treated as a line-wise movement.
what-cursor-position
(^X=
) (ga
) (unbound)Print the character under the cursor, its code as an octal, decimal and hexadecimal number, the current cursor position within the buffer and the column of the cursor in the current line.
where-is
Read the name of an editor command and print the listing of key
sequences that invoke the specified command.
A restricted set of editing functions is available in the
mini-buffer. Keys are looked up in the special
command
keymap, and if not found there in the main keymap.
which-command
(ESC-?
) (unbound) (unbound)Push the buffer onto the buffer stack, and execute the
command ‘which-command
cmd’. where cmd is the current
command. which-command
is normally aliased to whence
.
vi-digit-or-beginning-of-line
(unbound) (0
) (unbound)If the last command executed was a digit as part of an argument, continue the argument. Otherwise, execute vi-beginning-of-line.