xref: /freebsd/contrib/libedit/editline.7 (revision 61c1328eb016476ee7ff5ad65d8224bb43e572db)
1*d0ef721eSBaptiste Daroussin.\"	$NetBSD: editline.7,v 1.5 2016/05/09 21:27:55 christos Exp $
2*d0ef721eSBaptiste Daroussin.\"	$OpenBSD: editline.7,v 1.1 2016/04/20 01:11:45 schwarze Exp $
3*d0ef721eSBaptiste Daroussin.\"
4*d0ef721eSBaptiste Daroussin.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
5*d0ef721eSBaptiste Daroussin.\"
6*d0ef721eSBaptiste Daroussin.\" Permission to use, copy, modify, and distribute this software for any
7*d0ef721eSBaptiste Daroussin.\" purpose with or without fee is hereby granted, provided that the above
8*d0ef721eSBaptiste Daroussin.\" copyright notice and this permission notice appear in all copies.
9*d0ef721eSBaptiste Daroussin.\"
10*d0ef721eSBaptiste Daroussin.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11*d0ef721eSBaptiste Daroussin.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12*d0ef721eSBaptiste Daroussin.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13*d0ef721eSBaptiste Daroussin.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14*d0ef721eSBaptiste Daroussin.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15*d0ef721eSBaptiste Daroussin.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16*d0ef721eSBaptiste Daroussin.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*d0ef721eSBaptiste Daroussin.\"
18*d0ef721eSBaptiste Daroussin.Dd May 7, 2016
19*d0ef721eSBaptiste Daroussin.Dt EDITLINE 7
20*d0ef721eSBaptiste Daroussin.Os
21*d0ef721eSBaptiste Daroussin.Sh NAME
22*d0ef721eSBaptiste Daroussin.Nm editline
23*d0ef721eSBaptiste Daroussin.Nd line editing user interface
24*d0ef721eSBaptiste Daroussin.Sh DESCRIPTION
25*d0ef721eSBaptiste DaroussinWhen a program using the
26*d0ef721eSBaptiste Daroussin.Xr editline 3
27*d0ef721eSBaptiste Daroussinlibrary prompts for an input string using the function
28*d0ef721eSBaptiste Daroussin.Xr el_wgets 3 ,
29*d0ef721eSBaptiste Daroussinit reads characters from the terminal.
30*d0ef721eSBaptiste DaroussinInvalid input bytes that do not form characters are silently
31*d0ef721eSBaptiste Daroussindiscarded.
32*d0ef721eSBaptiste DaroussinFor each character read, one editor command is executed.
33*d0ef721eSBaptiste DaroussinThe mapping of input characters to editor commands depends on the
34*d0ef721eSBaptiste Daroussinediting mode.
35*d0ef721eSBaptiste DaroussinThere are three editing modes: vi insert mode, vi command mode,
36*d0ef721eSBaptiste Daroussinand emacs mode.
37*d0ef721eSBaptiste DaroussinThe default is vi insert mode.
38*d0ef721eSBaptiste DaroussinThe program can switch the default to emacs mode by using the
39*d0ef721eSBaptiste Daroussin.Xr el_set 3
40*d0ef721eSBaptiste Daroussinor
41*d0ef721eSBaptiste Daroussin.Xr el_parse 3
42*d0ef721eSBaptiste Daroussinfunctions, and the user can switch to emacs mode either in the
43*d0ef721eSBaptiste Daroussin.Xr editrc 5
44*d0ef721eSBaptiste Daroussinconfiguration file or interactively with the
45*d0ef721eSBaptiste Daroussin.Ic ed-command
46*d0ef721eSBaptiste Daroussineditor command, in all three cases executing the
47*d0ef721eSBaptiste Daroussin.Ic bind Fl e
48*d0ef721eSBaptiste Daroussinbuiltin command.
49*d0ef721eSBaptiste Daroussin.Pp
50*d0ef721eSBaptiste DaroussinIf trying to read from the terminal results in end of file or an
51*d0ef721eSBaptiste Daroussinerror, the library signals end of file to the program and does not
52*d0ef721eSBaptiste Daroussinreturn a string.
53*d0ef721eSBaptiste Daroussin.Ss Input character bindings
54*d0ef721eSBaptiste DaroussinAll default bindings described below can be overridden by individual
55*d0ef721eSBaptiste Daroussinprograms and can be changed with the
56*d0ef721eSBaptiste Daroussin.Xr editrc 5
57*d0ef721eSBaptiste Daroussin.Ic bind
58*d0ef721eSBaptiste Daroussinbuiltin command.
59*d0ef721eSBaptiste Daroussin.Pp
60*d0ef721eSBaptiste DaroussinIn the following tables,
61*d0ef721eSBaptiste Daroussin.Sq Ctrl-
62*d0ef721eSBaptiste Daroussinindicates a character with the bit 0x40 flipped, and
63*d0ef721eSBaptiste Daroussin.Sq Meta-
64*d0ef721eSBaptiste Daroussinindicates a character with the bit 0x80 set.
65*d0ef721eSBaptiste DaroussinIn vi insert mode and in emacs mode, all Meta-characters considered
66*d0ef721eSBaptiste Daroussinprintable by the current
67*d0ef721eSBaptiste Daroussin.Xr locale 1
68*d0ef721eSBaptiste Daroussinare bound to
69*d0ef721eSBaptiste Daroussin.Ic ed-insert
70*d0ef721eSBaptiste Daroussininstead of to the editor command listed below.
71*d0ef721eSBaptiste DaroussinConsequently, in UTF-8 mode, most of the Meta-characters are not
72*d0ef721eSBaptiste Daroussindirectly accessible because their code points are occupied by
73*d0ef721eSBaptiste Daroussinprintable Unicode characters, and Meta-characters are usually input
74*d0ef721eSBaptiste Daroussinusing the
75*d0ef721eSBaptiste Daroussin.Ic em-meta-next
76*d0ef721eSBaptiste Daroussineditor command.
77*d0ef721eSBaptiste DaroussinFor example, to enter
78*d0ef721eSBaptiste Daroussin.Sq Meta-B
79*d0ef721eSBaptiste Daroussinin order to call the
80*d0ef721eSBaptiste Daroussin.Ic ed-prev-word
81*d0ef721eSBaptiste Daroussineditor command in emacs mode, call
82*d0ef721eSBaptiste Daroussin.Ic em-meta-next
83*d0ef721eSBaptiste Daroussinby pressing and releasing the escape key (or equivalently, Ctrl-[),
84*d0ef721eSBaptiste Daroussinthen press and release the
85*d0ef721eSBaptiste Daroussin.Sq B
86*d0ef721eSBaptiste Daroussinkey.
87*d0ef721eSBaptiste DaroussinIf you have configured a Meta-key on your keyboard, for example
88*d0ef721eSBaptiste Daroussinwith
89*d0ef721eSBaptiste Daroussin.Ql setxkbmap -option altwin:left_meta_win ,
90*d0ef721eSBaptiste Daroussinthe Ctrl-Meta-characters are directly accessible.
91*d0ef721eSBaptiste DaroussinFor example, to enter
92*d0ef721eSBaptiste Daroussin.Sq Ctrl-Meta-H
93*d0ef721eSBaptiste Daroussinin order to call the
94*d0ef721eSBaptiste Daroussin.Ic ed-delete-prev-word
95*d0ef721eSBaptiste Daroussineditor command in emacs mode, hold down the keys
96*d0ef721eSBaptiste Daroussin.Sq Ctrl ,
97*d0ef721eSBaptiste Daroussin.Sq Meta ,
98*d0ef721eSBaptiste Daroussinand
99*d0ef721eSBaptiste Daroussin.Sq H
100*d0ef721eSBaptiste Daroussinat the same time.
101*d0ef721eSBaptiste DaroussinAlternatively, press and release the escape key, then press and
102*d0ef721eSBaptiste Daroussinrelease
103*d0ef721eSBaptiste Daroussin.Sq Ctrl-H .
104*d0ef721eSBaptiste Daroussin.Pp
105*d0ef721eSBaptiste DaroussinIn vi input mode, input characters are bound to the following editor
106*d0ef721eSBaptiste Daroussincommands by default:
107*d0ef721eSBaptiste Daroussin.Bl -column -offset indent "Ctrl-Z, TSTP" "ed-search-next-history"
108*d0ef721eSBaptiste Daroussin.It Ctrl-D, EOF Ta Ic vi-list-or-eof
109*d0ef721eSBaptiste Daroussin.It Ctrl-H, BS Ta Ic vi-delete-prev-char
110*d0ef721eSBaptiste Daroussin.It Ctrl-J, LF Ta Ic ed-newline
111*d0ef721eSBaptiste Daroussin.It Ctrl-M, CR Ta Ic ed-newline
112*d0ef721eSBaptiste Daroussin.It Ctrl-Q Ta Ic ed-tty-start-output
113*d0ef721eSBaptiste Daroussin.It Ctrl-S Ta Ic ed-tty-stop-output
114*d0ef721eSBaptiste Daroussin.It Ctrl-U Ta Ic vi-kill-line-prev
115*d0ef721eSBaptiste Daroussin.It Ctrl-V Ta Ic ed-quoted-insert
116*d0ef721eSBaptiste Daroussin.It Ctrl-W Ta Ic ed-delete-prev-word
117*d0ef721eSBaptiste Daroussin.It Ctrl-[, ESC Ta Ic vi-command-mode
118*d0ef721eSBaptiste Daroussin.It Ctrl-\e, QUIT Ta Ic ed-tty-sigquit
119*d0ef721eSBaptiste Daroussin.It Ctrl-?, DEL Ta Ic vi-delete-prev-char
120*d0ef721eSBaptiste Daroussin.El
121*d0ef721eSBaptiste Daroussin.Pp
122*d0ef721eSBaptiste DaroussinAll other input characters except the NUL character (Ctrl-@) are
123*d0ef721eSBaptiste Daroussinbound to
124*d0ef721eSBaptiste Daroussin.Ic ed-insert .
125*d0ef721eSBaptiste Daroussin.Pp
126*d0ef721eSBaptiste DaroussinIn vi command mode, input characters are bound to the following
127*d0ef721eSBaptiste Daroussineditor commands by default:
128*d0ef721eSBaptiste Daroussin.Bl -column -offset indent "Ctrl-Z, TSTP" "ed-search-next-history"
129*d0ef721eSBaptiste Daroussin.It Ctrl-A Ta Ic ed-move-to-beg
130*d0ef721eSBaptiste Daroussin.It Ctrl-C, INT Ta Ic ed-tty-sigint
131*d0ef721eSBaptiste Daroussin.It Ctrl-E Ta Ic ed-move-to-end
132*d0ef721eSBaptiste Daroussin.It Ctrl-H, BS Ta Ic ed-delete-prev-char
133*d0ef721eSBaptiste Daroussin.It Ctrl-J, LF Ta Ic ed-newline
134*d0ef721eSBaptiste Daroussin.It Ctrl-K Ta Ic ed-kill-line
135*d0ef721eSBaptiste Daroussin.It Ctrl-L, FF Ta Ic ed-clear-screen
136*d0ef721eSBaptiste Daroussin.It Ctrl-M, CR Ta Ic ed-newline
137*d0ef721eSBaptiste Daroussin.It Ctrl-N Ta Ic ed-next-history
138*d0ef721eSBaptiste Daroussin.It Ctrl-O Ta Ic ed-tty-flush-output
139*d0ef721eSBaptiste Daroussin.It Ctrl-P Ta Ic ed-prev-history
140*d0ef721eSBaptiste Daroussin.It Ctrl-Q Ta Ic ed-tty-start-output
141*d0ef721eSBaptiste Daroussin.It Ctrl-R Ta Ic ed-redisplay
142*d0ef721eSBaptiste Daroussin.It Ctrl-S Ta Ic ed-tty-stop-output
143*d0ef721eSBaptiste Daroussin.It Ctrl-U Ta Ic vi-kill-line-prev
144*d0ef721eSBaptiste Daroussin.It Ctrl-W Ta Ic ed-delete-prev-word
145*d0ef721eSBaptiste Daroussin.It Ctrl-[, ESC Ta Ic em-meta-next
146*d0ef721eSBaptiste Daroussin.It Ctrl-\e, QUIT Ta Ic ed-tty-sigquit
147*d0ef721eSBaptiste Daroussin.It Space Ta Ic ed-next-char
148*d0ef721eSBaptiste Daroussin.It # Ta Ic vi-comment-out
149*d0ef721eSBaptiste Daroussin.It $ Ta Ic ed-move-to-end
150*d0ef721eSBaptiste Daroussin.It % Ta Ic vi-match
151*d0ef721eSBaptiste Daroussin.It + Ta Ic ed-next-history
152*d0ef721eSBaptiste Daroussin.It \&, Ta Ic vi-repeat-prev-char
153*d0ef721eSBaptiste Daroussin.It - Ta Ic ed-prev-history
154*d0ef721eSBaptiste Daroussin.It \&. Ta Ic vi-redo
155*d0ef721eSBaptiste Daroussin.It / Ta Ic vi-search-prev
156*d0ef721eSBaptiste Daroussin.It 0 Ta Ic vi-zero
157*d0ef721eSBaptiste Daroussin.It 1 to 9 Ta Ic ed-argument-digit
158*d0ef721eSBaptiste Daroussin.It \&: Ta Ic ed-command
159*d0ef721eSBaptiste Daroussin.It \&; Ta Ic vi-repeat-next-char
160*d0ef721eSBaptiste Daroussin.It \&? Ta Ic vi-search-next
161*d0ef721eSBaptiste Daroussin.It @ Ta Ic vi-alias
162*d0ef721eSBaptiste Daroussin.It A Ta Ic vi-add-at-eol
163*d0ef721eSBaptiste Daroussin.It B Ta Ic vi-prev-big-word
164*d0ef721eSBaptiste Daroussin.It C Ta Ic vi-change-to-eol
165*d0ef721eSBaptiste Daroussin.It D Ta Ic ed-kill-line
166*d0ef721eSBaptiste Daroussin.It E Ta Ic vi-end-big-word
167*d0ef721eSBaptiste Daroussin.It F Ta Ic vi-prev-char
168*d0ef721eSBaptiste Daroussin.It G Ta Ic vi-to-history-line
169*d0ef721eSBaptiste Daroussin.It I Ta Ic vi-insert-at-bol
170*d0ef721eSBaptiste Daroussin.It J Ta Ic ed-search-next-history
171*d0ef721eSBaptiste Daroussin.It K Ta Ic ed-search-prev-history
172*d0ef721eSBaptiste Daroussin.It N Ta Ic vi-repeat-search-prev
173*d0ef721eSBaptiste Daroussin.It O Ta Ic ed-sequence-lead-in
174*d0ef721eSBaptiste Daroussin.It P Ta Ic vi-paste-prev
175*d0ef721eSBaptiste Daroussin.It R Ta Ic vi-replace-mode
176*d0ef721eSBaptiste Daroussin.It S Ta Ic vi-substitute-line
177*d0ef721eSBaptiste Daroussin.It T Ta Ic vi-to-prev-char
178*d0ef721eSBaptiste Daroussin.It U Ta Ic vi-undo-line
179*d0ef721eSBaptiste Daroussin.It W Ta Ic vi-next-big-word
180*d0ef721eSBaptiste Daroussin.It X Ta Ic ed-delete-prev-char
181*d0ef721eSBaptiste Daroussin.It Y Ta Ic vi-yank-end
182*d0ef721eSBaptiste Daroussin.It \&[ Ta Ic ed-sequence-lead-in
183*d0ef721eSBaptiste Daroussin.It ^ Ta Ic ed-move-to-beg
184*d0ef721eSBaptiste Daroussin.It _ Ta Ic vi-history-word
185*d0ef721eSBaptiste Daroussin.It a Ta Ic vi-add
186*d0ef721eSBaptiste Daroussin.It b Ta Ic vi-prev-word
187*d0ef721eSBaptiste Daroussin.It c Ta Ic vi-change-meta
188*d0ef721eSBaptiste Daroussin.It d Ta Ic vi-delete-meta
189*d0ef721eSBaptiste Daroussin.It e Ta Ic vi-end-word
190*d0ef721eSBaptiste Daroussin.It f Ta Ic vi-next-char
191*d0ef721eSBaptiste Daroussin.It h Ta Ic ed-prev-char
192*d0ef721eSBaptiste Daroussin.It i Ta Ic vi-insert
193*d0ef721eSBaptiste Daroussin.It j Ta Ic ed-next-history
194*d0ef721eSBaptiste Daroussin.It k Ta Ic ed-prev-history
195*d0ef721eSBaptiste Daroussin.It l Ta Ic ed-next-char
196*d0ef721eSBaptiste Daroussin.It n Ta Ic vi-repeat-search-next
197*d0ef721eSBaptiste Daroussin.It p Ta Ic vi-paste-next
198*d0ef721eSBaptiste Daroussin.It r Ta Ic vi-replace-char
199*d0ef721eSBaptiste Daroussin.It s Ta Ic vi-substitute-char
200*d0ef721eSBaptiste Daroussin.It t Ta Ic vi-to-next-char
201*d0ef721eSBaptiste Daroussin.It u Ta Ic vi-undo
202*d0ef721eSBaptiste Daroussin.It v Ta Ic vi-histedit
203*d0ef721eSBaptiste Daroussin.It w Ta Ic vi-next-word
204*d0ef721eSBaptiste Daroussin.It x Ta Ic ed-delete-next-char
205*d0ef721eSBaptiste Daroussin.It y Ta Ic vi-yank
206*d0ef721eSBaptiste Daroussin.It \&| Ta Ic vi-to-column
207*d0ef721eSBaptiste Daroussin.It ~ Ta Ic vi-change-case
208*d0ef721eSBaptiste Daroussin.It Ctrl-?, DEL Ta Ic ed-delete-prev-char
209*d0ef721eSBaptiste Daroussin.It Meta-O Ta Ic ed-sequence-lead-in
210*d0ef721eSBaptiste Daroussin.It Meta-[ Ta Ic ed-sequence-lead-in
211*d0ef721eSBaptiste Daroussin.El
212*d0ef721eSBaptiste Daroussin.Pp
213*d0ef721eSBaptiste DaroussinIn emacs mode, input characters are bound to the following editor
214*d0ef721eSBaptiste Daroussincommands by default:
215*d0ef721eSBaptiste Daroussin.Bl -column -offset indent "Ctrl-Z, TSTP" "ed-search-next-history"
216*d0ef721eSBaptiste Daroussin.It 0 to 9 Ta Ic ed-digit
217*d0ef721eSBaptiste Daroussin.It Ctrl-@, NUL Ta Ic em-set-mark
218*d0ef721eSBaptiste Daroussin.It Ctrl-A Ta Ic ed-move-to-beg
219*d0ef721eSBaptiste Daroussin.It Ctrl-B Ta Ic ed-prev-char
220*d0ef721eSBaptiste Daroussin.It Ctrl-C, INT Ta Ic ed-tty-sigint
221*d0ef721eSBaptiste Daroussin.It Ctrl-D, EOF Ta Ic em-delete-or-list
222*d0ef721eSBaptiste Daroussin.It Ctrl-E Ta Ic ed-move-to-end
223*d0ef721eSBaptiste Daroussin.It Ctrl-F Ta Ic ed-next-char
224*d0ef721eSBaptiste Daroussin.It Ctrl-H, BS Ta Ic em-delete-prev-char
225*d0ef721eSBaptiste Daroussin.It Ctrl-J, LF Ta Ic ed-newline
226*d0ef721eSBaptiste Daroussin.It Ctrl-K Ta Ic ed-kill-line
227*d0ef721eSBaptiste Daroussin.It Ctrl-L, FF Ta Ic ed-clear-screen
228*d0ef721eSBaptiste Daroussin.It Ctrl-M, CR Ta Ic ed-newline
229*d0ef721eSBaptiste Daroussin.It Ctrl-N Ta Ic ed-next-history
230*d0ef721eSBaptiste Daroussin.It Ctrl-O Ta Ic ed-tty-flush-output
231*d0ef721eSBaptiste Daroussin.It Ctrl-P Ta Ic ed-prev-history
232*d0ef721eSBaptiste Daroussin.It Ctrl-Q Ta Ic ed-tty-start-output
233*d0ef721eSBaptiste Daroussin.It Ctrl-R Ta Ic ed-redisplay
234*d0ef721eSBaptiste Daroussin.It Ctrl-S Ta Ic ed-tty-stop-output
235*d0ef721eSBaptiste Daroussin.It Ctrl-T Ta Ic ed-transpose-chars
236*d0ef721eSBaptiste Daroussin.It Ctrl-U Ta Ic ed-kill-line
237*d0ef721eSBaptiste Daroussin.It Ctrl-V Ta Ic ed-quoted-insert
238*d0ef721eSBaptiste Daroussin.It Ctrl-W Ta Ic em-kill-region
239*d0ef721eSBaptiste Daroussin.It Ctrl-X Ta Ic ed-sequence-lead-in
240*d0ef721eSBaptiste Daroussin.It Ctrl-Y Ta Ic em-yank
241*d0ef721eSBaptiste Daroussin.It Ctrl-Z, TSTP Ta Ic ed-tty-sigtstp
242*d0ef721eSBaptiste Daroussin.It Ctrl-[, ESC Ta Ic em-meta-next
243*d0ef721eSBaptiste Daroussin.It Ctrl-\e, QUIT Ta Ic ed-tty-sigquit
244*d0ef721eSBaptiste Daroussin.It Ctrl-] Ta Ic ed-tty-dsusp
245*d0ef721eSBaptiste Daroussin.It Ctrl-?, DEL Ta Ic em-delete-prev-char
246*d0ef721eSBaptiste Daroussin.It Ctrl-Meta-H Ta Ic ed-delete-prev-word
247*d0ef721eSBaptiste Daroussin.It Ctrl-Meta-L Ta Ic ed-clear-screen
248*d0ef721eSBaptiste Daroussin.It Ctrl-Meta-_ Ta Ic em-copy-prev-word
249*d0ef721eSBaptiste Daroussin.It Meta-0 to 9 Ta Ic ed-argument-digit
250*d0ef721eSBaptiste Daroussin.It Meta-B Ta Ic ed-prev-word
251*d0ef721eSBaptiste Daroussin.It Meta-C Ta Ic em-capitol-case
252*d0ef721eSBaptiste Daroussin.It Meta-D Ta Ic em-delete-next-word
253*d0ef721eSBaptiste Daroussin.It Meta-F Ta Ic em-next-word
254*d0ef721eSBaptiste Daroussin.It Meta-L Ta Ic em-lower-case
255*d0ef721eSBaptiste Daroussin.It Meta-N Ta Ic ed-search-next-history
256*d0ef721eSBaptiste Daroussin.It Meta-O Ta Ic ed-sequence-lead-in
257*d0ef721eSBaptiste Daroussin.It Meta-P Ta Ic ed-search-prev-history
258*d0ef721eSBaptiste Daroussin.It Meta-U Ta Ic em-upper-case
259*d0ef721eSBaptiste Daroussin.It Meta-W Ta Ic em-copy-region
260*d0ef721eSBaptiste Daroussin.It Meta-X Ta Ic ed-command
261*d0ef721eSBaptiste Daroussin.It Meta-[ Ta Ic ed-sequence-lead-in
262*d0ef721eSBaptiste Daroussin.It Meta-b Ta Ic ed-prev-word
263*d0ef721eSBaptiste Daroussin.It Meta-c Ta Ic em-capitol-case
264*d0ef721eSBaptiste Daroussin.It Meta-d Ta Ic em-delete-next-word
265*d0ef721eSBaptiste Daroussin.It Meta-f Ta Ic em-next-word
266*d0ef721eSBaptiste Daroussin.It Meta-l Ta Ic em-lower-case
267*d0ef721eSBaptiste Daroussin.It Meta-n Ta Ic ed-search-next-history
268*d0ef721eSBaptiste Daroussin.It Meta-p Ta Ic ed-search-prev-history
269*d0ef721eSBaptiste Daroussin.It Meta-u Ta Ic em-upper-case
270*d0ef721eSBaptiste Daroussin.It Meta-w Ta Ic em-copy-region
271*d0ef721eSBaptiste Daroussin.It Meta-x Ta Ic ed-command
272*d0ef721eSBaptiste Daroussin.It Ctrl-Meta-? Ta Ic ed-delete-prev-word
273*d0ef721eSBaptiste Daroussin.El
274*d0ef721eSBaptiste Daroussin.Pp
275*d0ef721eSBaptiste DaroussinThe remaining
276*d0ef721eSBaptiste Daroussin.Xr ascii 7
277*d0ef721eSBaptiste Daroussincharacters in the range 0x20 to 0x7e are bound to
278*d0ef721eSBaptiste Daroussin.Ic ed-insert .
279*d0ef721eSBaptiste Daroussin.Pp
280*d0ef721eSBaptiste DaroussinIf standard output is not connected to a terminal device
281*d0ef721eSBaptiste Daroussinor
282*d0ef721eSBaptiste Daroussin.Xr el_set 3
283*d0ef721eSBaptiste Daroussinwas used to set
284*d0ef721eSBaptiste Daroussin.Dv EL_EDITMODE
285*d0ef721eSBaptiste Daroussinto 0, all input character bindings are disabled and all characters
286*d0ef721eSBaptiste Daroussintyped are appended to the edit buffer.
287*d0ef721eSBaptiste DaroussinIn that case, the edit buffer is returned to the program after a
288*d0ef721eSBaptiste Daroussinnewline or carriage return character is typed, or after the first
289*d0ef721eSBaptiste Daroussincharacter typed if
290*d0ef721eSBaptiste Daroussin.Xr el_set 3
291*d0ef721eSBaptiste Daroussinwas used to set
292*d0ef721eSBaptiste Daroussin.Dv EL_UNBUFFERED
293*d0ef721eSBaptiste Daroussinto non-zero.
294*d0ef721eSBaptiste Daroussin.Ss Editor commands
295*d0ef721eSBaptiste DaroussinMost editor commands accept an optional argument.
296*d0ef721eSBaptiste DaroussinThe argument is entered by prefixing the editor command with one
297*d0ef721eSBaptiste Daroussinor more of the editor commands
298*d0ef721eSBaptiste Daroussin.Ic ed-argument-digit ,
299*d0ef721eSBaptiste Daroussin.Ic ed-digit ,
300*d0ef721eSBaptiste Daroussin.Ic em-universal-argument ,
301*d0ef721eSBaptiste Daroussinor
302*d0ef721eSBaptiste Daroussin.Ic vi-zero .
303*d0ef721eSBaptiste DaroussinWhen an argument is not provided, it defaults to 1.
304*d0ef721eSBaptiste DaroussinFor most editor commands, the effect of an argument is to repeatedly
305*d0ef721eSBaptiste Daroussinexecute the command that number of times.
306*d0ef721eSBaptiste Daroussin.Pp
307*d0ef721eSBaptiste DaroussinWhen talking about a character string from a left character to a
308*d0ef721eSBaptiste Daroussinright character, the left character is included in the string, while
309*d0ef721eSBaptiste Daroussinthe right character is not included.
310*d0ef721eSBaptiste Daroussin.Pp
311*d0ef721eSBaptiste DaroussinIf an editor command causes an error, the input character is discarded,
312*d0ef721eSBaptiste Daroussinno action occurs, and the terminal bell is rung.
313*d0ef721eSBaptiste DaroussinIn case of a non-fatal error, the terminal bell is also rung,
314*d0ef721eSBaptiste Daroussinbut the editor command takes effect anyway.
315*d0ef721eSBaptiste Daroussin.Pp
316*d0ef721eSBaptiste DaroussinIn the following list, the default key bindings are listed after
317*d0ef721eSBaptiste Daroussineach editor command.
318*d0ef721eSBaptiste Daroussin.Bl -tag -width 4n
319*d0ef721eSBaptiste Daroussin.It Ic ed-argument-digit Pq vi command: 1 to 9; emacs: Meta-0 to Meta-9
320*d0ef721eSBaptiste DaroussinIf in argument input mode, append the input digit to the argument
321*d0ef721eSBaptiste Daroussinbeing read.
322*d0ef721eSBaptiste DaroussinOtherwise, switch to argument input mode and use the input digit
323*d0ef721eSBaptiste Daroussinas the most significant digit of the argument.
324*d0ef721eSBaptiste DaroussinIt is an error if the input character is not a digit or if the
325*d0ef721eSBaptiste Daroussinexisting argument is already greater than a million.
326*d0ef721eSBaptiste Daroussin.It Ic ed-clear-screen Pq vi command: Ctrl-L; emacs: Ctrl-L, Ctrl-Meta-L
327*d0ef721eSBaptiste DaroussinClear the screen and display the edit buffer at the top.
328*d0ef721eSBaptiste DaroussinIgnore any argument.
329*d0ef721eSBaptiste Daroussin.It Ic ed-command Pq vi command: So \&: Sc ; emacs: Meta-X, Meta-x
330*d0ef721eSBaptiste DaroussinRead a line from the terminal bypassing the normal line editing
331*d0ef721eSBaptiste Daroussinfunctionality and execute that line as an
332*d0ef721eSBaptiste Daroussin.Xr editrc 5
333*d0ef721eSBaptiste Daroussinbuiltin command.
334*d0ef721eSBaptiste DaroussinIf in vi command mode, also switch back to vi insert mode.
335*d0ef721eSBaptiste DaroussinIgnore any argument.
336*d0ef721eSBaptiste Daroussin.It Ic ed-delete-next-char Pq vi command: x
337*d0ef721eSBaptiste DaroussinDelete the character at the cursor position.
338*d0ef721eSBaptiste DaroussinWith an argument, delete that number of characters.
339*d0ef721eSBaptiste DaroussinIn emacs mode, it is an error if the cursor is at the end of the
340*d0ef721eSBaptiste Daroussinedit buffer.
341*d0ef721eSBaptiste DaroussinIn vi mode, the last character in the edit buffer is deleted in
342*d0ef721eSBaptiste Daroussinthat case, and it is an error if the buffer is empty.
343*d0ef721eSBaptiste Daroussin.It Ic ed-delete-prev-char Pq vi command: X, Ctrl-H, BS, Ctrl-?, DEL
344*d0ef721eSBaptiste DaroussinDelete the character to the left of the cursor position.
345*d0ef721eSBaptiste DaroussinWith an argument, delete that number of characters.
346*d0ef721eSBaptiste DaroussinIt is an error if the cursor is at the beginning of the edit buffer.
347*d0ef721eSBaptiste Daroussin.It Ic ed-delete-prev-word Pq vi: Ctrl-W; emacs: Ctrl-Meta-H, Ctrl-Meta-?
348*d0ef721eSBaptiste DaroussinMove to the left to the closest beginning of a word, delete the
349*d0ef721eSBaptiste Daroussinstring from that position to the cursor, and save it to the cut
350*d0ef721eSBaptiste Daroussinbuffer.
351*d0ef721eSBaptiste DaroussinWith an argument, delete that number of words.
352*d0ef721eSBaptiste DaroussinIt is an error if the cursor is at the beginning of the edit buffer.
353*d0ef721eSBaptiste Daroussin.It Ic ed-digit Pq emacs: 0 to 9
354*d0ef721eSBaptiste DaroussinIf in argument input mode, append the input digit to the argument
355*d0ef721eSBaptiste Daroussinbeing read.
356*d0ef721eSBaptiste DaroussinOtherwise, call
357*d0ef721eSBaptiste Daroussin.Ic ed-insert .
358*d0ef721eSBaptiste DaroussinIt is an error if the input character is not a digit or if the
359*d0ef721eSBaptiste Daroussinexisting argument is already greater than a million.
360*d0ef721eSBaptiste Daroussin.It Ic ed-end-of-file Pq not bound by default
361*d0ef721eSBaptiste DaroussinDiscard the edit buffer and indicate end of file to the program.
362*d0ef721eSBaptiste DaroussinIgnore any argument.
363*d0ef721eSBaptiste Daroussin.It Ic ed-ignore Pq various
364*d0ef721eSBaptiste DaroussinDiscard the input character and do nothing.
365*d0ef721eSBaptiste Daroussin.It Ic ed-insert Pq vi input: almost all; emacs: printable characters
366*d0ef721eSBaptiste DaroussinIn insert mode, insert the input character left of the cursor
367*d0ef721eSBaptiste Daroussinposition.
368*d0ef721eSBaptiste DaroussinIn replace mode, overwrite the character at the cursor and move the
369*d0ef721eSBaptiste Daroussincursor to the right by one character position.
370*d0ef721eSBaptiste DaroussinAccept an argument to do this repeatedly.
371*d0ef721eSBaptiste DaroussinIt is an error if the input character is the NUL character (Ctrl-@).
372*d0ef721eSBaptiste DaroussinFailure to enlarge the edit buffer also results in an error.
373*d0ef721eSBaptiste Daroussin.It Ic ed-kill-line Pq vi command: D, Ctrl-K; emacs: Ctrl-K, Ctrl-U
374*d0ef721eSBaptiste DaroussinDelete the string from the cursor position to the end of the line
375*d0ef721eSBaptiste Daroussinand save it to the cut buffer.
376*d0ef721eSBaptiste DaroussinIgnore any argument.
377*d0ef721eSBaptiste Daroussin.It Ic ed-move-to-beg Pq vi command: ^, Ctrl-A; emacs: Ctrl-A
378*d0ef721eSBaptiste DaroussinIn vi mode, move the cursor to the first non-space character in the
379*d0ef721eSBaptiste Daroussinedit buffer.
380*d0ef721eSBaptiste DaroussinIn emacs mode, move the cursor to the beginning of the edit buffer.
381*d0ef721eSBaptiste DaroussinIgnore any argument.
382*d0ef721eSBaptiste DaroussinCan be used as a movement command after
383*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
384*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
385*d0ef721eSBaptiste Daroussinor
386*d0ef721eSBaptiste Daroussin.Ic vi_yank .
387*d0ef721eSBaptiste Daroussin.It Ic ed-move-to-end Pq vi command: $, Ctrl-E; emacs: Ctrl-E
388*d0ef721eSBaptiste DaroussinMove the cursor to the end of the edit buffer.
389*d0ef721eSBaptiste DaroussinIgnore any argument.
390*d0ef721eSBaptiste DaroussinCan be used as a movement command after
391*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
392*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
393*d0ef721eSBaptiste Daroussinor
394*d0ef721eSBaptiste Daroussin.Ic vi_yank .
395*d0ef721eSBaptiste Daroussin.It Ic ed-newline Pq all modes: Ctrl-J, LF, Ctrl-M, CR
396*d0ef721eSBaptiste DaroussinAppend a newline character to the edit buffer and return the edit
397*d0ef721eSBaptiste Daroussinbuffer to the program.
398*d0ef721eSBaptiste DaroussinIgnore any argument.
399*d0ef721eSBaptiste Daroussin.It Ic ed-next-char Pq vi command: Space, l; emacs: Ctrl-F
400*d0ef721eSBaptiste DaroussinMove the cursor one character position to the right.
401*d0ef721eSBaptiste DaroussinWith an argument, move by that number of characters.
402*d0ef721eSBaptiste DaroussinCan be used as a movement command after
403*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
404*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
405*d0ef721eSBaptiste Daroussinor
406*d0ef721eSBaptiste Daroussin.Ic vi_yank .
407*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the end of the edit
408*d0ef721eSBaptiste Daroussinbuffer.
409*d0ef721eSBaptiste Daroussin.It Ic ed-next-history Pq vi command: j, +, Ctrl-N; emacs: Ctrl-N
410*d0ef721eSBaptiste DaroussinReplace the edit buffer with the next history line.
411*d0ef721eSBaptiste DaroussinThat line is older than the current line.
412*d0ef721eSBaptiste DaroussinWith an argument, go forward by that number of history lines.
413*d0ef721eSBaptiste DaroussinIt is a non-fatal error to advance by more lines than are available.
414*d0ef721eSBaptiste Daroussin.It Ic ed-next-line Pq not bound by default
415*d0ef721eSBaptiste DaroussinMove the cursor down one line.
416*d0ef721eSBaptiste DaroussinWith an argument, move down by that number of lines.
417*d0ef721eSBaptiste DaroussinIt is an error if the edit buffer does not contain enough newline
418*d0ef721eSBaptiste Daroussincharacters to the right of the cursor position.
419*d0ef721eSBaptiste Daroussin.It Ic ed-prev-char Pq vi command: h; emacs: Ctrl-B
420*d0ef721eSBaptiste DaroussinMove the cursor one character position to the left.
421*d0ef721eSBaptiste DaroussinWith an argument, move by that number of characters.
422*d0ef721eSBaptiste DaroussinCan be used as a movement command after
423*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
424*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
425*d0ef721eSBaptiste Daroussinor
426*d0ef721eSBaptiste Daroussin.Ic vi_yank .
427*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the beginning of the
428*d0ef721eSBaptiste Daroussinedit buffer.
429*d0ef721eSBaptiste Daroussin.It Ic ed-prev-history Pq vi command: k, -, Ctrl-P; emacs: Ctrl-P
430*d0ef721eSBaptiste DaroussinReplace the edit buffer with the previous history line.
431*d0ef721eSBaptiste DaroussinThat line is newer than the current line.
432*d0ef721eSBaptiste DaroussinWith an argument, go back by that number of lines.
433*d0ef721eSBaptiste DaroussinIt is a non-fatal error to back up by more lines than are available.
434*d0ef721eSBaptiste Daroussin.It Ic ed-prev-line Pq not bound by default
435*d0ef721eSBaptiste DaroussinMove the cursor up one line.
436*d0ef721eSBaptiste DaroussinWith an argument, move up by that number of lines.
437*d0ef721eSBaptiste DaroussinIt is an error if the edit buffer does not contain enough newline
438*d0ef721eSBaptiste Daroussincharacters to the left of the cursor position.
439*d0ef721eSBaptiste Daroussin.It Ic ed-prev-word Pq emacs: Meta-B, Meta-b
440*d0ef721eSBaptiste DaroussinMove the cursor to the left to the closest beginning of a word.
441*d0ef721eSBaptiste DaroussinWith an argument, repeat that number of times.
442*d0ef721eSBaptiste DaroussinCan be used as a movement command after
443*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
444*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
445*d0ef721eSBaptiste Daroussinor
446*d0ef721eSBaptiste Daroussin.Ic vi_yank .
447*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the beginning of the
448*d0ef721eSBaptiste Daroussinedit buffer.
449*d0ef721eSBaptiste Daroussin.It Ic ed-quoted-insert Pq vi insert, emacs: Ctrl-V
450*d0ef721eSBaptiste DaroussinRead one character from the terminal bypassing the normal line
451*d0ef721eSBaptiste Daroussinediting functionality and call
452*d0ef721eSBaptiste Daroussin.Ic ed-insert
453*d0ef721eSBaptiste Daroussinon it.
454*d0ef721eSBaptiste DaroussinIf trying to read the character returns end of file or an error,
455*d0ef721eSBaptiste Daroussincall
456*d0ef721eSBaptiste Daroussin.Ic ed-end-of-file
457*d0ef721eSBaptiste Daroussininstead.
458*d0ef721eSBaptiste Daroussin.It Ic ed-redisplay Pq vi command, emacs: Ctrl-R
459*d0ef721eSBaptiste DaroussinRedisplay everything.
460*d0ef721eSBaptiste DaroussinIgnore any argument.
461*d0ef721eSBaptiste Daroussin.It Ic ed-search-next-history Pq vi command: J; emacs: Meta-N, Meta-n
462*d0ef721eSBaptiste DaroussinReplace the edit buffer with the next matching history entry.
463*d0ef721eSBaptiste Daroussin.It Ic ed-search-prev-history Pq vi command: K; emacs: Meta-P, Meta-p
464*d0ef721eSBaptiste DaroussinReplace the edit buffer with the previous matching history entry.
465*d0ef721eSBaptiste Daroussin.It Ic ed-sequence-lead-in Pq vi cmd: O, \&[; emacs: Ctrl-X;\
466*d0ef721eSBaptiste Daroussin both: Meta-O, Meta-[
467*d0ef721eSBaptiste DaroussinCall a macro.
468*d0ef721eSBaptiste DaroussinSee the section about
469*d0ef721eSBaptiste Daroussin.Sx Macros
470*d0ef721eSBaptiste Daroussinbelow for details.
471*d0ef721eSBaptiste Daroussin.It Ic ed-start-over Pq not bound by default
472*d0ef721eSBaptiste DaroussinDiscard the contents of the edit buffer and start from scratch.
473*d0ef721eSBaptiste DaroussinIgnore any argument.
474*d0ef721eSBaptiste Daroussin.It Ic ed-transpose-chars Pq emacs: Ctrl-T
475*d0ef721eSBaptiste DaroussinExchange the character at the cursor position with the one to the
476*d0ef721eSBaptiste Daroussinleft of it and move the cursor to the character to the right of the
477*d0ef721eSBaptiste Daroussintwo exchanged characters.
478*d0ef721eSBaptiste DaroussinIgnore any argument.
479*d0ef721eSBaptiste DaroussinIt is an error if the cursor is at the beginning of the edit buffer
480*d0ef721eSBaptiste Daroussinor if the edit buffer contains less than two characters.
481*d0ef721eSBaptiste Daroussin.It Ic ed-unassigned Pq all characters not listed
482*d0ef721eSBaptiste DaroussinThis editor command always results in an error.
483*d0ef721eSBaptiste Daroussin.It Ic em-capitol-case Pq emacs: Meta-C, Meta-c
484*d0ef721eSBaptiste DaroussinCapitalize the string from the cursor to the end of the current
485*d0ef721eSBaptiste Daroussinword.
486*d0ef721eSBaptiste DaroussinThat is, if it contains at least one alphabetic character, convert
487*d0ef721eSBaptiste Daroussinthe first alphabetic character to upper case, and convert all
488*d0ef721eSBaptiste Daroussincharacters to the right of it to lower case.
489*d0ef721eSBaptiste DaroussinIn any case, move the cursor to the next character after the end
490*d0ef721eSBaptiste Daroussinof the current word.
491*d0ef721eSBaptiste Daroussin.It Ic em-copy-prev-word Pq emacs: Ctrl-Meta-_
492*d0ef721eSBaptiste DaroussinCopy the string from the beginning of the current word to the cursor
493*d0ef721eSBaptiste Daroussinand insert it to the left of the cursor.
494*d0ef721eSBaptiste DaroussinMove the cursor to the character after the inserted string.
495*d0ef721eSBaptiste DaroussinIt is an error if the cursor is at the beginning of the edit buffer.
496*d0ef721eSBaptiste Daroussin.It Ic em-copy-region Pq emacs: Meta-W, Meta-w
497*d0ef721eSBaptiste DaroussinCopy the string from the cursor to the mark to the cut buffer.
498*d0ef721eSBaptiste DaroussinIt is an error if the mark is not set.
499*d0ef721eSBaptiste Daroussin.It Ic em-delete-next-word Pq emacs: Meta-D, Meta-d
500*d0ef721eSBaptiste DaroussinDelete the string from the cursor to the end of the current word
501*d0ef721eSBaptiste Daroussinand save it to the cut buffer.
502*d0ef721eSBaptiste DaroussinIt is an error if the cursor is at the end of the edit buffer.
503*d0ef721eSBaptiste Daroussin.It Ic em-delete-or-list Pq emacs: Ctrl-D, EOF
504*d0ef721eSBaptiste DaroussinIf the cursor is not at the end of the line, delete the character
505*d0ef721eSBaptiste Daroussinat the cursor.
506*d0ef721eSBaptiste DaroussinIf the edit buffer is empty, indicate end of file to the program.
507*d0ef721eSBaptiste DaroussinIt is an error if the cursor is at the end of the edit buffer and
508*d0ef721eSBaptiste Daroussinthe edit buffer is not empty.
509*d0ef721eSBaptiste Daroussin.It Ic em-delete-prev-char Pq emacs: Ctrl-H, BS, Ctrl-?, DEL
510*d0ef721eSBaptiste DaroussinDelete the character to the left of the cursor.
511*d0ef721eSBaptiste DaroussinIt is an error if the cursor is at the beginning of the edit buffer.
512*d0ef721eSBaptiste Daroussin.It Ic em-exchange-mark Pq not bound by default
513*d0ef721eSBaptiste DaroussinExchange the cursor and the mark.
514*d0ef721eSBaptiste Daroussin.It Ic em-gosmacs-transpose Pq not bound by default
515*d0ef721eSBaptiste DaroussinExchange the two characters to the left of the cursor.
516*d0ef721eSBaptiste DaroussinIt is an error if the cursor is on the first or second character
517*d0ef721eSBaptiste Daroussinof the edit buffer.
518*d0ef721eSBaptiste Daroussin.It Ic em-inc-search-next Pq not bound by default
519*d0ef721eSBaptiste DaroussinEmacs incremental next search.
520*d0ef721eSBaptiste Daroussin.It Ic em-inc-search-prev Pq not bound by default
521*d0ef721eSBaptiste DaroussinEmacs incremental reverse search.
522*d0ef721eSBaptiste Daroussin.It Ic em-kill-line Pq not bound by default
523*d0ef721eSBaptiste DaroussinDelete the entire contents of the edit buffer and save it to the
524*d0ef721eSBaptiste Daroussincut buffer.
525*d0ef721eSBaptiste Daroussin.It Ic em-kill-region Pq emacs: Ctrl-W
526*d0ef721eSBaptiste DaroussinDelete the string from the cursor to the mark and save it to the
527*d0ef721eSBaptiste Daroussincut buffer.
528*d0ef721eSBaptiste DaroussinIt is an error if the mark is not set.
529*d0ef721eSBaptiste Daroussin.It Ic em-lower-case Pq emacs: Meta-L, Meta-l
530*d0ef721eSBaptiste DaroussinConvert the characters from the cursor to the end of the current
531*d0ef721eSBaptiste Daroussinword to lower case.
532*d0ef721eSBaptiste Daroussin.It Ic em-meta-next Pq vi command, emacs: Ctrl-[, ESC
533*d0ef721eSBaptiste DaroussinSet the bit 0x80 on the next character typed.
534*d0ef721eSBaptiste DaroussinUnless the resulting code point is printable, holding down the
535*d0ef721eSBaptiste Daroussin.Sq Meta-
536*d0ef721eSBaptiste Daroussinkey while typing that character is a simpler way to achieve the
537*d0ef721eSBaptiste Daroussinsame effect.
538*d0ef721eSBaptiste Daroussin.It Ic em-next-word Pq Meta-F, Meta-f
539*d0ef721eSBaptiste DaroussinMove the cursor to the end of the current word.
540*d0ef721eSBaptiste DaroussinCan be used as a movement command after
541*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
542*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
543*d0ef721eSBaptiste Daroussinor
544*d0ef721eSBaptiste Daroussin.Ic vi_yank .
545*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the end of the edit
546*d0ef721eSBaptiste Daroussinbuffer.
547*d0ef721eSBaptiste Daroussin.It Ic em-set-mark Pq emacs: Ctrl-Q, NUL
548*d0ef721eSBaptiste DaroussinSet the mark at the current cursor position.
549*d0ef721eSBaptiste Daroussin.It Ic em-toggle-overwrite Pq not bound by default
550*d0ef721eSBaptiste DaroussinSwitch from insert to overwrite mode or vice versa.
551*d0ef721eSBaptiste Daroussin.It Ic em-universal-argument Pq not bound by default
552*d0ef721eSBaptiste DaroussinIf in argument input mode, multiply the argument by 4.
553*d0ef721eSBaptiste DaroussinOtherwise, switch to argument input mode and set the argument to 4.
554*d0ef721eSBaptiste DaroussinIt is an error if the existing argument is already greater than a
555*d0ef721eSBaptiste Daroussinmillion.
556*d0ef721eSBaptiste Daroussin.It Ic em-upper-case Pq emacs: Meta-U, Meta-u
557*d0ef721eSBaptiste DaroussinConvert the characters from the cursor to the end of the current
558*d0ef721eSBaptiste Daroussinword to upper case.
559*d0ef721eSBaptiste Daroussin.It Ic em-yank Pq emacs: Ctrl-Y
560*d0ef721eSBaptiste DaroussinPaste the cut buffer to the left of the cursor.
561*d0ef721eSBaptiste Daroussin.It Ic vi-add Pq vi command: a
562*d0ef721eSBaptiste DaroussinSwitch to vi insert mode.
563*d0ef721eSBaptiste DaroussinUnless the cursor is already at the end of the edit buffer, move
564*d0ef721eSBaptiste Daroussinit one character position to the right.
565*d0ef721eSBaptiste Daroussin.It Ic vi-add-at-eol Pq vi command: A
566*d0ef721eSBaptiste DaroussinSwitch to vi insert mode and move the cursor to the end of the edit
567*d0ef721eSBaptiste Daroussinbuffer.
568*d0ef721eSBaptiste Daroussin.It Ic vi-alias Pq vi command: @
569*d0ef721eSBaptiste DaroussinIf an alias function was defined by calling the
570*d0ef721eSBaptiste Daroussin.Xr el_set 3
571*d0ef721eSBaptiste Daroussinor
572*d0ef721eSBaptiste Daroussin.Xr el_wset 3
573*d0ef721eSBaptiste Daroussinfunction with the argument
574*d0ef721eSBaptiste Daroussin.Dv EL_ALIAS_TEXT ,
575*d0ef721eSBaptiste Daroussinread one character from the terminal bypassing the normal line
576*d0ef721eSBaptiste Daroussinediting functionality, call the alias function passing the argument that was specified with
577*d0ef721eSBaptiste Daroussin.Dv EL_ALIAS_TEXT
578*d0ef721eSBaptiste Daroussinas the first argument and the character read, with an underscore
579*d0ef721eSBaptiste Daroussinprepended, as the second argument, and pass the string returned
580*d0ef721eSBaptiste Daroussinfrom the alias function to
581*d0ef721eSBaptiste Daroussin.Xr el_wpush 3 .
582*d0ef721eSBaptiste DaroussinIt is an error if no alias function is defined or if trying to read
583*d0ef721eSBaptiste Daroussinthe character results in end of file or an error.
584*d0ef721eSBaptiste Daroussin.It Ic vi-change-case Pq vi command: ~
585*d0ef721eSBaptiste DaroussinChange the case of the character at the cursor and move the cursor
586*d0ef721eSBaptiste Daroussinone character position to the right.
587*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the end of the edit
588*d0ef721eSBaptiste Daroussinbuffer.
589*d0ef721eSBaptiste Daroussin.It Ic vi-change-meta Pq vi command: c
590*d0ef721eSBaptiste DaroussinDelete the string from the cursor to the position specified by the
591*d0ef721eSBaptiste Daroussinfollowing movement command and save a copy of it to the cut buffer.
592*d0ef721eSBaptiste DaroussinWhen given twice in a row, instead delete the whole contents of the
593*d0ef721eSBaptiste Daroussinedit buffer and save a copy of it to the cut buffer.
594*d0ef721eSBaptiste DaroussinIn either case, switch to vi insert mode after that.
595*d0ef721eSBaptiste Daroussin.It Ic vi-change-to-eol Pq vi command: C
596*d0ef721eSBaptiste DaroussinDelete the string from the cursor position to the end of the line
597*d0ef721eSBaptiste Daroussinand save it to the cut buffer, then switch to vi insert mode.
598*d0ef721eSBaptiste Daroussin.It Ic vi-command-mode Pq vi insert: Ctrl-[, ESC
599*d0ef721eSBaptiste DaroussinDiscard pending actions and arguments and switch to vi command mode.
600*d0ef721eSBaptiste DaroussinUnless the cursor is already at the beginning of the edit buffer,
601*d0ef721eSBaptiste Daroussinmove it to the left by one character position.
602*d0ef721eSBaptiste Daroussin.It Ic vi-comment-out Pq vi command: #
603*d0ef721eSBaptiste DaroussinInsert a
604*d0ef721eSBaptiste Daroussin.Sq #
605*d0ef721eSBaptiste Daroussincharacter at the beginning of the edit buffer and return the edit
606*d0ef721eSBaptiste Daroussinbuffer to the program.
607*d0ef721eSBaptiste Daroussin.It Ic vi-delete-meta Pq vi command: d
608*d0ef721eSBaptiste DaroussinDelete the string from the cursor to the position specified by the
609*d0ef721eSBaptiste Daroussinfollowing movement command and save a copy of it to the cut buffer.
610*d0ef721eSBaptiste DaroussinWhen given twice in a row, instead delete the whole contents of the
611*d0ef721eSBaptiste Daroussinedit buffer and save a copy of it to the cut buffer.
612*d0ef721eSBaptiste Daroussin.It Ic vi-delete-prev-char Pq vi insert: Ctrl-H, BS, Ctrl-?, DEL
613*d0ef721eSBaptiste DaroussinDelete the character to the left of the cursor.
614*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the beginning of the
615*d0ef721eSBaptiste Daroussinedit buffer.
616*d0ef721eSBaptiste Daroussin.It Ic vi-end-big-word Pq vi command: E
617*d0ef721eSBaptiste DaroussinMove the cursor to the end of the current space delimited word.
618*d0ef721eSBaptiste DaroussinCan be used as a movement command after
619*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
620*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
621*d0ef721eSBaptiste Daroussinor
622*d0ef721eSBaptiste Daroussin.Ic vi_yank .
623*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the end of the edit
624*d0ef721eSBaptiste Daroussinbuffer.
625*d0ef721eSBaptiste Daroussin.It Ic vi-end-word Pq vi command: e
626*d0ef721eSBaptiste DaroussinMove the cursor to the end of the current word.
627*d0ef721eSBaptiste DaroussinCan be used as a movement command after
628*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
629*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
630*d0ef721eSBaptiste Daroussinor
631*d0ef721eSBaptiste Daroussin.Ic vi_yank .
632*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the end of the edit
633*d0ef721eSBaptiste Daroussinbuffer.
634*d0ef721eSBaptiste Daroussin.It Ic vi-history-word Pq vi command: _
635*d0ef721eSBaptiste DaroussinInsert the first word from the most recent history entry after the
636*d0ef721eSBaptiste Daroussincursor, move the cursor after to the character after the inserted
637*d0ef721eSBaptiste Daroussinword, and switch to vi insert mode.
638*d0ef721eSBaptiste DaroussinIt is an error if there is no history entry or the most recent
639*d0ef721eSBaptiste Daroussinhistory entry is empty.
640*d0ef721eSBaptiste Daroussin.It Ic vi-insert Pq vi command: i
641*d0ef721eSBaptiste DaroussinEnter insert mode.
642*d0ef721eSBaptiste Daroussin.It Ic vi-insert-at-bol Pq vi command: I
643*d0ef721eSBaptiste DaroussinMove the cursor to the beginning of the edit buffer and switch to
644*d0ef721eSBaptiste Daroussinvi insert mode.
645*d0ef721eSBaptiste Daroussin.It Ic vi-kill-line-prev Pq vi: Ctrl-U
646*d0ef721eSBaptiste DaroussinDelete the string from the beginning of the edit buffer to the
647*d0ef721eSBaptiste Daroussincursor and save it to the cut buffer.
648*d0ef721eSBaptiste Daroussin.It Ic vi-list-or-eof Pq vi insert: Ctrl-D, EOF
649*d0ef721eSBaptiste DaroussinIf the edit buffer is empty, indicate end of file to the program.
650*d0ef721eSBaptiste DaroussinIt is an error if the edit buffer is not empty.
651*d0ef721eSBaptiste Daroussin.It Ic vi-match Pq vi command: %
652*d0ef721eSBaptiste DaroussinConsider opening and closing parentheses, braces, and brackets as
653*d0ef721eSBaptiste Daroussindelimiters.
654*d0ef721eSBaptiste DaroussinIf the cursor is not at a delimiter, move it to the right until it
655*d0ef721eSBaptiste Daroussingets to one, then move it to the matching delimiter.
656*d0ef721eSBaptiste DaroussinCan be used as a movement command after
657*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
658*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
659*d0ef721eSBaptiste Daroussinor
660*d0ef721eSBaptiste Daroussin.Ic vi_yank .
661*d0ef721eSBaptiste DaroussinIt is an error if there is no delimiter at the cursor or in the
662*d0ef721eSBaptiste Daroussinstring to the right of the cursor, or if the first such delimiter
663*d0ef721eSBaptiste Daroussinhas no matching delimiter.
664*d0ef721eSBaptiste Daroussin.It Ic vi-next-big-word Pq vi command: W
665*d0ef721eSBaptiste DaroussinMove the cursor to the right to the beginning of the next space
666*d0ef721eSBaptiste Daroussindelimited word.
667*d0ef721eSBaptiste DaroussinCan be used as a movement command after
668*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
669*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
670*d0ef721eSBaptiste Daroussinor
671*d0ef721eSBaptiste Daroussin.Ic vi_yank .
672*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the end of the edit
673*d0ef721eSBaptiste Daroussinbuffer or on its last character.
674*d0ef721eSBaptiste Daroussin.It Ic vi-next-char Pq vi command: f
675*d0ef721eSBaptiste DaroussinRead one character from the terminal bypassing the normal line
676*d0ef721eSBaptiste Daroussinediting functionality and move the cursor to the right to the next
677*d0ef721eSBaptiste Daroussininstance of that character in the edit buffer.
678*d0ef721eSBaptiste DaroussinCan be used as a movement command after
679*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
680*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
681*d0ef721eSBaptiste Daroussinor
682*d0ef721eSBaptiste Daroussin.Ic vi_yank .
683*d0ef721eSBaptiste DaroussinIf trying to read the character results in end of file or an error,
684*d0ef721eSBaptiste Daroussincall
685*d0ef721eSBaptiste Daroussin.Ic ed-end-of-file
686*d0ef721eSBaptiste Daroussininstead.
687*d0ef721eSBaptiste DaroussinIt is an error if the character is not found searching to the right
688*d0ef721eSBaptiste Daroussinin the edit buffer.
689*d0ef721eSBaptiste Daroussin.It Ic vi-next-word Pq vi command: w
690*d0ef721eSBaptiste DaroussinMove the cursor to the right to the beginning of the next word.
691*d0ef721eSBaptiste DaroussinCan be used as a movement command after
692*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
693*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
694*d0ef721eSBaptiste Daroussinor
695*d0ef721eSBaptiste Daroussin.Ic vi_yank .
696*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the end of the edit
697*d0ef721eSBaptiste Daroussinbuffer or on its last character.
698*d0ef721eSBaptiste Daroussin.It Ic vi-paste-next Pq vi command: p
699*d0ef721eSBaptiste DaroussinInsert a copy of the cut buffer to the right of the cursor.
700*d0ef721eSBaptiste DaroussinIt is an error if the cut buffer is empty.
701*d0ef721eSBaptiste Daroussin.It Ic vi-paste-prev Pq vi command: P
702*d0ef721eSBaptiste DaroussinInsert a copy of the cut buffer to the left of the cursor.
703*d0ef721eSBaptiste DaroussinIt is an error if the cut buffer is empty.
704*d0ef721eSBaptiste Daroussin.It Ic vi-prev-big-word Pq vi command: B
705*d0ef721eSBaptiste DaroussinMove the cursor to the left to the next beginning of a space delimited
706*d0ef721eSBaptiste Daroussinword.
707*d0ef721eSBaptiste DaroussinCan be used as a movement command after
708*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
709*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
710*d0ef721eSBaptiste Daroussinor
711*d0ef721eSBaptiste Daroussin.Ic vi_yank .
712*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the beginning of the
713*d0ef721eSBaptiste Daroussinedit buffer.
714*d0ef721eSBaptiste Daroussin.It Ic vi-prev-char Pq vi command: F
715*d0ef721eSBaptiste DaroussinRead one character from the terminal bypassing the normal line
716*d0ef721eSBaptiste Daroussinediting functionality and move the cursor to the left to the next
717*d0ef721eSBaptiste Daroussininstance of that character in the edit buffer.
718*d0ef721eSBaptiste DaroussinCan be used as a movement command after
719*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
720*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
721*d0ef721eSBaptiste Daroussinor
722*d0ef721eSBaptiste Daroussin.Ic vi_yank .
723*d0ef721eSBaptiste DaroussinIf trying to read the character results in end of file or an error,
724*d0ef721eSBaptiste Daroussincall
725*d0ef721eSBaptiste Daroussin.Ic ed-end-of-file
726*d0ef721eSBaptiste Daroussininstead.
727*d0ef721eSBaptiste DaroussinIt is an error if the character is not found searching to the left
728*d0ef721eSBaptiste Daroussinin the edit buffer.
729*d0ef721eSBaptiste Daroussin.It Ic vi-prev-word Pq vi command: b
730*d0ef721eSBaptiste DaroussinMove the cursor to the left to the next beginning of a word.
731*d0ef721eSBaptiste DaroussinCan be used as a movement command after
732*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
733*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
734*d0ef721eSBaptiste Daroussinor
735*d0ef721eSBaptiste Daroussin.Ic vi_yank .
736*d0ef721eSBaptiste DaroussinIt is an error if the cursor is already at the beginning of the
737*d0ef721eSBaptiste Daroussinedit buffer.
738*d0ef721eSBaptiste Daroussin.It Ic vi-redo Pq vi command: Sq \&.
739*d0ef721eSBaptiste DaroussinRedo the last non-motion command.
740*d0ef721eSBaptiste Daroussin.It Ic vi-repeat-next-char Pq vi command: Sq \&;
741*d0ef721eSBaptiste DaroussinRepeat the most recent character search in the same search direction.
742*d0ef721eSBaptiste DaroussinCan be used as a movement command after
743*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
744*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
745*d0ef721eSBaptiste Daroussinor
746*d0ef721eSBaptiste Daroussin.Ic vi_yank .
747*d0ef721eSBaptiste Daroussin.It Ic vi-repeat-prev-char Pq vi command: Sq \&,
748*d0ef721eSBaptiste DaroussinRepeat the most recent character search in the opposite search
749*d0ef721eSBaptiste Daroussindirection.
750*d0ef721eSBaptiste DaroussinCan be used as a movement command after
751*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
752*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
753*d0ef721eSBaptiste Daroussinor
754*d0ef721eSBaptiste Daroussin.Ic vi_yank .
755*d0ef721eSBaptiste Daroussin.It Ic vi-repeat-search-next Pq vi command: n
756*d0ef721eSBaptiste DaroussinRepeat the most recent history search in the same search direction.
757*d0ef721eSBaptiste Daroussin.It Ic vi-repeat-search-prev Pq vi command: N
758*d0ef721eSBaptiste DaroussinRepeat the most recent history search in the opposite search
759*d0ef721eSBaptiste Daroussindirection.
760*d0ef721eSBaptiste Daroussin.It Ic vi-replace-char Pq vi command: r
761*d0ef721eSBaptiste DaroussinSwitch to vi replace mode, and automatically switch back to vi
762*d0ef721eSBaptiste Daroussincommand mode after the next character typed.
763*d0ef721eSBaptiste DaroussinSee
764*d0ef721eSBaptiste Daroussin.Ic ed-insert
765*d0ef721eSBaptiste Daroussinfor a description of replace mode.
766*d0ef721eSBaptiste DaroussinIt is an error if the cursor is at the end of the edit buffer.
767*d0ef721eSBaptiste Daroussin.It Ic vi-replace-mode Pq vi command: R
768*d0ef721eSBaptiste DaroussinSwitch to vi replace mode.
769*d0ef721eSBaptiste DaroussinThis is a variant of vi insert mode; see
770*d0ef721eSBaptiste Daroussin.Ic ed-insert
771*d0ef721eSBaptiste Daroussinfor the difference.
772*d0ef721eSBaptiste Daroussin.It Ic vi-search-next Pq vi command: \&?
773*d0ef721eSBaptiste DaroussinReplace the edit buffer with the next matching history entry.
774*d0ef721eSBaptiste Daroussin.It Ic vi-search-prev Pq vi command: /
775*d0ef721eSBaptiste DaroussinReplace the edit buffer with the previous matching history entry.
776*d0ef721eSBaptiste Daroussin.It Ic vi-substitute-char Pq vi command: s
777*d0ef721eSBaptiste DaroussinDelete the character at the cursor and switch to vi insert mode.
778*d0ef721eSBaptiste Daroussin.It Ic vi-substitute-line Pq vi command: S
779*d0ef721eSBaptiste DaroussinDelete the entire contents of the edit buffer, save a copy of it
780*d0ef721eSBaptiste Daroussinin the cut buffer, and enter vi insert mode.
781*d0ef721eSBaptiste Daroussin.It Ic vi-to-column Pq vi command: \&|
782*d0ef721eSBaptiste DaroussinMove the cursor to the column specified as the argument.
783*d0ef721eSBaptiste DaroussinCan be used as a movement command after
784*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
785*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
786*d0ef721eSBaptiste Daroussinor
787*d0ef721eSBaptiste Daroussin.Ic vi_yank .
788*d0ef721eSBaptiste Daroussin.It Ic vi-to-history-line Pq vi command: G
789*d0ef721eSBaptiste DaroussinReplace the edit buffer with the specified history entry.
790*d0ef721eSBaptiste Daroussin.It Ic vi-to-next-char Pq vi command: t
791*d0ef721eSBaptiste DaroussinRead one character from the terminal bypassing the normal line
792*d0ef721eSBaptiste Daroussinediting functionality and move the cursor to the right to the
793*d0ef721eSBaptiste Daroussincharacter before the next instance of that character in the edit
794*d0ef721eSBaptiste Daroussinbuffer.
795*d0ef721eSBaptiste DaroussinCan be used as a movement command after
796*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
797*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
798*d0ef721eSBaptiste Daroussinor
799*d0ef721eSBaptiste Daroussin.Ic vi_yank .
800*d0ef721eSBaptiste DaroussinIf trying to read the character results in end of file or an error,
801*d0ef721eSBaptiste Daroussincall
802*d0ef721eSBaptiste Daroussin.Ic ed-end-of-file
803*d0ef721eSBaptiste Daroussininstead.
804*d0ef721eSBaptiste DaroussinIt is an error if the character is not found searching to the right
805*d0ef721eSBaptiste Daroussinin the edit buffer.
806*d0ef721eSBaptiste Daroussin.It Ic vi-to-prev-char Pq vi command: T
807*d0ef721eSBaptiste DaroussinRead one character from the terminal bypassing the normal line
808*d0ef721eSBaptiste Daroussinediting functionality and move the cursor to the left to the character
809*d0ef721eSBaptiste Daroussinafter the next instance of that character in the edit buffer.
810*d0ef721eSBaptiste DaroussinCan be used as a movement command after
811*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
812*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
813*d0ef721eSBaptiste Daroussinor
814*d0ef721eSBaptiste Daroussin.Ic vi_yank .
815*d0ef721eSBaptiste DaroussinIf trying to read the character results in end of file or an error,
816*d0ef721eSBaptiste Daroussincall
817*d0ef721eSBaptiste Daroussin.Ic ed-end-of-file
818*d0ef721eSBaptiste Daroussininstead.
819*d0ef721eSBaptiste DaroussinIt is an error if the character is not found searching to the left
820*d0ef721eSBaptiste Daroussinin the edit buffer.
821*d0ef721eSBaptiste Daroussin.It Ic vi-undo Pq vi command: u
822*d0ef721eSBaptiste DaroussinUndo the last change.
823*d0ef721eSBaptiste Daroussin.It Ic vi-undo-line Pq vi command: U
824*d0ef721eSBaptiste DaroussinUndo all changes to the edit buffer.
825*d0ef721eSBaptiste Daroussin.It Ic vi-yank Pq vi command: y
826*d0ef721eSBaptiste DaroussinCopy the string from the cursor to the position specified by the
827*d0ef721eSBaptiste Daroussinfollowing movement command to the cut buffer.
828*d0ef721eSBaptiste DaroussinWhen given twice in a row, instead copy the whole contents of the
829*d0ef721eSBaptiste Daroussinedit buffer to the cut buffer.
830*d0ef721eSBaptiste Daroussin.It Ic vi-yank-end Pq vi command: Y
831*d0ef721eSBaptiste DaroussinCopy the string from the cursor to the end of the edit buffer to
832*d0ef721eSBaptiste Daroussinthe cut buffer.
833*d0ef721eSBaptiste Daroussin.It Ic vi-zero Pq vi command: 0
834*d0ef721eSBaptiste DaroussinIf in argument input mode, multiply the argument by ten.
835*d0ef721eSBaptiste DaroussinOtherwise, move the cursor to the beginning of the edit buffer.
836*d0ef721eSBaptiste DaroussinCan be used as a movement command after
837*d0ef721eSBaptiste Daroussin.Ic vi_change_meta ,
838*d0ef721eSBaptiste Daroussin.Ic vi_delete_meta ,
839*d0ef721eSBaptiste Daroussinor
840*d0ef721eSBaptiste Daroussin.Ic vi_yank .
841*d0ef721eSBaptiste Daroussin.El
842*d0ef721eSBaptiste Daroussin.Ss Macros
843*d0ef721eSBaptiste DaroussinIf an input character is bound to the editor command
844*d0ef721eSBaptiste Daroussin.Ic ed-sequence-lead-in ,
845*d0ef721eSBaptiste Daroussin.Nm
846*d0ef721eSBaptiste Daroussinattempts to call a macro.
847*d0ef721eSBaptiste DaroussinIf the input character by itself forms the name of a macro, that
848*d0ef721eSBaptiste Daroussinmacro is executed.
849*d0ef721eSBaptiste DaroussinOtherwise, additional input characters are read until the string
850*d0ef721eSBaptiste Daroussinread forms the name of a macro, in which case that macro is executed,
851*d0ef721eSBaptiste Daroussinor until the string read matches the beginning of none of the existing
852*d0ef721eSBaptiste Daroussinmacro names, in which case the string including the final, mismatching
853*d0ef721eSBaptiste Daroussincharacter is discarded and the terminal bell is rung.
854*d0ef721eSBaptiste Daroussin.Pp
855*d0ef721eSBaptiste DaroussinThere are two kinds of macros.
856*d0ef721eSBaptiste DaroussinCommand macros execute a single editor command.
857*d0ef721eSBaptiste DaroussinKeyboard macros return a string of characters that is appended
858*d0ef721eSBaptiste Daroussinas a new line to the
859*d0ef721eSBaptiste Daroussin.Sx Input Queue .
860*d0ef721eSBaptiste Daroussin.Pp
861*d0ef721eSBaptiste DaroussinThe following command macros are defined by default in vi command
862*d0ef721eSBaptiste Daroussinmode and in emacs mode:
863*d0ef721eSBaptiste Daroussin.Bl -column -offset indent "Esc O A, Esc O A" "em-exchange-mark"
864*d0ef721eSBaptiste Daroussin.It Esc \&[ A, Esc O A Ta Ic ed-prev-history
865*d0ef721eSBaptiste Daroussin.It Esc \&[ B, Esc O B Ta Ic ed-next-history
866*d0ef721eSBaptiste Daroussin.It Esc \&[ C, Esc O C Ta Ic ed-next-char
867*d0ef721eSBaptiste Daroussin.It Esc \&[ D, Esc O D Ta Ic ed-prev-char
868*d0ef721eSBaptiste Daroussin.It Esc \&[ F, Esc O F Ta Ic ed-move-to-end
869*d0ef721eSBaptiste Daroussin.It Esc \&[ H, Esc O H Ta Ic ed-move-to-beg
870*d0ef721eSBaptiste Daroussin.El
871*d0ef721eSBaptiste Daroussin.Pp
872*d0ef721eSBaptiste DaroussinIn vi command mode, they are also defined by default without the
873*d0ef721eSBaptiste Daroussininitial escape character.
874*d0ef721eSBaptiste Daroussin.Pp
875*d0ef721eSBaptiste DaroussinIn addition, the
876*d0ef721eSBaptiste Daroussin.Nm
877*d0ef721eSBaptiste Daroussinlibrary tries to bind the strings generated by the arrow keys
878*d0ef721eSBaptiste Daroussinas reported by the
879*d0ef721eSBaptiste Daroussin.Xr terminfo 5
880*d0ef721eSBaptiste Daroussindatabase to these editor commands, unless that would clobber
881*d0ef721eSBaptiste Daroussinuser settings.
882*d0ef721eSBaptiste Daroussin.Pp
883*d0ef721eSBaptiste DaroussinIn emacs mode, the two-character string
884*d0ef721eSBaptiste Daroussin.Dq Ctrl-X Ctrl-X
885*d0ef721eSBaptiste Daroussinis bound to the
886*d0ef721eSBaptiste Daroussin.Ic em-exchange-mark
887*d0ef721eSBaptiste Daroussineditor command.
888*d0ef721eSBaptiste Daroussin.Ss Input Queue
889*d0ef721eSBaptiste DaroussinThe
890*d0ef721eSBaptiste Daroussin.Nm
891*d0ef721eSBaptiste Daroussinlibrary maintains an input queue operated in FIFO mode.
892*d0ef721eSBaptiste DaroussinWhenever it needs an input character, it takes the first character
893*d0ef721eSBaptiste Daroussinfrom the first line of the input queue.
894*d0ef721eSBaptiste DaroussinWhen the queue is empty, it reads from the terminal.
895*d0ef721eSBaptiste Daroussin.Pp
896*d0ef721eSBaptiste DaroussinA line can be appended to the end of the input queue in several ways:
897*d0ef721eSBaptiste Daroussin.Bl -dash -offset indent
898*d0ef721eSBaptiste Daroussin.It
899*d0ef721eSBaptiste DaroussinBy calling one of the keyboard
900*d0ef721eSBaptiste Daroussin.Sx Macros .
901*d0ef721eSBaptiste Daroussin.It
902*d0ef721eSBaptiste DaroussinBy calling the editor command
903*d0ef721eSBaptiste Daroussin.Ic vi-redo .
904*d0ef721eSBaptiste Daroussin.It
905*d0ef721eSBaptiste DaroussinBy calling the editor command
906*d0ef721eSBaptiste Daroussin.Ic vi-alias .
907*d0ef721eSBaptiste Daroussin.It
908*d0ef721eSBaptiste DaroussinBy pressing a key in emacs incremental search mode that doesn't
909*d0ef721eSBaptiste Daroussinhave a special meaning in that mode but returns to normal emacs
910*d0ef721eSBaptiste Daroussinmode.
911*d0ef721eSBaptiste Daroussin.It
912*d0ef721eSBaptiste DaroussinIf an application program directly calls the functions
913*d0ef721eSBaptiste Daroussin.Xr el_push 3
914*d0ef721eSBaptiste Daroussinor
915*d0ef721eSBaptiste Daroussin.Xr el_wpush 3 ,
916*d0ef721eSBaptiste Daroussinit can provide additional, program-specific ways
917*d0ef721eSBaptiste Daroussinof appending to the input queue.
918*d0ef721eSBaptiste Daroussin.El
919*d0ef721eSBaptiste Daroussin.Sh SEE ALSO
920*d0ef721eSBaptiste Daroussin.Xr mg 1 ,
921*d0ef721eSBaptiste Daroussin.Xr vi 1 ,
922*d0ef721eSBaptiste Daroussin.Xr editline 3 ,
923*d0ef721eSBaptiste Daroussin.Xr el_wgets 3 ,
924*d0ef721eSBaptiste Daroussin.Xr el_wpush 3 ,
925*d0ef721eSBaptiste Daroussin.Xr el_wset 3 ,
926*d0ef721eSBaptiste Daroussin.Xr editrc 5
927*d0ef721eSBaptiste Daroussin.Sh HISTORY
928*d0ef721eSBaptiste DaroussinThis manual page first appeared in
929*d0ef721eSBaptiste Daroussin.Ox 6.0
930*d0ef721eSBaptiste Daroussinand
931*d0ef721eSBaptiste Daroussin.Nx 8 .
932*d0ef721eSBaptiste Daroussin.Sh AUTHORS
933*d0ef721eSBaptiste Daroussin.An -nosplit
934*d0ef721eSBaptiste DaroussinThis manual page was written by
935*d0ef721eSBaptiste Daroussin.An Ingo Schwarze Aq Mt schwarze@openbsd.org .
936