xref: /openbsd/lib/libedit/editline.7 (revision 47f0686a)
1*47f0686aSschwarze.\"	$OpenBSD: editline.7,v 1.2 2016/05/10 11:07:53 schwarze Exp $
2081fbbfbSschwarze.\"
3081fbbfbSschwarze.\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
4081fbbfbSschwarze.\"
5081fbbfbSschwarze.\" Permission to use, copy, modify, and distribute this software for any
6081fbbfbSschwarze.\" purpose with or without fee is hereby granted, provided that the above
7081fbbfbSschwarze.\" copyright notice and this permission notice appear in all copies.
8081fbbfbSschwarze.\"
9081fbbfbSschwarze.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10081fbbfbSschwarze.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11081fbbfbSschwarze.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12081fbbfbSschwarze.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13081fbbfbSschwarze.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14081fbbfbSschwarze.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15081fbbfbSschwarze.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16081fbbfbSschwarze.\"
17*47f0686aSschwarze.Dd $Mdocdate: May 10 2016 $
18081fbbfbSschwarze.Dt EDITLINE 7
19081fbbfbSschwarze.Os
20081fbbfbSschwarze.Sh NAME
21081fbbfbSschwarze.Nm editline
22081fbbfbSschwarze.Nd line editing user interface
23081fbbfbSschwarze.Sh DESCRIPTION
24081fbbfbSschwarzeWhen a program using the
25081fbbfbSschwarze.Xr editline 3
26081fbbfbSschwarzelibrary prompts for an input string using the function
27081fbbfbSschwarze.Xr el_wgets 3 ,
28081fbbfbSschwarzeit reads characters from the terminal.
29081fbbfbSschwarzeInvalid input bytes that do not form characters are silently
30081fbbfbSschwarzediscarded.
31081fbbfbSschwarzeFor each character read, one editor command is executed.
32081fbbfbSschwarzeThe mapping of input characters to editor commands depends on the
33081fbbfbSschwarzeediting mode.
34081fbbfbSschwarzeThere are three editing modes:  vi insert mode, vi command mode,
35081fbbfbSschwarzeand emacs mode.
36081fbbfbSschwarzeThe default is vi insert mode.
37081fbbfbSschwarzeThe program can switch the default to emacs mode by using the
38081fbbfbSschwarze.Xr el_set 3
39081fbbfbSschwarzeor
40081fbbfbSschwarze.Xr el_parse 3
41081fbbfbSschwarzefunctions, and the user can switch to emacs mode either in the
42081fbbfbSschwarze.Xr editrc 5
43081fbbfbSschwarzeconfiguration file or interactively with the
44081fbbfbSschwarze.Ic ed-command
45081fbbfbSschwarzeeditor command, in all three cases executing the
46081fbbfbSschwarze.Ic bind Fl e
47081fbbfbSschwarzebuiltin command.
48081fbbfbSschwarze.Pp
49081fbbfbSschwarzeIf trying to read from the terminal results in end of file or an
50081fbbfbSschwarzeerror, the library signals end of file to the program and does not
51081fbbfbSschwarzereturn a string.
52081fbbfbSschwarze.Ss Input character bindings
53081fbbfbSschwarzeAll default bindings described below can be overridden by individual
54081fbbfbSschwarzeprograms and can be changed with the
55081fbbfbSschwarze.Xr editrc 5
56081fbbfbSschwarze.Ic bind
57081fbbfbSschwarzebuiltin command.
58081fbbfbSschwarze.Pp
59081fbbfbSschwarzeIn the following tables,
60081fbbfbSschwarze.Sq Ctrl-
61081fbbfbSschwarzeindicates a character with the bit 0x40 flipped, and
62081fbbfbSschwarze.Sq Meta-
63081fbbfbSschwarzeindicates a character with the bit 0x80 set.
64081fbbfbSschwarzeIn vi insert mode and in emacs mode, all Meta-characters considered
65081fbbfbSschwarzeprintable by the current
66081fbbfbSschwarze.Xr locale 1
67081fbbfbSschwarzeare bound to
68081fbbfbSschwarze.Ic ed-insert
69081fbbfbSschwarzeinstead of to the editor command listed below.
70081fbbfbSschwarzeConsequently, in UTF-8 mode, most of the Meta-characters are not
71081fbbfbSschwarzedirectly accessible because their code points are occupied by
72081fbbfbSschwarzeprintable Unicode characters, and Meta-characters are usually input
73081fbbfbSschwarzeusing the
74081fbbfbSschwarze.Ic em-meta-next
75081fbbfbSschwarzeeditor command.
76081fbbfbSschwarzeFor example, to enter
77081fbbfbSschwarze.Sq Meta-B
78081fbbfbSschwarzein order to call the
79081fbbfbSschwarze.Ic ed-prev-word
80081fbbfbSschwarzeeditor command in emacs mode, call
81081fbbfbSschwarze.Ic em-meta-next
82081fbbfbSschwarzeby pressing and releasing the escape key (or equivalently, Ctrl-[),
83081fbbfbSschwarzethen press and release the
84081fbbfbSschwarze.Sq B
85081fbbfbSschwarzekey.
86081fbbfbSschwarzeIf you have configured a Meta-key on your keyboard, for example
87081fbbfbSschwarzewith
88081fbbfbSschwarze.Ql setxkbmap -option altwin:left_meta_win ,
89081fbbfbSschwarzethe Ctrl-Meta-characters are directly accessible.
90081fbbfbSschwarzeFor example, to enter
91081fbbfbSschwarze.Sq Ctrl-Meta-H
92081fbbfbSschwarzein order to call the
93081fbbfbSschwarze.Ic ed-delete-prev-word
94081fbbfbSschwarzeeditor command in emacs mode, hold down the keys
95081fbbfbSschwarze.Sq Ctrl ,
96081fbbfbSschwarze.Sq Meta ,
97081fbbfbSschwarzeand
98081fbbfbSschwarze.Sq H
99081fbbfbSschwarzeat the same time.
100081fbbfbSschwarzeAlternatively, press and release the escape key, then press and
101081fbbfbSschwarzerelease
102081fbbfbSschwarze.Sq Ctrl-H .
103081fbbfbSschwarze.Pp
104081fbbfbSschwarzeIn vi input mode, input characters are bound to the following editor
105081fbbfbSschwarzecommands by default:
106081fbbfbSschwarze.Bl -column -offset indent "Ctrl-Z, TSTP" "ed-search-next-history"
107081fbbfbSschwarze.It Ctrl-D, EOF Ta Ic vi-list-or-eof
108081fbbfbSschwarze.It Ctrl-H, BS Ta Ic vi-delete-prev-char
109081fbbfbSschwarze.It Ctrl-J, LF Ta Ic ed-newline
110081fbbfbSschwarze.It Ctrl-M, CR Ta Ic ed-newline
111081fbbfbSschwarze.It Ctrl-Q Ta Ic ed-tty-start-output
112081fbbfbSschwarze.It Ctrl-S Ta Ic ed-tty-stop-output
113081fbbfbSschwarze.It Ctrl-U Ta Ic vi-kill-line-prev
114081fbbfbSschwarze.It Ctrl-V Ta Ic ed-quoted-insert
115081fbbfbSschwarze.It Ctrl-W Ta Ic ed-delete-prev-word
116081fbbfbSschwarze.It Ctrl-[, ESC Ta Ic vi-command-mode
117081fbbfbSschwarze.It Ctrl-\e, QUIT Ta Ic ed-tty-sigquit
118081fbbfbSschwarze.It Ctrl-?, DEL Ta Ic vi-delete-prev-char
119081fbbfbSschwarze.El
120081fbbfbSschwarze.Pp
121081fbbfbSschwarzeAll other input characters except the NUL character (Ctrl-@) are
122081fbbfbSschwarzebound to
123081fbbfbSschwarze.Ic ed-insert .
124081fbbfbSschwarze.Pp
125081fbbfbSschwarzeIn vi command mode, input characters are bound to the following
126081fbbfbSschwarzeeditor commands by default:
127081fbbfbSschwarze.Bl -column -offset indent "Ctrl-Z, TSTP" "ed-search-next-history"
128081fbbfbSschwarze.It Ctrl-A Ta Ic ed-move-to-beg
129081fbbfbSschwarze.It Ctrl-C, INT Ta Ic ed-tty-sigint
130081fbbfbSschwarze.It Ctrl-E Ta Ic ed-move-to-end
131081fbbfbSschwarze.It Ctrl-H, BS Ta Ic ed-delete-prev-char
132081fbbfbSschwarze.It Ctrl-J, LF Ta Ic ed-newline
133081fbbfbSschwarze.It Ctrl-K Ta Ic ed-kill-line
134081fbbfbSschwarze.It Ctrl-L, FF Ta Ic ed-clear-screen
135081fbbfbSschwarze.It Ctrl-M, CR Ta Ic ed-newline
136081fbbfbSschwarze.It Ctrl-N Ta Ic ed-next-history
137081fbbfbSschwarze.It Ctrl-O Ta Ic ed-tty-flush-output
138081fbbfbSschwarze.It Ctrl-P Ta Ic ed-prev-history
139081fbbfbSschwarze.It Ctrl-Q Ta Ic ed-tty-start-output
140081fbbfbSschwarze.It Ctrl-R Ta Ic ed-redisplay
141081fbbfbSschwarze.It Ctrl-S Ta Ic ed-tty-stop-output
142081fbbfbSschwarze.It Ctrl-U Ta Ic vi-kill-line-prev
143081fbbfbSschwarze.It Ctrl-W Ta Ic ed-delete-prev-word
144081fbbfbSschwarze.It Ctrl-[, ESC Ta Ic em-meta-next
145081fbbfbSschwarze.It Ctrl-\e, QUIT Ta Ic ed-tty-sigquit
146081fbbfbSschwarze.It Space Ta Ic ed-next-char
147081fbbfbSschwarze.It # Ta Ic vi-comment-out
148081fbbfbSschwarze.It $ Ta Ic ed-move-to-end
149081fbbfbSschwarze.It % Ta Ic vi-match
150081fbbfbSschwarze.It + Ta Ic ed-next-history
151081fbbfbSschwarze.It \&, Ta Ic vi-repeat-prev-char
152081fbbfbSschwarze.It - Ta Ic ed-prev-history
153081fbbfbSschwarze.It \&. Ta Ic vi-redo
154081fbbfbSschwarze.It / Ta Ic vi-search-prev
155081fbbfbSschwarze.It 0 Ta Ic vi-zero
156081fbbfbSschwarze.It 1 to 9 Ta Ic ed-argument-digit
157081fbbfbSschwarze.It \&: Ta Ic ed-command
158081fbbfbSschwarze.It \&; Ta Ic vi-repeat-next-char
159081fbbfbSschwarze.It \&? Ta Ic vi-search-next
160081fbbfbSschwarze.It @ Ta Ic vi-alias
161081fbbfbSschwarze.It A Ta Ic vi-add-at-eol
162081fbbfbSschwarze.It B Ta Ic vi-prev-big-word
163081fbbfbSschwarze.It C Ta Ic vi-change-to-eol
164081fbbfbSschwarze.It D Ta Ic ed-kill-line
165081fbbfbSschwarze.It E Ta Ic vi-end-big-word
166081fbbfbSschwarze.It F Ta Ic vi-prev-char
167081fbbfbSschwarze.It G Ta Ic vi-to-history-line
168081fbbfbSschwarze.It I Ta Ic vi-insert-at-bol
169081fbbfbSschwarze.It J Ta Ic ed-search-next-history
170081fbbfbSschwarze.It K Ta Ic ed-search-prev-history
171081fbbfbSschwarze.It N Ta Ic vi-repeat-search-prev
172081fbbfbSschwarze.It O Ta Ic ed-sequence-lead-in
173081fbbfbSschwarze.It P Ta Ic vi-paste-prev
174081fbbfbSschwarze.It R Ta Ic vi-replace-mode
175081fbbfbSschwarze.It S Ta Ic vi-substitute-line
176081fbbfbSschwarze.It T Ta Ic vi-to-prev-char
177081fbbfbSschwarze.It U Ta Ic vi-undo-line
178081fbbfbSschwarze.It W Ta Ic vi-next-big-word
179081fbbfbSschwarze.It X Ta Ic ed-delete-prev-char
180081fbbfbSschwarze.It Y Ta Ic vi-yank-end
181081fbbfbSschwarze.It \&[ Ta Ic ed-sequence-lead-in
182081fbbfbSschwarze.It ^ Ta Ic ed-move-to-beg
183081fbbfbSschwarze.It _ Ta Ic vi-history-word
184081fbbfbSschwarze.It a Ta Ic vi-add
185081fbbfbSschwarze.It b Ta Ic vi-prev-word
186081fbbfbSschwarze.It c Ta Ic vi-change-meta
187081fbbfbSschwarze.It d Ta Ic vi-delete-meta
188081fbbfbSschwarze.It e Ta Ic vi-end-word
189081fbbfbSschwarze.It f Ta Ic vi-next-char
190081fbbfbSschwarze.It h Ta Ic ed-prev-char
191081fbbfbSschwarze.It i Ta Ic vi-insert
192081fbbfbSschwarze.It j Ta Ic ed-next-history
193081fbbfbSschwarze.It k Ta Ic ed-prev-history
194081fbbfbSschwarze.It l Ta Ic ed-next-char
195081fbbfbSschwarze.It n Ta Ic vi-repeat-search-next
196081fbbfbSschwarze.It p Ta Ic vi-paste-next
197081fbbfbSschwarze.It r Ta Ic vi-replace-char
198081fbbfbSschwarze.It s Ta Ic vi-substitute-char
199081fbbfbSschwarze.It t Ta Ic vi-to-next-char
200081fbbfbSschwarze.It u Ta Ic vi-undo
201081fbbfbSschwarze.It v Ta Ic vi-histedit
202081fbbfbSschwarze.It w Ta Ic vi-next-word
203081fbbfbSschwarze.It x Ta Ic ed-delete-next-char
204081fbbfbSschwarze.It y Ta Ic vi-yank
205081fbbfbSschwarze.It \&| Ta Ic vi-to-column
206081fbbfbSschwarze.It ~ Ta Ic vi-change-case
207081fbbfbSschwarze.It Ctrl-?, DEL Ta Ic ed-delete-prev-char
208081fbbfbSschwarze.It Meta-O Ta Ic ed-sequence-lead-in
209081fbbfbSschwarze.It Meta-[ Ta Ic ed-sequence-lead-in
210081fbbfbSschwarze.El
211081fbbfbSschwarze.Pp
212081fbbfbSschwarzeIn emacs mode, input characters are bound to the following editor
213081fbbfbSschwarzecommands by default:
214081fbbfbSschwarze.Bl -column -offset indent "Ctrl-Z, TSTP" "ed-search-next-history"
215081fbbfbSschwarze.It 0 to 9 Ta Ic ed-digit
216081fbbfbSschwarze.It Ctrl-@, NUL Ta Ic em-set-mark
217081fbbfbSschwarze.It Ctrl-A Ta Ic ed-move-to-beg
218081fbbfbSschwarze.It Ctrl-B Ta Ic ed-prev-char
219081fbbfbSschwarze.It Ctrl-C, INT Ta Ic ed-tty-sigint
220081fbbfbSschwarze.It Ctrl-D, EOF Ta Ic em-delete-or-list
221081fbbfbSschwarze.It Ctrl-E Ta Ic ed-move-to-end
222081fbbfbSschwarze.It Ctrl-F Ta Ic ed-next-char
223081fbbfbSschwarze.It Ctrl-H, BS Ta Ic em-delete-prev-char
224081fbbfbSschwarze.It Ctrl-J, LF Ta Ic ed-newline
225081fbbfbSschwarze.It Ctrl-K Ta Ic ed-kill-line
226081fbbfbSschwarze.It Ctrl-L, FF Ta Ic ed-clear-screen
227081fbbfbSschwarze.It Ctrl-M, CR Ta Ic ed-newline
228081fbbfbSschwarze.It Ctrl-N Ta Ic ed-next-history
229081fbbfbSschwarze.It Ctrl-O Ta Ic ed-tty-flush-output
230081fbbfbSschwarze.It Ctrl-P Ta Ic ed-prev-history
231081fbbfbSschwarze.It Ctrl-Q Ta Ic ed-tty-start-output
232081fbbfbSschwarze.It Ctrl-R Ta Ic ed-redisplay
233081fbbfbSschwarze.It Ctrl-S Ta Ic ed-tty-stop-output
234081fbbfbSschwarze.It Ctrl-T Ta Ic ed-transpose-chars
235081fbbfbSschwarze.It Ctrl-U Ta Ic ed-kill-line
236081fbbfbSschwarze.It Ctrl-V Ta Ic ed-quoted-insert
237081fbbfbSschwarze.It Ctrl-W Ta Ic em-kill-region
238081fbbfbSschwarze.It Ctrl-X Ta Ic ed-sequence-lead-in
239081fbbfbSschwarze.It Ctrl-Y Ta Ic em-yank
240081fbbfbSschwarze.It Ctrl-Z, TSTP Ta Ic ed-tty-sigtstp
241081fbbfbSschwarze.It Ctrl-[, ESC Ta Ic em-meta-next
242081fbbfbSschwarze.It Ctrl-\e, QUIT Ta Ic ed-tty-sigquit
243081fbbfbSschwarze.It Ctrl-] Ta Ic ed-tty-dsusp
244081fbbfbSschwarze.It Ctrl-?, DEL Ta Ic em-delete-prev-char
245081fbbfbSschwarze.It Ctrl-Meta-H Ta Ic ed-delete-prev-word
246081fbbfbSschwarze.It Ctrl-Meta-L Ta Ic ed-clear-screen
247081fbbfbSschwarze.It Ctrl-Meta-_ Ta Ic em-copy-prev-word
248081fbbfbSschwarze.It Meta-0 to 9 Ta Ic ed-argument-digit
249081fbbfbSschwarze.It Meta-B Ta Ic ed-prev-word
250081fbbfbSschwarze.It Meta-C Ta Ic em-capitol-case
251081fbbfbSschwarze.It Meta-D Ta Ic em-delete-next-word
252081fbbfbSschwarze.It Meta-F Ta Ic em-next-word
253081fbbfbSschwarze.It Meta-L Ta Ic em-lower-case
254081fbbfbSschwarze.It Meta-N Ta Ic ed-search-next-history
255081fbbfbSschwarze.It Meta-O Ta Ic ed-sequence-lead-in
256081fbbfbSschwarze.It Meta-P Ta Ic ed-search-prev-history
257081fbbfbSschwarze.It Meta-U Ta Ic em-upper-case
258081fbbfbSschwarze.It Meta-W Ta Ic em-copy-region
259081fbbfbSschwarze.It Meta-X Ta Ic ed-command
260081fbbfbSschwarze.It Meta-[ Ta Ic ed-sequence-lead-in
261081fbbfbSschwarze.It Meta-b Ta Ic ed-prev-word
262081fbbfbSschwarze.It Meta-c Ta Ic em-capitol-case
263081fbbfbSschwarze.It Meta-d Ta Ic em-delete-next-word
264081fbbfbSschwarze.It Meta-f Ta Ic em-next-word
265081fbbfbSschwarze.It Meta-l Ta Ic em-lower-case
266081fbbfbSschwarze.It Meta-n Ta Ic ed-search-next-history
267081fbbfbSschwarze.It Meta-p Ta Ic ed-search-prev-history
268081fbbfbSschwarze.It Meta-u Ta Ic em-upper-case
269081fbbfbSschwarze.It Meta-w Ta Ic em-copy-region
270081fbbfbSschwarze.It Meta-x Ta Ic ed-command
271081fbbfbSschwarze.It Ctrl-Meta-? Ta Ic ed-delete-prev-word
272081fbbfbSschwarze.El
273081fbbfbSschwarze.Pp
274081fbbfbSschwarzeThe remaining
275081fbbfbSschwarze.Xr ascii 7
276081fbbfbSschwarzecharacters in the range 0x20 to 0x7e are bound to
277081fbbfbSschwarze.Ic ed-insert .
278081fbbfbSschwarze.Pp
279081fbbfbSschwarzeIf standard output is not connected to a terminal device
280081fbbfbSschwarzeor
281081fbbfbSschwarze.Xr el_set 3
282081fbbfbSschwarzewas used to set
283081fbbfbSschwarze.Dv EL_EDITMODE
284081fbbfbSschwarzeto 0, all input character bindings are disabled and all characters
285081fbbfbSschwarzetyped are appended to the edit buffer.
286081fbbfbSschwarzeIn that case, the edit buffer is returned to the program after a
287081fbbfbSschwarzenewline or carriage return character is typed, or after the first
288081fbbfbSschwarzecharacter typed if
289081fbbfbSschwarze.Xr el_set 3
290081fbbfbSschwarzewas used to set
291081fbbfbSschwarze.Dv EL_UNBUFFERED
292081fbbfbSschwarzeto non-zero.
293081fbbfbSschwarze.Ss Editor commands
294081fbbfbSschwarzeMost editor commands accept an optional argument.
295081fbbfbSschwarzeThe argument is entered by prefixing the editor command with one
296081fbbfbSschwarzeor more of the editor commands
297081fbbfbSschwarze.Ic ed-argument-digit ,
298081fbbfbSschwarze.Ic ed-digit ,
299081fbbfbSschwarze.Ic em-universal-argument ,
300081fbbfbSschwarzeor
301081fbbfbSschwarze.Ic vi-zero .
302081fbbfbSschwarzeWhen an argument is not provided, it defaults to 1.
303081fbbfbSschwarzeFor most editor commands, the effect of an argument is to repeatedly
304081fbbfbSschwarzeexecute the command that number of times.
305081fbbfbSschwarze.Pp
306081fbbfbSschwarzeWhen talking about a character string from a left character to a
307081fbbfbSschwarzeright character, the left character is included in the string, while
308081fbbfbSschwarzethe right character is not included.
309081fbbfbSschwarze.Pp
310081fbbfbSschwarzeIf an editor command causes an error, the input character is discarded,
311081fbbfbSschwarzeno action occurs, and the terminal bell is rung.
312081fbbfbSschwarzeIn case of a non-fatal error, the terminal bell is also rung,
313081fbbfbSschwarzebut the editor command takes effect anyway.
314081fbbfbSschwarze.Pp
315081fbbfbSschwarzeIn the following list, the default key bindings are listed after
316081fbbfbSschwarzeeach editor command.
317081fbbfbSschwarze.Bl -tag -width 4n
318081fbbfbSschwarze.It Ic ed-argument-digit Pq vi command: 1 to 9; emacs: Meta-0 to Meta-9
319081fbbfbSschwarzeIf in argument input mode, append the input digit to the argument
320081fbbfbSschwarzebeing read.
321081fbbfbSschwarzeOtherwise, switch to argument input mode and use the input digit
322081fbbfbSschwarzeas the most significant digit of the argument.
323081fbbfbSschwarzeIt is an error if the input character is not a digit or if the
324081fbbfbSschwarzeexisting argument is already greater than a million.
325081fbbfbSschwarze.It Ic ed-clear-screen Pq vi command: Ctrl-L; emacs: Ctrl-L, Ctrl-Meta-L
326081fbbfbSschwarzeClear the screen and display the edit buffer at the top.
327081fbbfbSschwarzeIgnore any argument.
328081fbbfbSschwarze.It Ic ed-command Pq vi command: So \&: Sc ; emacs: Meta-X, Meta-x
329081fbbfbSschwarzeRead a line from the terminal bypassing the normal line editing
330081fbbfbSschwarzefunctionality and execute that line as an
331081fbbfbSschwarze.Xr editrc 5
332081fbbfbSschwarzebuiltin command.
333081fbbfbSschwarzeIf in vi command mode, also switch back to vi insert mode.
334081fbbfbSschwarzeIgnore any argument.
335081fbbfbSschwarze.It Ic ed-delete-next-char Pq vi command: x
336081fbbfbSschwarzeDelete the character at the cursor position.
337081fbbfbSschwarzeWith an argument, delete that number of characters.
338081fbbfbSschwarzeIn emacs mode, it is an error if the cursor is at the end of the
339081fbbfbSschwarzeedit buffer.
340081fbbfbSschwarzeIn vi mode, the last character in the edit buffer is deleted in
341081fbbfbSschwarzethat case, and it is an error if the buffer is empty.
342081fbbfbSschwarze.It Ic ed-delete-prev-char Pq vi command: X, Ctrl-H, BS, Ctrl-?, DEL
343081fbbfbSschwarzeDelete the character to the left of the cursor position.
344081fbbfbSschwarzeWith an argument, delete that number of characters.
345081fbbfbSschwarzeIt is an error if the cursor is at the beginning of the edit buffer.
346081fbbfbSschwarze.It Ic ed-delete-prev-word Pq vi: Ctrl-W; emacs: Ctrl-Meta-H, Ctrl-Meta-?
347081fbbfbSschwarzeMove to the left to the closest beginning of a word, delete the
348081fbbfbSschwarzestring from that position to the cursor, and save it to the cut
349081fbbfbSschwarzebuffer.
350081fbbfbSschwarzeWith an argument, delete that number of words.
351081fbbfbSschwarzeIt is an error if the cursor is at the beginning of the edit buffer.
352081fbbfbSschwarze.It Ic ed-digit Pq emacs: 0 to 9
353081fbbfbSschwarzeIf in argument input mode, append the input digit to the argument
354081fbbfbSschwarzebeing read.
355081fbbfbSschwarzeOtherwise, call
356081fbbfbSschwarze.Ic ed-insert .
357081fbbfbSschwarzeIt is an error if the input character is not a digit or if the
358081fbbfbSschwarzeexisting argument is already greater than a million.
359081fbbfbSschwarze.It Ic ed-end-of-file Pq not bound by default
360081fbbfbSschwarzeDiscard the edit buffer and indicate end of file to the program.
361081fbbfbSschwarzeIgnore any argument.
362081fbbfbSschwarze.It Ic ed-ignore Pq various
363081fbbfbSschwarzeDiscard the input character and do nothing.
364081fbbfbSschwarze.It Ic ed-insert Pq vi input: almost all; emacs: printable characters
365081fbbfbSschwarzeIn insert mode, insert the input character left of the cursor
366081fbbfbSschwarzeposition.
367081fbbfbSschwarzeIn replace mode, overwrite the character at the cursor and move the
368081fbbfbSschwarzecursor to the right by one character position.
369081fbbfbSschwarzeAccept an argument to do this repeatedly.
370081fbbfbSschwarzeIt is an error if the input character is the NUL character (Ctrl-@).
371081fbbfbSschwarzeFailure to enlarge the edit buffer also results in an error.
372081fbbfbSschwarze.It Ic ed-kill-line Pq vi command: D, Ctrl-K; emacs: Ctrl-K, Ctrl-U
373081fbbfbSschwarzeDelete the string from the cursor position to the end of the line
374081fbbfbSschwarzeand save it to the cut buffer.
375081fbbfbSschwarzeIgnore any argument.
376081fbbfbSschwarze.It Ic ed-move-to-beg Pq vi command: ^, Ctrl-A; emacs: Ctrl-A
377081fbbfbSschwarzeIn vi mode, move the cursor to the first non-space character in the
378081fbbfbSschwarzeedit buffer.
379081fbbfbSschwarzeIn emacs mode, move the cursor to the beginning of the edit buffer.
380081fbbfbSschwarzeIgnore any argument.
381081fbbfbSschwarzeCan be used as a movement command after
382081fbbfbSschwarze.Ic vi_change_meta ,
383081fbbfbSschwarze.Ic vi_delete_meta ,
384081fbbfbSschwarzeor
385081fbbfbSschwarze.Ic vi_yank .
386081fbbfbSschwarze.It Ic ed-move-to-end Pq vi command: $, Ctrl-E; emacs: Ctrl-E
387081fbbfbSschwarzeMove the cursor to the end of the edit buffer.
388081fbbfbSschwarzeIgnore any argument.
389081fbbfbSschwarzeCan be used as a movement command after
390081fbbfbSschwarze.Ic vi_change_meta ,
391081fbbfbSschwarze.Ic vi_delete_meta ,
392081fbbfbSschwarzeor
393081fbbfbSschwarze.Ic vi_yank .
394081fbbfbSschwarze.It Ic ed-newline Pq all modes: Ctrl-J, LF, Ctrl-M, CR
395081fbbfbSschwarzeAppend a newline character to the edit buffer and return the edit
396081fbbfbSschwarzebuffer to the program.
397081fbbfbSschwarzeIgnore any argument.
398081fbbfbSschwarze.It Ic ed-next-char Pq vi command: Space, l; emacs: Ctrl-F
399081fbbfbSschwarzeMove the cursor one character position to the right.
400081fbbfbSschwarzeWith an argument, move by that number of characters.
401081fbbfbSschwarzeCan be used as a movement command after
402081fbbfbSschwarze.Ic vi_change_meta ,
403081fbbfbSschwarze.Ic vi_delete_meta ,
404081fbbfbSschwarzeor
405081fbbfbSschwarze.Ic vi_yank .
406081fbbfbSschwarzeIt is an error if the cursor is already at the end of the edit
407081fbbfbSschwarzebuffer.
408081fbbfbSschwarze.It Ic ed-next-history Pq vi command: j, +, Ctrl-N; emacs: Ctrl-N
409081fbbfbSschwarzeReplace the edit buffer with the next history line.
410*47f0686aSschwarzeThat line is older than the current line.
411081fbbfbSschwarzeWith an argument, go forward by that number of history lines.
412081fbbfbSschwarzeIt is a non-fatal error to advance by more lines than are available.
413081fbbfbSschwarze.It Ic ed-next-line Pq not bound by default
414081fbbfbSschwarzeMove the cursor down one line.
415081fbbfbSschwarzeWith an argument, move down by that number of lines.
416081fbbfbSschwarzeIt is an error if the edit buffer does not contain enough newline
417081fbbfbSschwarzecharacters to the right of the cursor position.
418081fbbfbSschwarze.It Ic ed-prev-char Pq vi command: h; emacs: Ctrl-B
419081fbbfbSschwarzeMove the cursor one character position to the left.
420081fbbfbSschwarzeWith an argument, move by that number of characters.
421081fbbfbSschwarzeCan be used as a movement command after
422081fbbfbSschwarze.Ic vi_change_meta ,
423081fbbfbSschwarze.Ic vi_delete_meta ,
424081fbbfbSschwarzeor
425081fbbfbSschwarze.Ic vi_yank .
426081fbbfbSschwarzeIt is an error if the cursor is already at the beginning of the
427081fbbfbSschwarzeedit buffer.
428081fbbfbSschwarze.It Ic ed-prev-history Pq vi command: k, -, Ctrl-P; emacs: Ctrl-P
429081fbbfbSschwarzeReplace the edit buffer with the previous history line.
430*47f0686aSschwarzeThat line is newer than the current line.
431081fbbfbSschwarzeWith an argument, go back by that number of lines.
432081fbbfbSschwarzeIt is a non-fatal error to back up by more lines than are available.
433081fbbfbSschwarze.It Ic ed-prev-line Pq not bound by default
434081fbbfbSschwarzeMove the cursor up one line.
435081fbbfbSschwarzeWith an argument, move up by that number of lines.
436081fbbfbSschwarzeIt is an error if the edit buffer does not contain enough newline
437081fbbfbSschwarzecharacters to the left of the cursor position.
438081fbbfbSschwarze.It Ic ed-prev-word Pq emacs: Meta-B, Meta-b
439081fbbfbSschwarzeMove the cursor to the left to the closest beginning of a word.
440081fbbfbSschwarzeWith an argument, repeat that number of times.
441081fbbfbSschwarzeCan be used as a movement command after
442081fbbfbSschwarze.Ic vi_change_meta ,
443081fbbfbSschwarze.Ic vi_delete_meta ,
444081fbbfbSschwarzeor
445081fbbfbSschwarze.Ic vi_yank .
446081fbbfbSschwarzeIt is an error if the cursor is already at the beginning of the
447081fbbfbSschwarzeedit buffer.
448081fbbfbSschwarze.It Ic ed-quoted-insert Pq vi insert, emacs: Ctrl-V
449081fbbfbSschwarzeRead one character from the terminal bypassing the normal line
450081fbbfbSschwarzeediting functionality and call
451081fbbfbSschwarze.Ic ed-insert
452081fbbfbSschwarzeon it.
453081fbbfbSschwarzeIf trying to read the character returns end of file or an error,
454081fbbfbSschwarzecall
455081fbbfbSschwarze.Ic ed-end-of-file
456081fbbfbSschwarzeinstead.
457081fbbfbSschwarze.It Ic ed-redisplay Pq vi command, emacs: Ctrl-R
458081fbbfbSschwarzeRedisplay everything.
459081fbbfbSschwarzeIgnore any argument.
460081fbbfbSschwarze.It Ic ed-search-next-history Pq vi command: J; emacs: Meta-N, Meta-n
461081fbbfbSschwarzeReplace the edit buffer with the next matching history entry.
462081fbbfbSschwarze.It Ic ed-search-prev-history Pq vi command: K; emacs: Meta-P, Meta-p
463081fbbfbSschwarzeReplace the edit buffer with the previous matching history entry.
464081fbbfbSschwarze.It Ic ed-sequence-lead-in Pq vi cmd: O, \&[; emacs: Ctrl-X;\
465081fbbfbSschwarze both: Meta-O, Meta-[
466081fbbfbSschwarzeCall a macro.
467081fbbfbSschwarzeSee the section about
468081fbbfbSschwarze.Sx Macros
469081fbbfbSschwarzebelow for details.
470081fbbfbSschwarze.It Ic ed-start-over Pq not bound by default
471081fbbfbSschwarzeDiscard the contents of the edit buffer and start from scratch.
472081fbbfbSschwarzeIgnore any argument.
473081fbbfbSschwarze.It Ic ed-transpose-chars Pq emacs: Ctrl-T
474081fbbfbSschwarzeExchange the character at the cursor position with the one to the
475081fbbfbSschwarzeleft of it and move the cursor to the character to the right of the
476081fbbfbSschwarzetwo exchanged characters.
477081fbbfbSschwarzeIgnore any argument.
478081fbbfbSschwarzeIt is an error if the cursor is at the beginning of the edit buffer
479081fbbfbSschwarzeor if the edit buffer contains less than two characters.
480081fbbfbSschwarze.It Ic ed-unassigned Pq all characters not listed
481081fbbfbSschwarzeThis editor command always results in an error.
482081fbbfbSschwarze.It Ic em-capitol-case Pq emacs: Meta-C, Meta-c
483081fbbfbSschwarzeCapitalize the string from the cursor to the end of the current
484081fbbfbSschwarzeword.
485081fbbfbSschwarzeThat is, if it contains at least one alphabetic character, convert
486081fbbfbSschwarzethe first alphabetic character to upper case, and convert all
487081fbbfbSschwarzecharacters to the right of it to lower case.
488081fbbfbSschwarzeIn any case, move the cursor to the next character after the end
489081fbbfbSschwarzeof the current word.
490081fbbfbSschwarze.It Ic em-copy-prev-word Pq emacs: Ctrl-Meta-_
491081fbbfbSschwarzeCopy the string from the beginning of the current word to the cursor
492081fbbfbSschwarzeand insert it to the left of the cursor.
493081fbbfbSschwarzeMove the cursor to the character after the inserted string.
494081fbbfbSschwarzeIt is an error if the cursor is at the beginning of the edit buffer.
495081fbbfbSschwarze.It Ic em-copy-region Pq emacs: Meta-W, Meta-w
496081fbbfbSschwarzeCopy the string from the cursor to the mark to the cut buffer.
497081fbbfbSschwarzeIt is an error if the mark is not set.
498081fbbfbSschwarze.It Ic em-delete-next-word Pq emacs: Meta-D, Meta-d
499081fbbfbSschwarzeDelete the string from the cursor to the end of the current word
500081fbbfbSschwarzeand save it to the cut buffer.
501081fbbfbSschwarzeIt is an error if the cursor is at the end of the edit buffer.
502081fbbfbSschwarze.It Ic em-delete-or-list Pq emacs: Ctrl-D, EOF
503081fbbfbSschwarzeIf the cursor is not at the end of the line, delete the character
504081fbbfbSschwarzeat the cursor.
505081fbbfbSschwarzeIf the edit buffer is empty, indicate end of file to the program.
506081fbbfbSschwarzeIt is an error if the cursor is at the end of the edit buffer and
507081fbbfbSschwarzethe edit buffer is not empty.
508081fbbfbSschwarze.It Ic em-delete-prev-char Pq emacs: Ctrl-H, BS, Ctrl-?, DEL
509081fbbfbSschwarzeDelete the character to the left of the cursor.
510081fbbfbSschwarzeIt is an error if the cursor is at the beginning of the edit buffer.
511081fbbfbSschwarze.It Ic em-exchange-mark Pq not bound by default
512081fbbfbSschwarzeExchange the cursor and the mark.
513081fbbfbSschwarze.It Ic em-gosmacs-transpose Pq not bound by default
514081fbbfbSschwarzeExchange the two characters to the left of the cursor.
515081fbbfbSschwarzeIt is an error if the cursor is on the first or second character
516081fbbfbSschwarzeof the edit buffer.
517081fbbfbSschwarze.It Ic em-inc-search-next Pq not bound by default
518081fbbfbSschwarzeEmacs incremental next search.
519081fbbfbSschwarze.It Ic em-inc-search-prev Pq not bound by default
520081fbbfbSschwarzeEmacs incremental reverse search.
521081fbbfbSschwarze.It Ic em-kill-line Pq not bound by default
522081fbbfbSschwarzeDelete the entire contents of the edit buffer and save it to the
523081fbbfbSschwarzecut buffer.
524081fbbfbSschwarze.It Ic em-kill-region Pq emacs: Ctrl-W
525081fbbfbSschwarzeDelete the string from the cursor to the mark and save it to the
526081fbbfbSschwarzecut buffer.
527081fbbfbSschwarzeIt is an error if the mark is not set.
528081fbbfbSschwarze.It Ic em-lower-case Pq emacs: Meta-L, Meta-l
529081fbbfbSschwarzeConvert the characters from the cursor to the end of the current
530081fbbfbSschwarzeword to lower case.
531081fbbfbSschwarze.It Ic em-meta-next Pq vi command, emacs: Ctrl-[, ESC
532081fbbfbSschwarzeSet the bit 0x80 on the next character typed.
533081fbbfbSschwarzeUnless the resulting code point is printable, holding down the
534081fbbfbSschwarze.Sq Meta-
535081fbbfbSschwarzekey while typing that character is a simpler way to achieve the
536081fbbfbSschwarzesame effect.
537081fbbfbSschwarze.It Ic em-next-word Pq Meta-F, Meta-f
538081fbbfbSschwarzeMove the cursor to the end of the current word.
539081fbbfbSschwarzeCan be used as a movement command after
540081fbbfbSschwarze.Ic vi_change_meta ,
541081fbbfbSschwarze.Ic vi_delete_meta ,
542081fbbfbSschwarzeor
543081fbbfbSschwarze.Ic vi_yank .
544081fbbfbSschwarzeIt is an error if the cursor is already at the end of the edit
545081fbbfbSschwarzebuffer.
546081fbbfbSschwarze.It Ic em-set-mark Pq emacs: Ctrl-Q, NUL
547081fbbfbSschwarzeSet the mark at the current cursor position.
548081fbbfbSschwarze.It Ic em-toggle-overwrite Pq not bound by default
549081fbbfbSschwarzeSwitch from insert to overwrite mode or vice versa.
550081fbbfbSschwarze.It Ic em-universal-argument Pq not bound by default
551081fbbfbSschwarzeIf in argument input mode, multiply the argument by 4.
552081fbbfbSschwarzeOtherwise, switch to argument input mode and set the argument to 4.
553081fbbfbSschwarzeIt is an error if the existing argument is already greater than a
554081fbbfbSschwarzemillion.
555081fbbfbSschwarze.It Ic em-upper-case Pq emacs: Meta-U, Meta-u
556081fbbfbSschwarzeConvert the characters from the cursor to the end of the current
557081fbbfbSschwarzeword to upper case.
558081fbbfbSschwarze.It Ic em-yank Pq emacs: Ctrl-Y
559081fbbfbSschwarzePaste the cut buffer to the left of the cursor.
560081fbbfbSschwarze.It Ic vi-add Pq vi command: a
561081fbbfbSschwarzeSwitch to vi insert mode.
562081fbbfbSschwarzeUnless the cursor is already at the end of the edit buffer, move
563081fbbfbSschwarzeit one character position to the right.
564081fbbfbSschwarze.It Ic vi-add-at-eol Pq vi command: A
565081fbbfbSschwarzeSwitch to vi insert mode and move the cursor to the end of the edit
566081fbbfbSschwarzebuffer.
567081fbbfbSschwarze.It Ic vi-alias Pq vi command: @
568081fbbfbSschwarzeIf an alias function was defined by calling the
569081fbbfbSschwarze.Xr el_set 3
570081fbbfbSschwarzeor
571081fbbfbSschwarze.Xr el_wset 3
572081fbbfbSschwarzefunction with the argument
573081fbbfbSschwarze.Dv EL_ALIAS_TEXT ,
574081fbbfbSschwarzeread one character from the terminal bypassing the normal line
575081fbbfbSschwarzeediting functionality, call the alias function passing the argument that was specified with
576081fbbfbSschwarze.Dv EL_ALIAS_TEXT
577081fbbfbSschwarzeas the first argument and the character read, with an underscore
578081fbbfbSschwarzeprepended, as the second argument, and pass the string returned
579081fbbfbSschwarzefrom the alias function to
580081fbbfbSschwarze.Xr el_wpush 3 .
581081fbbfbSschwarzeIt is an error if no alias function is defined or if trying to read
582081fbbfbSschwarzethe character results in end of file or an error.
583081fbbfbSschwarze.It Ic vi-change-case Pq vi command: ~
584081fbbfbSschwarzeChange the case of the character at the cursor and move the cursor
585081fbbfbSschwarzeone character position to the right.
586081fbbfbSschwarzeIt is an error if the cursor is already at the end of the edit
587081fbbfbSschwarzebuffer.
588081fbbfbSschwarze.It Ic vi-change-meta Pq vi command: c
589081fbbfbSschwarzeDelete the string from the cursor to the position specified by the
590081fbbfbSschwarzefollowing movement command and save a copy of it to the cut buffer.
591081fbbfbSschwarzeWhen given twice in a row, instead delete the whole contents of the
592081fbbfbSschwarzeedit buffer and save a copy of it to the cut buffer.
593081fbbfbSschwarzeIn either case, switch to vi insert mode after that.
594081fbbfbSschwarze.It Ic vi-change-to-eol Pq vi command: C
595081fbbfbSschwarzeDelete the string from the cursor position to the end of the line
596081fbbfbSschwarzeand save it to the cut buffer, then switch to vi insert mode.
597081fbbfbSschwarze.It Ic vi-command-mode Pq vi insert: Ctrl-[, ESC
598081fbbfbSschwarzeDiscard pending actions and arguments and switch to vi command mode.
599081fbbfbSschwarzeUnless the cursor is already at the beginning of the edit buffer,
600081fbbfbSschwarzemove it to the left by one character position.
601081fbbfbSschwarze.It Ic vi-comment-out Pq vi command: #
602081fbbfbSschwarzeInsert a
603081fbbfbSschwarze.Sq #
604081fbbfbSschwarzecharacter at the beginning of the edit buffer and return the edit
605081fbbfbSschwarzebuffer to the program.
606081fbbfbSschwarze.It Ic vi-delete-meta Pq vi command: d
607081fbbfbSschwarzeDelete the string from the cursor to the position specified by the
608081fbbfbSschwarzefollowing movement command and save a copy of it to the cut buffer.
609081fbbfbSschwarzeWhen given twice in a row, instead delete the whole contents of the
610081fbbfbSschwarzeedit buffer and save a copy of it to the cut buffer.
611081fbbfbSschwarze.It Ic vi-delete-prev-char Pq vi insert: Ctrl-H, BS, Ctrl-?, DEL
612081fbbfbSschwarzeDelete the character to the left of the cursor.
613081fbbfbSschwarzeIt is an error if the cursor is already at the beginning of the
614081fbbfbSschwarzeedit buffer.
615081fbbfbSschwarze.It Ic vi-end-big-word Pq vi command: E
616081fbbfbSschwarzeMove the cursor to the end of the current space delimited word.
617081fbbfbSschwarzeCan be used as a movement command after
618081fbbfbSschwarze.Ic vi_change_meta ,
619081fbbfbSschwarze.Ic vi_delete_meta ,
620081fbbfbSschwarzeor
621081fbbfbSschwarze.Ic vi_yank .
622081fbbfbSschwarzeIt is an error if the cursor is already at the end of the edit
623081fbbfbSschwarzebuffer.
624081fbbfbSschwarze.It Ic vi-end-word Pq vi command: e
625081fbbfbSschwarzeMove the cursor to the end of the current word.
626081fbbfbSschwarzeCan be used as a movement command after
627081fbbfbSschwarze.Ic vi_change_meta ,
628081fbbfbSschwarze.Ic vi_delete_meta ,
629081fbbfbSschwarzeor
630081fbbfbSschwarze.Ic vi_yank .
631081fbbfbSschwarzeIt is an error if the cursor is already at the end of the edit
632081fbbfbSschwarzebuffer.
633081fbbfbSschwarze.It Ic vi-history-word Pq vi command: _
634081fbbfbSschwarzeInsert the first word from the most recent history entry after the
635081fbbfbSschwarzecursor, move the cursor after to the character after the inserted
636081fbbfbSschwarzeword, and switch to vi insert mode.
637081fbbfbSschwarzeIt is an error if there is no history entry or the most recent
638081fbbfbSschwarzehistory entry is empty.
639081fbbfbSschwarze.It Ic vi-insert Pq vi command: i
640081fbbfbSschwarzeEnter insert mode.
641081fbbfbSschwarze.It Ic vi-insert-at-bol Pq vi command: I
642081fbbfbSschwarzeMove the cursor to the beginning of the edit buffer and switch to
643081fbbfbSschwarzevi insert mode.
644081fbbfbSschwarze.It Ic vi-kill-line-prev Pq vi: Ctrl-U
645081fbbfbSschwarzeDelete the string from the beginning of the edit buffer to the
646081fbbfbSschwarzecursor and save it to the cut buffer.
647081fbbfbSschwarze.It Ic vi-list-or-eof Pq vi insert: Ctrl-D, EOF
648081fbbfbSschwarzeIf the edit buffer is empty, indicate end of file to the program.
649081fbbfbSschwarzeIt is an error if the edit buffer is not empty.
650081fbbfbSschwarze.It Ic vi-match Pq vi command: %
651081fbbfbSschwarzeConsider opening and closing parentheses, braces, and brackets as
652081fbbfbSschwarzedelimiters.
653081fbbfbSschwarzeIf the cursor is not at a delimiter, move it to the right until it
654081fbbfbSschwarzegets to one, then move it to the matching delimiter.
655081fbbfbSschwarzeCan be used as a movement command after
656081fbbfbSschwarze.Ic vi_change_meta ,
657081fbbfbSschwarze.Ic vi_delete_meta ,
658081fbbfbSschwarzeor
659081fbbfbSschwarze.Ic vi_yank .
660081fbbfbSschwarzeIt is an error if there is no delimiter at the cursor or in the
661081fbbfbSschwarzestring to the right of the cursor, or if the first such delimiter
662081fbbfbSschwarzehas no matching delimiter.
663081fbbfbSschwarze.It Ic vi-next-big-word Pq vi command: W
664081fbbfbSschwarzeMove the cursor to the right to the beginning of the next space
665081fbbfbSschwarzedelimited word.
666081fbbfbSschwarzeCan be used as a movement command after
667081fbbfbSschwarze.Ic vi_change_meta ,
668081fbbfbSschwarze.Ic vi_delete_meta ,
669081fbbfbSschwarzeor
670081fbbfbSschwarze.Ic vi_yank .
671081fbbfbSschwarzeIt is an error if the cursor is already at the end of the edit
672081fbbfbSschwarzebuffer or on its last character.
673081fbbfbSschwarze.It Ic vi-next-char Pq vi command: f
674081fbbfbSschwarzeRead one character from the terminal bypassing the normal line
675081fbbfbSschwarzeediting functionality and move the cursor to the right to the next
676081fbbfbSschwarzeinstance of that character in the edit buffer.
677081fbbfbSschwarzeCan be used as a movement command after
678081fbbfbSschwarze.Ic vi_change_meta ,
679081fbbfbSschwarze.Ic vi_delete_meta ,
680081fbbfbSschwarzeor
681081fbbfbSschwarze.Ic vi_yank .
682081fbbfbSschwarzeIf trying to read the character results in end of file or an error,
683081fbbfbSschwarzecall
684081fbbfbSschwarze.Ic ed-end-of-file
685081fbbfbSschwarzeinstead.
686081fbbfbSschwarzeIt is an error if the character is not found searching to the right
687081fbbfbSschwarzein the edit buffer.
688081fbbfbSschwarze.It Ic vi-next-word Pq vi command: w
689081fbbfbSschwarzeMove the cursor to the right to the beginning of the next word.
690081fbbfbSschwarzeCan be used as a movement command after
691081fbbfbSschwarze.Ic vi_change_meta ,
692081fbbfbSschwarze.Ic vi_delete_meta ,
693081fbbfbSschwarzeor
694081fbbfbSschwarze.Ic vi_yank .
695081fbbfbSschwarzeIt is an error if the cursor is already at the end of the edit
696081fbbfbSschwarzebuffer or on its last character.
697081fbbfbSschwarze.It Ic vi-paste-next Pq vi command: p
698081fbbfbSschwarzeInsert a copy of the cut buffer to the right of the cursor.
699081fbbfbSschwarzeIt is an error if the cut buffer is empty.
700081fbbfbSschwarze.It Ic vi-paste-prev Pq vi command: P
701081fbbfbSschwarzeInsert a copy of the cut buffer to the left of the cursor.
702081fbbfbSschwarzeIt is an error if the cut buffer is empty.
703081fbbfbSschwarze.It Ic vi-prev-big-word Pq vi command: B
704081fbbfbSschwarzeMove the cursor to the left to the next beginning of a space delimited
705081fbbfbSschwarzeword.
706081fbbfbSschwarzeCan be used as a movement command after
707081fbbfbSschwarze.Ic vi_change_meta ,
708081fbbfbSschwarze.Ic vi_delete_meta ,
709081fbbfbSschwarzeor
710081fbbfbSschwarze.Ic vi_yank .
711081fbbfbSschwarzeIt is an error if the cursor is already at the beginning of the
712081fbbfbSschwarzeedit buffer.
713081fbbfbSschwarze.It Ic vi-prev-char Pq vi command: F
714081fbbfbSschwarzeRead one character from the terminal bypassing the normal line
715081fbbfbSschwarzeediting functionality and move the cursor to the left to the next
716081fbbfbSschwarzeinstance of that character in the edit buffer.
717081fbbfbSschwarzeCan be used as a movement command after
718081fbbfbSschwarze.Ic vi_change_meta ,
719081fbbfbSschwarze.Ic vi_delete_meta ,
720081fbbfbSschwarzeor
721081fbbfbSschwarze.Ic vi_yank .
722081fbbfbSschwarzeIf trying to read the character results in end of file or an error,
723081fbbfbSschwarzecall
724081fbbfbSschwarze.Ic ed-end-of-file
725081fbbfbSschwarzeinstead.
726081fbbfbSschwarzeIt is an error if the character is not found searching to the left
727081fbbfbSschwarzein the edit buffer.
728081fbbfbSschwarze.It Ic vi-prev-word Pq vi command: b
729081fbbfbSschwarzeMove the cursor to the left to the next beginning of a word.
730081fbbfbSschwarzeCan be used as a movement command after
731081fbbfbSschwarze.Ic vi_change_meta ,
732081fbbfbSschwarze.Ic vi_delete_meta ,
733081fbbfbSschwarzeor
734081fbbfbSschwarze.Ic vi_yank .
735081fbbfbSschwarzeIt is an error if the cursor is already at the beginning of the
736081fbbfbSschwarzeedit buffer.
737081fbbfbSschwarze.It Ic vi-redo Pq vi command: Sq \&.
738081fbbfbSschwarzeRedo the last non-motion command.
739081fbbfbSschwarze.It Ic vi-repeat-next-char Pq vi command: Sq \&;
740081fbbfbSschwarzeRepeat the most recent character search in the same search direction.
741081fbbfbSschwarzeCan be used as a movement command after
742081fbbfbSschwarze.Ic vi_change_meta ,
743081fbbfbSschwarze.Ic vi_delete_meta ,
744081fbbfbSschwarzeor
745081fbbfbSschwarze.Ic vi_yank .
746081fbbfbSschwarze.It Ic vi-repeat-prev-char Pq vi command: Sq \&,
747081fbbfbSschwarzeRepeat the most recent character search in the opposite search
748081fbbfbSschwarzedirection.
749081fbbfbSschwarzeCan be used as a movement command after
750081fbbfbSschwarze.Ic vi_change_meta ,
751081fbbfbSschwarze.Ic vi_delete_meta ,
752081fbbfbSschwarzeor
753081fbbfbSschwarze.Ic vi_yank .
754081fbbfbSschwarze.It Ic vi-repeat-search-next Pq vi command: n
755081fbbfbSschwarzeRepeat the most recent history search in the same search direction.
756081fbbfbSschwarze.It Ic vi-repeat-search-prev Pq vi command: N
757081fbbfbSschwarzeRepeat the most recent history search in the opposite search
758081fbbfbSschwarzedirection.
759081fbbfbSschwarze.It Ic vi-replace-char Pq vi command: r
760081fbbfbSschwarzeSwitch to vi replace mode, and automatically switch back to vi
761081fbbfbSschwarzecommand mode after the next character typed.
762081fbbfbSschwarzeSee
763081fbbfbSschwarze.Ic ed-insert
764081fbbfbSschwarzefor a description of replace mode.
765081fbbfbSschwarzeIt is an error if the cursor is at the end of the edit buffer.
766081fbbfbSschwarze.It Ic vi-replace-mode Pq vi command: R
767081fbbfbSschwarzeSwitch to vi replace mode.
768081fbbfbSschwarzeThis is a variant of vi insert mode; see
769081fbbfbSschwarze.Ic ed-insert
770081fbbfbSschwarzefor the difference.
771081fbbfbSschwarze.It Ic vi-search-next Pq vi command: \&?
772081fbbfbSschwarzeReplace the edit buffer with the next matching history entry.
773081fbbfbSschwarze.It Ic vi-search-prev Pq vi command: /
774081fbbfbSschwarzeReplace the edit buffer with the previous matching history entry.
775081fbbfbSschwarze.It Ic vi-substitute-char Pq vi command: s
776081fbbfbSschwarzeDelete the character at the cursor and switch to vi insert mode.
777081fbbfbSschwarze.It Ic vi-substitute-line Pq vi command: S
778081fbbfbSschwarzeDelete the entire contents of the edit buffer, save a copy of it
779081fbbfbSschwarzein the cut buffer, and enter vi insert mode.
780081fbbfbSschwarze.It Ic vi-to-column Pq vi command: \&|
781081fbbfbSschwarzeMove the cursor to the column specified as the argument.
782081fbbfbSschwarzeCan be used as a movement command after
783081fbbfbSschwarze.Ic vi_change_meta ,
784081fbbfbSschwarze.Ic vi_delete_meta ,
785081fbbfbSschwarzeor
786081fbbfbSschwarze.Ic vi_yank .
787081fbbfbSschwarze.It Ic vi-to-history-line Pq vi command: G
788081fbbfbSschwarzeReplace the edit buffer with the specified history entry.
789081fbbfbSschwarze.It Ic vi-to-next-char Pq vi command: t
790081fbbfbSschwarzeRead one character from the terminal bypassing the normal line
791081fbbfbSschwarzeediting functionality and move the cursor to the right to the
792081fbbfbSschwarzecharacter before the next instance of that character in the edit
793081fbbfbSschwarzebuffer.
794081fbbfbSschwarzeCan be used as a movement command after
795081fbbfbSschwarze.Ic vi_change_meta ,
796081fbbfbSschwarze.Ic vi_delete_meta ,
797081fbbfbSschwarzeor
798081fbbfbSschwarze.Ic vi_yank .
799081fbbfbSschwarzeIf trying to read the character results in end of file or an error,
800081fbbfbSschwarzecall
801081fbbfbSschwarze.Ic ed-end-of-file
802081fbbfbSschwarzeinstead.
803081fbbfbSschwarzeIt is an error if the character is not found searching to the right
804081fbbfbSschwarzein the edit buffer.
805081fbbfbSschwarze.It Ic vi-to-prev-char Pq vi command: T
806081fbbfbSschwarzeRead one character from the terminal bypassing the normal line
807081fbbfbSschwarzeediting functionality and move the cursor to the left to the character
808081fbbfbSschwarzeafter the next instance of that character in the edit buffer.
809081fbbfbSschwarzeCan be used as a movement command after
810081fbbfbSschwarze.Ic vi_change_meta ,
811081fbbfbSschwarze.Ic vi_delete_meta ,
812081fbbfbSschwarzeor
813081fbbfbSschwarze.Ic vi_yank .
814081fbbfbSschwarzeIf trying to read the character results in end of file or an error,
815081fbbfbSschwarzecall
816081fbbfbSschwarze.Ic ed-end-of-file
817081fbbfbSschwarzeinstead.
818081fbbfbSschwarzeIt is an error if the character is not found searching to the left
819081fbbfbSschwarzein the edit buffer.
820081fbbfbSschwarze.It Ic vi-undo Pq vi command: u
821081fbbfbSschwarzeUndo the last change.
822081fbbfbSschwarze.It Ic vi-undo-line Pq vi command: U
823081fbbfbSschwarzeUndo all changes to the edit buffer.
824081fbbfbSschwarze.It Ic vi-yank Pq vi command: y
825081fbbfbSschwarzeCopy the string from the cursor to the position specified by the
826081fbbfbSschwarzefollowing movement command to the cut buffer.
827081fbbfbSschwarzeWhen given twice in a row, instead copy the whole contents of the
828081fbbfbSschwarzeedit buffer to the cut buffer.
829081fbbfbSschwarze.It Ic vi-yank-end Pq vi command: Y
830081fbbfbSschwarzeCopy the string from the cursor to the end of the edit buffer to
831081fbbfbSschwarzethe cut buffer.
832081fbbfbSschwarze.It Ic vi-zero Pq vi command: 0
833081fbbfbSschwarzeIf in argument input mode, multiply the argument by ten.
834081fbbfbSschwarzeOtherwise, move the cursor to the beginning of the edit buffer.
835081fbbfbSschwarzeCan be used as a movement command after
836081fbbfbSschwarze.Ic vi_change_meta ,
837081fbbfbSschwarze.Ic vi_delete_meta ,
838081fbbfbSschwarzeor
839081fbbfbSschwarze.Ic vi_yank .
840081fbbfbSschwarze.El
841081fbbfbSschwarze.Ss Macros
842081fbbfbSschwarzeIf an input character is bound to the editor command
843081fbbfbSschwarze.Ic ed-sequence-lead-in ,
844081fbbfbSschwarze.Nm
845081fbbfbSschwarzeattempts to call a macro.
846081fbbfbSschwarzeIf the input character by itself forms the name of a macro, that
847081fbbfbSschwarzemacro is executed.
848081fbbfbSschwarzeOtherwise, additional input characters are read until the string
849081fbbfbSschwarzeread forms the name of a macro, in which case that macro is executed,
850081fbbfbSschwarzeor until the string read matches the beginning of none of the existing
851081fbbfbSschwarzemacro names, in which case the string including the final, mismatching
852081fbbfbSschwarzecharacter is discarded and the terminal bell is rung.
853081fbbfbSschwarze.Pp
854081fbbfbSschwarzeThere are two kinds of macros.
855081fbbfbSschwarzeCommand macros execute a single editor command.
856081fbbfbSschwarzeKeyboard macros return a string of characters that is appended
857081fbbfbSschwarzeas a new line to the
858081fbbfbSschwarze.Sx Input Queue .
859081fbbfbSschwarze.Pp
860081fbbfbSschwarzeThe following command macros are defined by default in vi command
861081fbbfbSschwarzemode and in emacs mode:
862081fbbfbSschwarze.Bl -column -offset indent "Esc O A, Esc O A" "em-exchange-mark"
863081fbbfbSschwarze.It Esc \&[ A, Esc O A Ta Ic ed-prev-history
864081fbbfbSschwarze.It Esc \&[ B, Esc O B Ta Ic ed-next-history
865081fbbfbSschwarze.It Esc \&[ C, Esc O C Ta Ic ed-next-char
866081fbbfbSschwarze.It Esc \&[ D, Esc O D Ta Ic ed-prev-char
867081fbbfbSschwarze.It Esc \&[ F, Esc O F Ta Ic ed-move-to-end
868081fbbfbSschwarze.It Esc \&[ H, Esc O H Ta Ic ed-move-to-beg
869081fbbfbSschwarze.El
870081fbbfbSschwarze.Pp
871081fbbfbSschwarzeIn vi command mode, they are also defined by default without the
872081fbbfbSschwarzeinitial escape character.
873081fbbfbSschwarze.Pp
874081fbbfbSschwarzeIn addition, the
875081fbbfbSschwarze.Nm
876081fbbfbSschwarzelibrary tries to bind the strings generated by the arrow keys
877081fbbfbSschwarzeas reported by the
878081fbbfbSschwarze.Xr terminfo 5
879081fbbfbSschwarzedatabase to these editor commands, unless that would clobber
880081fbbfbSschwarzeuser settings.
881081fbbfbSschwarze.Pp
882081fbbfbSschwarzeIn emacs mode, the two-character string
883081fbbfbSschwarze.Dq Ctrl-X Ctrl-X
884081fbbfbSschwarzeis bound to the
885081fbbfbSschwarze.Ic em-exchange-mark
886081fbbfbSschwarzeeditor command.
887081fbbfbSschwarze.Ss Input Queue
888081fbbfbSschwarzeThe
889081fbbfbSschwarze.Nm
890081fbbfbSschwarzelibrary maintains an input queue operated in FIFO mode.
891081fbbfbSschwarzeWhenever it needs an input character, it takes the first character
892081fbbfbSschwarzefrom the first line of the input queue.
893081fbbfbSschwarzeWhen the queue is empty, it reads from the terminal.
894081fbbfbSschwarze.Pp
895081fbbfbSschwarzeA line can be appended to the end of the input queue in several ways:
896081fbbfbSschwarze.Bl -dash -offset indent
897081fbbfbSschwarze.It
898081fbbfbSschwarzeBy calling one of the keyboard
899081fbbfbSschwarze.Sx Macros .
900081fbbfbSschwarze.It
901081fbbfbSschwarzeBy calling the editor command
902081fbbfbSschwarze.Ic vi-redo .
903081fbbfbSschwarze.It
904081fbbfbSschwarzeBy calling the editor command
905081fbbfbSschwarze.Ic vi-alias .
906081fbbfbSschwarze.It
907081fbbfbSschwarzeBy pressing a key in emacs incremental search mode that doesn't
908081fbbfbSschwarzehave a special meaning in that mode but returns to normal emacs
909081fbbfbSschwarzemode.
910081fbbfbSschwarze.It
911081fbbfbSschwarzeIf an application program directly calls the functions
912081fbbfbSschwarze.Xr el_push 3
913081fbbfbSschwarzeor
914081fbbfbSschwarze.Xr el_wpush 3 ,
915081fbbfbSschwarzeit can provide additional, program-specific ways
916081fbbfbSschwarzeof appending to the input queue.
917081fbbfbSschwarze.El
918081fbbfbSschwarze.Sh SEE ALSO
919081fbbfbSschwarze.Xr mg 1 ,
920081fbbfbSschwarze.Xr vi 1 ,
921081fbbfbSschwarze.Xr editline 3 ,
922081fbbfbSschwarze.Xr editrc 5
923081fbbfbSschwarze.Sh HISTORY
924081fbbfbSschwarzeThis manual page first appeared in
925081fbbfbSschwarze.Ox 6.0 .
926081fbbfbSschwarze.Sh AUTHORS
927081fbbfbSschwarze.An -nosplit
928081fbbfbSschwarzeThis manual page was written by
929081fbbfbSschwarze.An Ingo Schwarze Aq Mt schwarze@openbsd.org .
930