Go to the previous, next section.
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, multiline 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 and vi command mode.
vi-backward-blank-word (unbound) (B)
backward-char (^B ESC-[D)
vi-backward-char (unbound) (h)
backward-word (ESC-B ESC-b)
emacs-backward-word
vi-backward-word (unbound) (b)
beginning-of-line (^A) (0)
vi-beginning-of-line
end-of-line (^E)
vi-end-of-line (unbound) ($)
vi-forward-blank-word (unbound) (W)
vi-forward-blank-word-end (unbound) (E)
forward-char (^F ESC-[C)
vi-forward-char (unbound) (SPACE l)
vi-find-next-char (^X^F) (f)
vi-find-next-char-skip (unbound) (t)
vi-find-prev-char (unbound) (F)
vi-find-prev-char-skip (unbound) (T)
vi-first-non-blank (unbound) (^)
vi-forward-word (unbound) (w)
forward-word (ESC-F ESC-f)
WORDCHARS
parameter.þ
emacs-forward-word
vi-forward-word-end (unbound) (e)
vi-goto-column (ESC-|) (|)
vi-goto-mark (unbound) (`)
vi-goto-mark-line (unbound) (')
vi-repeat-find (unbound) (;)
vi-find
command.
þ
þ
vi-rev-repeat-find (unbound) (,)
vi-find
command in the opposite direction.
beginning-of-buffer-or-history (ESC-<)
beginning-of-line-hist
beginning-of-history
down-line-or-history (^N ESC-[B) (+ j)
down-line-or-search
down-history (unbound) (^N)
history-beginning-search-backward
end-of-buffer-or-history (ESC->)
end-of-line-hist
end-of-history
vi-fetch-history (unbound) (G)
history-incremental-search-backward (^R ^Xr)
^
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
,
quoted-insert
, accept-and-hold
,
accept-and-infer-next-history
, accept-line
and
accept-line-and-down-history
; magic-space
just inserts a
space. 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 multi-character string that is not bound to one of the above
functions will beep and interrupt the search, leaving the last found
line in the 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 (^Xs)
^
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) (K)
vi-history-search-backward (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, as will a character bound to vi-cmd-mode
. The functions
available in the mini-buffer are: accept-line
,
backward-delete-char
, vi-backward-delete-char
and
quoted-insert
. 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 vi insert mode will be
used.þ
þ
þ
þ
history-search-forward (ESC-N ESC-n) (J)
vi-history-search-forward (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)
insert-last-word (ESC-_ ESC-.)
vi-repeat-search (unbound) (n)
vi-rev-repeat-search (unbound) (N)
toggle-literal-history (ESC-R ESC-r)
HIST_LIT
option is set.
þ
þ
þ
þ
þ
up-line-or-history (^P ESC-[A) (- k)
up-line-or-search
up-history (unbound) (^P)
history-beginning-search-forward
vi-add-eol (unbound) (A)
vi-add-next (unbound) (a)
backward-delete-char (^H ^?) (^?)
vi-backward-delete-char (unbound) (X)
backward-delete-word
backward-kill-line
backward-kill-word (^W ESC-^H ESC-^?)
vi-backward-kill-word (unbound) (^W)
capitalize-word (ESC-C ESC-c)
vi-change (unbound) (c)
vi-change
, kill the current line.þ
þ
vi-change-eol (unbound) (C)
vi-change-whole-line (unbound) (S s)
copy-region-as-kill (ESC-W ESC-w)
copy-prev-word (ESC-^_)
vi-delete (unbound) (d)
vi-delete
, kill the current line.þ
þ
delete-char (unbound) (x)
vi-delete-char (unbound) (x)
delete-word (ESC-D ESC-d)
down-case-word (ESC-L ESC-l)
kill-word
gosmacs-transpose-chars
vi-indent (unbound) (>)
vi-insert (unbound) (i)
vi-insert-bol (unbound) (I)
vi-join (^X^J)
kill-line (^K) (D)
vi-kill-line
kill-region
kill-buffer (^X^K) (^U)
kill-whole-line (^U)
vi-match-bracket (^X^B) (%)
{}
, ()
, or
[]
) that matches the one under the cursor.þ
þ
vi-open-line-above (unbound) (O)
vi-open-line-below (unbound) (o)
vi-oper-swap-case
vi-oper-swap-case
, swap the case of all
characters on the current line.þ
þ
overwrite-mode (^X^O)
vi-put-after (unbound) (p)
quoted-insert (^V)
quote-line (ESC-')
'
character at the
beginning and the end, and convert all '
characters to
\'
.þ
þ
quote-region (ESC-")
vi-replace (unbound) (R)
vi-repeat-change (unbound) (.)
vi-replace-chars (unbound) (r)
self-insert (printable characters)
self-insert-unmeta (ESC-^I ESC-^J ESC-^M)
^M
to ^J
.þ
þ
vi-substitute (unbound) (s)
vi-swap-case (unbound) (~)
transpose-chars (^T)
transpose-words (ESC-T ESC-t)
vi-unindent (unbound) (<)
up-case-word (ESC-U ESC-u)
yank (^Y) (P)
yank-pop (ESC-y)
yank
or yank-pop
.
þ
þ
vi-yank (unbound) (y)
vi-yank
, copy the current line.
þ
þ
vi-yank-eol (unbound) (Y)
digit-argument (ESC-0...ESC-9) (0-9)
neg-argument (ESC--)
universal-argument
accept-and-menu-complete
complete-word (unbound) (\)
delete-char-or-list (^D)
execute-named-cmd (ESC-x)
backward-delete-char
,
vi-backward-delete-char
, kill-region
(kills the last
word), backward-kill-word
, vi-backward-kill-word
,
kill-whole-line
, vi-kill-line
, backward-kill-line
and accept-line
. The SPACE and TAB keys, if not
bound to one of these functions, will complete the name and then list
the possibilities if the AUTO_LIST
option is set.þ
þ
execute-last-named-cmd (ESC-z)
execute-named-cmd
.þ
expand-cmd-path
expand-or-complete (TAB) (TAB ^X)
expand-or-complete-prefix
expand-history (ESC-SPACE ESC-!)
expand-word (^X*)
list-choices (ESC-^D) (^D=)
list-expand (^Xg ^XG) (^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)
accept-and-infer-next-history
accept-line (^J ^M)
accept-line-and-down-history (^O)
vi-cmd-mode (^X^V) (^[)
vi-caps-lock-panic (unbound) (H K)
clear-screen (^L ESC-^L)
exchange-point-and-mark (^X^X)
get-line (ESC-G ESC-g)
pound-insert (unbound) (#)
#
character at the beginning of the current line,
add one. If there is one, remove it. In either case, accept the
current line. 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)
push-line-or-edit
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-line
followed by get-line
.þ
þ
redisplay (unbound) (^R)
run-help (ESC-H ESC-h)
run-help cmd
, where cmd is the current command.
run-help
is normally aliased to man
.þ
þ
send-break (^C)
execute-named-command
, or
the editor itself, e.g. if you are in vared
. Otherwise abort the
parsing of the current line.þ
þ
vi-set-buffer (unbound) (")
vi-set-mark (unbound) (m)
set-mark-command (^@)
spell-word (ESC-$ ESC-S ESC-s)
undefined-key
undo (^_ ^X^U ^Xu (u)
which-command (ESC-?)
which-command cmd
, where cmd is the current command.
which-command
is normally aliased to whence
.
Go to the previous, next section.