If the ZLE
option is set (it is by default) and the shell input is
attached to the terminal, the user is allowed to edit command lines.
There are two display modes. The first, multi-line mode, is the default.
It only works if the TERM
parameter is set to a valid terminal
type that can move the cursor up. The second, single line mode, is used
if TERM
is invalid or incapable of moving the cursor up, or if
the SINGLE_LINE_ZLE
option is set. This mode is similar to ksh,
and uses no termcap sequences. If TERM
is `emacs', the
ZLE
option will be unset by the shell.
Command bindings may be set using the bindkey
builtin. There are
two keymaps; the main keymap and the alternate keymap. The alternate
keymap is bound to vi command mode. The main keymap is bound to emacs
mode by default. To bind the main keymap to vi insert mode, use
bindkey -v
. However, if either of
the VISUAL
or EDITOR
environment variables contains the
string `vi' when the shell starts up the main keymap will be bound
to vi insert mode by default.
The following is a list of all the key commands and their default bindings in emacs mode, vi command mode and vi insert mode.
vi-backward-blank-word (unbound) (B) (unbound)
backward-char (^B ESC-[D) (unbound)
vi-backward-char (unbound) (^H h ^?) (unbound)
backward-word (ESC-B ESC-b) (unbound) (unbound)
emacs-backward-word
vi-backward-word (unbound) (b) (unbound)
beginning-of-line (^A) (unbound) (unbound)
vi-beginning-of-line
end-of-line (^E) (unbound) (unbound)
vi-end-of-line (unbound) ($) (unbound)
vi-forward-blank-word (unbound) (W) (unbound)
vi-forward-blank-word-end (unbound) (E) (unbound)
forward-char (^F ESC-[C) (unbound) (unbound)
vi-forward-char (unbound) (SPACE l) (unbound)
vi-find-next-char (^X^F) (f) (unbound)
vi-find-next-char-skip (unbound) (t) (unbound)
vi-find-prev-char (unbound) (F) (unbound)
vi-find-prev-char-skip (unbound) (T) (unbound)
vi-first-non-blank (unbound) (^) (unbound)
vi-forward-word (unbound) (w) (unbound)
forward-word (ESC-F ESC-f) (unbound) (unbound)
WORDCHARS
parameter.
emacs-forward-word
vi-forward-word-end (unbound) (e) (unbound)
vi-goto-column (ESC-|) (|) (unbound)
vi-goto-mark (unbound) (`) (unbound)
vi-goto-mark-line (unbound) (') (unbound)
vi-repeat-find (unbound) (;) (unbound)
vi-find
command.
vi-rev-repeat-find (unbound) (,) (unbound)
vi-find
command in the opposite direction.
beginning-of-buffer-or-history (ESC-<) (unbound) (unbound)
beginning-of-line-hist
beginning-of-history
down-line-or-history (^N ESC-[B) (j) (unbound)
vi-down-line-or-history (unbound) (+) (unbound)
down-line-or-search
down-history (unbound) (^N) (unbound)
history-beginning-search-backward
end-of-buffer-or-history (ESC->) (unbound) (unbound)
end-of-line-hist
end-of-history
vi-fetch-history (unbound) (G) (unbound)
history-incremental-search-backward (^R ^Xr) (unbound) (unbound)
^
to anchor the search to the beginning of the line.
A restricted set of editing functions is available in the mini-buffer.
An interrupt signal, as defined by the stty setting, will stop the
search and go back to the original line. An undefined key will have the
same effect. The supported functions are: backward-delete-char
,
vi-backward-delete-character
, clearscreen
, redisplay
,
quoted-insert
, vi-quoted-insert
, accept-and-hold
,
accept-and-infer-next-history
, accept-line
and
accept-line-and-down-history
; magic-space
just inserts a
space. vi-cmd-mode
toggles between the main and alternate key
bindings; the main key bindings (insert mode) will be selected initially.
Any string that is bound to an out-string (via bindkey -s
)
will behave as if out-string were typed directly. Typing the
binding of history-incremental-search-backward
will get the next
occurrence of the contents of the mini-buffer. Typing the binding of
history-incremental-search-forward
inverts the sense of the
search. The direction of the search is indicated in the mini-buffer.
Any single character that is not bound to one of the above functions,
or self-insert
or self-insert-unmeta
will have the same
effect but the function will be executed.
history-incremental-search-forward (^S ^Xs) (unbound) (unbound)
^
to anchor the search to the beginning of the line.
The functions available in the mini-buffer are the same as for
history-incremental-search-backward
.
history-search-backward (ESC-P ESC-p) (unbound) (unbound)
vi-history-search-backward (unbound) (/) (unbound)
^
to anchor the search to the beginning of the line.
A restricted set of editing functions is available in the mini-buffer.
An interrupt signal, as defined by the stty setting, will stop the
search. The functions available in the mini-buffer are: accept-line
,
vi-cmd-mode
(treated the same as acceptline
),
backward-delete-char
, vi-backward-delete-char
,
backward-kill-word
, vi-backward-kill-word
, clear-screen
,
redisplay
, magic-space
(treated as a space),
quoted-insert
and vi-quoted-insert
. Any string that is not
bound to an out-string (via bindkey -s
) will behave as if out-string
were typed directly. Any other character that is not bound to
self-insert
or self-insert-unmeta
will beep and be ignored. If
the function is called from vi command mode, the bindings of the current
insert mode will be used.
history-search-forward (ESC-N ESC-n) (unbound) (unbound)
vi-history-search-forward (unbound) (?) (unbound)
^
to anchor the search to the beginning of the line.
The functions available in the mini-buffer are the same as for
vi-history-search-backward
.
infer-next-history (^X^N) (unbound) (unbound)
insert-last-word (ESC-_ ESC-.) (unbound) (unbound)
vi-repeat-search (unbound) (n) (unbound)
vi-rev-repeat-search (unbound) (N) (unbound)
up-line-or-history (^P ESC-[A) (k) (unbound)
up-line-or-search
up-history (unbound) (^P) (unbound)
history-beginning-search-forward
vi-add-eol (unbound) (A) (unbound)
vi-add-next (unbound) (a) (unbound)
backward-delete-char (^H ^?) (unbound) (unbound)
vi-backward-delete-char (unbound) (X) (^H)
backward-delete-word
backward-kill-line
backward-kill-word (^W ESC-^H ESC-^?) (unbound) (unbound)
vi-backward-kill-word (unbound) (unbound) (^W)
capitalize-word (ESC-C ESC-c) (unbound) (unbound)
vi-change (unbound) (c) (unbound)
vi-change
, kill the current line.
vi-change-eol (unbound) (C) (unbound)
vi-change-whole-line (unbound) (S) (unbound)
copy-region-as-kill (ESC-W ESC-w) (unbound) (unbound)
copy-prev-word (ESC-^_) (unbound) (unbound)
vi-delete (unbound) (d) (unbound)
vi-delete
, kill the current line.
delete-char
vi-delete-char (unbound) (x) (unbound)
delete-word
down-case-word (ESC-L ESC-l) (unbound) (unbound)
kill-word (ESC-D ESC-d) (unbound) (unbound)
gosmacs-transpose-chars
vi-indent (unbound) (>) (unbound)
vi-insert (unbound) (i) (unbound)
vi-insert-bol (unbound) (I) (unbound)
vi-join (^X^J) (J) (unbound)
kill-line (^K) (unbound) (unbound)
vi-kill-line (unbound) (unbound) (^U)
vi-kill-eol (unbound) (D) (unbound)
kill-region
kill-buffer (^X^K) (unbound) (unbound)
kill-whole-line (^U) (unbound) (unbound)
vi-match-bracket (^X^B) (%) (unbound)
{}
, ()
, or
[]
) that matches the one under the cursor. If the cursor is not on a
bracket character, move forward without going past the end of the line to
find one, and then go to the matching bracket.
vi-open-line-above (unbound) (O) (unbound)
vi-open-line-below (unbound) (o) (unbound)
vi-oper-swap-case
vi-oper-swap-case
, swap the case of all
characters on the current line.
overwrite-mode (^X^O) (unbound) (unbound)
vi-put-before (unbound) (P) (unbound)
vi-put-after (unbound) (p) (unbound)
quoted-insert (^V) (unbound) (unbound)
vi-quoted-insert (unbound) (unbound) (^Q ^V)
^
at the current position, and insert the next character
typed into the buffer literally. An interrupt character will not be inserted.
quote-line (ESC-') (unbound) (unbound)
'
character at the
beginning and the end, and convert all '
characters to
\'
.
quote-region (ESC-") (unbound) (unbound)
vi-replace (unbound) (R) (unbound)
vi-repeat-change (unbound) (.) (unbound)
vi-replace-chars (unbound) (r) (unbound)
self-insert (printable characters) (unbound) (printable characters and some control characters)
self-insert-unmeta (ESC-^I ESC-^J ESC-^M) (unbound) (unbound)
^M
to ^J
.
vi-substitute (unbound) (s) (unbound)
vi-swap-case (unbound) (~) (unbound)
transpose-chars (^T) (unbound) (unbound)
transpose-words (ESC-T ESC-t) (unbound) (unbound)
vi-unindent (unbound) (<) (unbound)
up-case-word (ESC-U ESC-u) (unbound) (unbound)
yank (^Y) (unbound) (unbound)
yank-pop (ESC-y) (unbound) (unbound)
yank
or yank-pop
.
vi-yank (unbound) (y) (unbound)
vi-yank
, copy the current line.
vi-yank-whole-line (unbound) (Y) (unbound)
vi-yank-eol
digit-argument (ESC-0...ESC-9) (1-9) (unbound)
vi-digit-or-beginning-of-line
.
neg-argument (ESC--) (unbound) (unbound)
universal-argument
accept-and-menu-complete
complete-word
delete-char-or-list (^D) (unbound) (unbound)
expand-cmd-path
expand-or-complete (TAB) (unbound) (TAB)
expand-or-complete-prefix
expand-history (ESC-SPACE ESC-!) (unbound) (unbound)
expand-word (^X*) (unbound) (unbound)
list-choices (ESC-^D) (^D=) (^D)
list-expand (^Xg ^XG) (^G) (^G)
magic-space
menu-complete
complete-word
, except that menu completion is used.
See section Options, for the MENU_COMPLETE
option.
menu-expand-or-complete
expand-or-complete
, except that menu completion is used.
reverse-menu-complete
MENU_COMPLETE
option.
accept-and-hold (ESC-A ESC-a) (unbound) (unbound)
accept-and-infer-next-history
accept-line (^J ^M) (^J ^M) (^J ^M)
accept-line-and-down-history (^O) (unbound) (unbound)
vi-cmd-mode (^X^V) (unbound) (^[)
vi-caps-lock-panic
clear-screen (^L ESC-^L) (^L) (^L)
describe-key-briefly
exchange-point-and-mark (^X^X) (unbound) (unbound)
execute-named-cmd (ESC-x) (unbound) (unbound)
backward-delete-char
,
vi-backward-delete-char
, clear-screen
,
redisplay
, quoted-insert
, vi-quoted-insert
,
kill-region
(kills the last word), backward-kill-word
,
vi-backward-kill-word
, kill-whole-line
, vi-kill-line
,
backward-kill-line
, list-choices
, delete-char-or-list
,
complete-word
, expand-or-complete
,
expand-or-complete-prefix
, accept-line
, and vi-cmd-mode
(treated the same as accept line). The SPC 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 string that is
bound to an out-string (via bindkey -s
) will behave as if out-string
were typed directly. Any other character that is not bound to
self-insert
or self-insert-unmeta
will beep and be
ignored. If the function is called from vi command mode, the bindings of
the current insert mode will be used.
execute-last-named-cmd (ESC-z) (unbound) (unbound)
execute-named-cmd
.
get-line (ESC-G ESC-g) (unbound) (unbound)
pound-insert (unbound) (#) (unbound)
#
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
#
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
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-line-or-edit
PS1
) prompt, equivalent to push-line
.
At a secondary (PS2
) prompt, move the entire current multi-line
construct into the editor buffer. The latter is equivalent to
push-line
followed by get-line
.
redisplay (unbound) (^R) (^R)
send-break (^G ESC-^G) (unbound) (unbound)
execute-named-command
, or
the editor itself, e.g. if you are in vared
. Otherwise abort the
parsing of the current line.
run-help (ESC-H ESC-h) (unbound) (unbound)
run-help cmd
, where cmd is the current command.
run-help
is normally aliased to man
.
vi-set-buffer (unbound) (") (unbound)
"a
to "z
and the nine queued buffers "1 to "9. The
named buffers can also be specified as "A
to "Z
. When a buffer
is specified for a cut command, the text being cut 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. If no buffer is specified for a cut command, "1
is used, and the
contents of "1
to "8
are each shifted along one buffer; the
contents of "9
is lost.
vi-set-mark (unbound) (m) (unbound)
set-mark-command (^@) (unbound) (unbound)
spell-word (ESC-$ ESC-S ESC-s) (unbound) (unbound)
undefined-key (lots o' keys) (lots o' keys) (unbound)
undo (^_ ^Xu ^X^U) (unbound) (unbound)
vi-undo-change (unbound) (u) (unbound)
where-is
which-command (ESC-?) (unbound) (unbound)
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)
vi-beginning-of-line
.
Go to the first, previous, next, last section, table of contents.