comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/share/man/man7/editline.7 @ 68:5028fdace37b

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 16:23:26 -0400
parents
children
comparison
equal deleted inserted replaced
67:0e9998148a16 68:5028fdace37b
1 .TH EDITLINE 7 "April 6, 2024" ""
2 .SH NAME
3 \fBeditline\fP
4 \- line editing user interface
5 .SH DESCRIPTION
6 When a program using the
7 \fBeditline\fP(3)
8 library prompts for an input string using the function
9 \fBel_wgets\fP(3),
10 it reads characters from the terminal.
11 Invalid input bytes that do not form characters are silently
12 discarded.
13 For each character read, one editor command is executed.
14 The mapping of input characters to editor commands depends on the
15 editing mode.
16 There are three editing modes: vi insert mode, vi command mode,
17 and emacs mode.
18 The default is vi insert mode.
19 The program can switch the default to emacs mode by using the
20 \fBel_set\fP(3)
21 or
22 \fBel_parse\fP(3)
23 functions, and the user can switch to emacs mode either in the
24 \fBeditrc\fP(5)
25 configuration file or interactively with the
26 \fBed-command\fP
27 editor command, in all three cases executing the
28 \fBbind Fl e\fP
29 builtin command.
30
31 If trying to read from the terminal results in end of file or an
32 error, the library signals end of file to the program and does not
33 return a string.
34 .SS Input character bindings
35 All default bindings described below can be overridden by individual
36 programs and can be changed with the
37 \fBeditrc\fP(5)
38 \fBbind\fP
39 builtin command.
40
41 In the following tables,
42 `Ctrl-'
43 indicates a character with the bit 0x40 flipped, and
44 `Meta-'
45 indicates a character with the bit 0x80 set.
46 In vi insert mode and in emacs mode, all Meta-characters considered
47 printable by the current
48 \fBlocale\fP(1)
49 are bound to
50 \fBed-insert\fP
51 instead of to the editor command listed below.
52 Consequently, in UTF-8 mode, most of the Meta-characters are not
53 directly accessible because their code points are occupied by
54 printable Unicode characters, and Meta-characters are usually input
55 using the
56 \fBem-meta-next\fP
57 editor command.
58 For example, to enter
59 `Meta-B'
60 in order to call the
61 \fBed-prev-word\fP
62 editor command in emacs mode, call
63 \fBem-meta-next\fP
64 by pressing and releasing the escape key (or equivalently, Ctrl-[),
65 then press and release the
66 `B'
67 key.
68 If you have configured a Meta-key on your keyboard, for example
69 with
70 `setxkbmap' -option altwin:left_meta_win ,
71 the Ctrl-Meta-characters are directly accessible.
72 For example, to enter
73 `Ctrl-Meta-H'
74 in order to call the
75 \fBed-delete-prev-word\fP
76 editor command in emacs mode, hold down the keys
77 `Ctrl',
78 `Meta',
79 and
80 `H'
81 at the same time.
82 Alternatively, press and release the escape key, then press and
83 release
84 `Ctrl-H'.
85
86 In vi input mode, input characters are bound to the following editor
87 commands by default:
88 It Ctrl-D, EOF Ta \fBvi-list-or-eof\fP
89 It Ctrl-H, BS Ta \fBvi-delete-prev-char\fP
90 It Ctrl-J, LF Ta \fBed-newline\fP
91 It Ctrl-M, CR Ta \fBed-newline\fP
92 It Ctrl-Q Ta \fBed-tty-start-output\fP
93 It Ctrl-S Ta \fBed-tty-stop-output\fP
94 It Ctrl-U Ta \fBvi-kill-line-prev\fP
95 It Ctrl-V Ta \fBed-quoted-insert\fP
96 It Ctrl-W Ta \fBed-delete-prev-word\fP
97 It Ctrl-[, ESC Ta \fBvi-command-mode\fP
98 It Ctrl-\e, QUIT Ta \fBed-tty-sigquit\fP
99 It Ctrl-?, DEL Ta \fBvi-delete-prev-char\fP
100
101 All other input characters except the NUL character (Ctrl-@) are
102 bound to
103 \fBed-insert\fP.
104
105 In vi command mode, input characters are bound to the following
106 editor commands by default:
107 It Ctrl-A Ta \fBed-move-to-beg\fP
108 It Ctrl-C, INT Ta \fBed-tty-sigint\fP
109 It Ctrl-E Ta \fBed-move-to-end\fP
110 It Ctrl-H, BS Ta \fBed-delete-prev-char\fP
111 It Ctrl-J, LF Ta \fBed-newline\fP
112 It Ctrl-K Ta \fBed-kill-line\fP
113 It Ctrl-L, FF Ta \fBed-clear-screen\fP
114 It Ctrl-M, CR Ta \fBed-newline\fP
115 It Ctrl-N Ta \fBed-next-history\fP
116 It Ctrl-O Ta \fBed-tty-flush-output\fP
117 It Ctrl-P Ta \fBed-prev-history\fP
118 It Ctrl-Q Ta \fBed-tty-start-output\fP
119 It Ctrl-R Ta \fBed-redisplay\fP
120 It Ctrl-S Ta \fBed-tty-stop-output\fP
121 It Ctrl-U Ta \fBvi-kill-line-prev\fP
122 It Ctrl-W Ta \fBed-delete-prev-word\fP
123 It Ctrl-[, ESC Ta \fBem-meta-next\fP
124 It Ctrl-\e, QUIT Ta \fBed-tty-sigquit\fP
125 It Space Ta \fBed-next-char\fP
126 It # Ta \fBvi-comment-out\fP
127 It $ Ta \fBed-move-to-end\fP
128 It % Ta \fBvi-match\fP
129 It + Ta \fBed-next-history\fP
130 It \&, Ta \fBvi-repeat-prev-char\fP
131 It - Ta \fBed-prev-history\fP
132 It \&. Ta \fBvi-redo\fP
133 It / Ta \fBvi-search-prev\fP
134 It 0 Ta \fBvi-zero\fP
135 It 1 to 9 Ta \fBed-argument-digit\fP
136 It \&: Ta \fBed-command\fP
137 It \&; Ta \fBvi-repeat-next-char\fP
138 It \&? Ta \fBvi-search-next\fP
139 It @ Ta \fBvi-alias\fP
140 It A Ta \fBvi-add-at-eol\fP
141 It B Ta \fBvi-prev-big-word\fP
142 It C Ta \fBvi-change-to-eol\fP
143 It D Ta \fBed-kill-line\fP
144 It E Ta \fBvi-end-big-word\fP
145 It F Ta \fBvi-prev-char\fP
146 It G Ta \fBvi-to-history-line\fP
147 It I Ta \fBvi-insert-at-bol\fP
148 It J Ta \fBed-search-next-history\fP
149 It K Ta \fBed-search-prev-history\fP
150 It N Ta \fBvi-repeat-search-prev\fP
151 It O Ta \fBed-sequence-lead-in\fP
152 It P Ta \fBvi-paste-prev\fP
153 It R Ta \fBvi-replace-mode\fP
154 It S Ta \fBvi-substitute-line\fP
155 It T Ta \fBvi-to-prev-char\fP
156 It U Ta \fBvi-undo-line\fP
157 It W Ta \fBvi-next-big-word\fP
158 It X Ta \fBed-delete-prev-char\fP
159 It Y Ta \fBvi-yank-end\fP
160 It \&[ Ta \fBed-sequence-lead-in\fP
161 It ^ Ta \fBed-move-to-beg\fP
162 It _ Ta \fBvi-history-word\fP
163 It a Ta \fBvi-add\fP
164 It b Ta \fBvi-prev-word\fP
165 It c Ta \fBvi-change-meta\fP
166 It d Ta \fBvi-delete-meta\fP
167 It e Ta \fBvi-end-word\fP
168 It f Ta \fBvi-next-char\fP
169 It h Ta \fBed-prev-char\fP
170 It i Ta \fBvi-insert\fP
171 It j Ta \fBed-next-history\fP
172 It k Ta \fBed-prev-history\fP
173 It l Ta \fBed-next-char\fP
174 It n Ta \fBvi-repeat-search-next\fP
175 It p Ta \fBvi-paste-next\fP
176 It r Ta \fBvi-replace-char\fP
177 It s Ta \fBvi-substitute-char\fP
178 It t Ta \fBvi-to-next-char\fP
179 It u Ta \fBvi-undo\fP
180 It v Ta \fBvi-histedit\fP
181 It w Ta \fBvi-next-word\fP
182 It x Ta \fBed-delete-next-char\fP
183 It y Ta \fBvi-yank\fP
184 It \&| Ta \fBvi-to-column\fP
185 It ~ Ta \fBvi-change-case\fP
186 It Ctrl-?, DEL Ta \fBed-delete-prev-char\fP
187 It Meta-O Ta \fBed-sequence-lead-in\fP
188 It Meta-[ Ta \fBed-sequence-lead-in\fP
189
190 In emacs mode, input characters are bound to the following editor
191 commands by default:
192 It 0 to 9 Ta \fBed-digit\fP
193 It Ctrl-@, NUL Ta \fBem-set-mark\fP
194 It Ctrl-A Ta \fBed-move-to-beg\fP
195 It Ctrl-B Ta \fBed-prev-char\fP
196 It Ctrl-C, INT Ta \fBed-tty-sigint\fP
197 It Ctrl-D, EOF Ta \fBem-delete-or-list\fP
198 It Ctrl-E Ta \fBed-move-to-end\fP
199 It Ctrl-F Ta \fBed-next-char\fP
200 It Ctrl-H, BS Ta \fBem-delete-prev-char\fP
201 It Ctrl-J, LF Ta \fBed-newline\fP
202 It Ctrl-K Ta \fBed-kill-line\fP
203 It Ctrl-L, FF Ta \fBed-clear-screen\fP
204 It Ctrl-M, CR Ta \fBed-newline\fP
205 It Ctrl-N Ta \fBed-next-history\fP
206 It Ctrl-O Ta \fBed-tty-flush-output\fP
207 It Ctrl-P Ta \fBed-prev-history\fP
208 It Ctrl-Q Ta \fBed-tty-start-output\fP
209 It Ctrl-R Ta \fBed-redisplay\fP
210 It Ctrl-S Ta \fBed-tty-stop-output\fP
211 It Ctrl-T Ta \fBed-transpose-chars\fP
212 It Ctrl-U Ta \fBed-kill-line\fP
213 It Ctrl-V Ta \fBed-quoted-insert\fP
214 It Ctrl-W Ta \fBem-kill-region\fP
215 It Ctrl-X Ta \fBed-sequence-lead-in\fP
216 It Ctrl-Y Ta \fBem-yank\fP
217 It Ctrl-Z, TSTP Ta \fBed-tty-sigtstp\fP
218 It Ctrl-[, ESC Ta \fBem-meta-next\fP
219 It Ctrl-\e, QUIT Ta \fBed-tty-sigquit\fP
220 It Ctrl-] Ta \fBed-tty-dsusp\fP
221 It Ctrl-?, DEL Ta \fBem-delete-prev-char\fP
222 It Ctrl-Meta-H Ta \fBed-delete-prev-word\fP
223 It Ctrl-Meta-L Ta \fBed-clear-screen\fP
224 It Ctrl-Meta-_ Ta \fBem-copy-prev-word\fP
225 It Meta-0 to 9 Ta \fBed-argument-digit\fP
226 It Meta-B Ta \fBed-prev-word\fP
227 It Meta-C Ta \fBem-capitol-case\fP
228 It Meta-D Ta \fBem-delete-next-word\fP
229 It Meta-F Ta \fBem-next-word\fP
230 It Meta-L Ta \fBem-lower-case\fP
231 It Meta-N Ta \fBed-search-next-history\fP
232 It Meta-O Ta \fBed-sequence-lead-in\fP
233 It Meta-P Ta \fBed-search-prev-history\fP
234 It Meta-U Ta \fBem-upper-case\fP
235 It Meta-W Ta \fBem-copy-region\fP
236 It Meta-X Ta \fBed-command\fP
237 It Meta-[ Ta \fBed-sequence-lead-in\fP
238 It Meta-b Ta \fBed-prev-word\fP
239 It Meta-c Ta \fBem-capitol-case\fP
240 It Meta-d Ta \fBem-delete-next-word\fP
241 It Meta-f Ta \fBem-next-word\fP
242 It Meta-l Ta \fBem-lower-case\fP
243 It Meta-n Ta \fBed-search-next-history\fP
244 It Meta-p Ta \fBed-search-prev-history\fP
245 It Meta-u Ta \fBem-upper-case\fP
246 It Meta-w Ta \fBem-copy-region\fP
247 It Meta-x Ta \fBed-command\fP
248 It Ctrl-Meta-? Ta \fBed-delete-prev-word\fP
249
250 The remaining
251 \fBascii\fP(7)
252 characters in the range 0x20 to 0x7e are bound to
253 \fBed-insert\fP.
254
255 If standard output is not connected to a terminal device
256 or
257 \fBel_set\fP(3)
258 was used to set
259 EL_EDITMODE
260 to 0, all input character bindings are disabled and all characters
261 typed are appended to the edit buffer.
262 In that case, the edit buffer is returned to the program after a
263 newline or carriage return character is typed, or after the first
264 character typed if
265 \fBel_set\fP(3)
266 was used to set
267 EL_UNBUFFERED
268 to non-zero.
269 .SS Editor commands
270 Most editor commands accept an optional argument.
271 The argument is entered by prefixing the editor command with one
272 or more of the editor commands
273 \fBed-argument-digit\fP,
274 \fBed-digit\fP,
275 \fBem-universal-argument\fP,
276 or
277 \fBvi-zero\fP.
278 When an argument is not provided, it defaults to 1.
279 For most editor commands, the effect of an argument is to repeatedly
280 execute the command that number of times.
281
282 When talking about a character string from a left character to a
283 right character, the left character is included in the string, while
284 the right character is not included.
285
286 If an editor command causes an error, the input character is discarded,
287 no action occurs, and the terminal bell is rung.
288 In case of a non-fatal error, the terminal bell is also rung,
289 but the editor command takes effect anyway.
290
291 In the following list, the default key bindings are listed after
292 each editor command.
293 .TP
294 \fBed-argument-digit Pq vi command: 1 to 9; emacs: Meta-0 to Meta-9\fP
295 If in argument input mode, append the input digit to the argument
296 being read.
297 Otherwise, switch to argument input mode and use the input digit
298 as the most significant digit of the argument.
299 It is an error if the input character is not a digit or if the
300 existing argument is already greater than a million.
301 .TP
302 \fBed-clear-screen Pq vi command: Ctrl-L; emacs: Ctrl-L, Ctrl-Meta-L\fP
303 Clear the screen and display the edit buffer at the top.
304 Ignore any argument.
305 .TP
306 \fBed-command Pq vi command: So \&: Sc ; emacs: Meta-X, Meta-x\fP
307 Read a line from the terminal bypassing the normal line editing
308 functionality and execute that line as an
309 \fBeditrc\fP(5)
310 builtin command.
311 If in vi command mode, also switch back to vi insert mode.
312 Ignore any argument.
313 .TP
314 \fBed-delete-next-char Pq vi command: x\fP
315 Delete the character at the cursor position.
316 With an argument, delete that number of characters.
317 In emacs mode, it is an error if the cursor is at the end of the
318 edit buffer.
319 In vi mode, the last character in the edit buffer is deleted in
320 that case, and it is an error if the buffer is empty.
321 .TP
322 \fBed-delete-prev-char Pq vi command: X, Ctrl-H, BS, Ctrl-?, DEL\fP
323 Delete the character to the left of the cursor position.
324 With an argument, delete that number of characters.
325 It is an error if the cursor is at the beginning of the edit buffer.
326 .TP
327 \fBed-delete-prev-word Pq vi: Ctrl-W; emacs: Ctrl-Meta-H, Ctrl-Meta-?\fP
328 Move to the left to the closest beginning of a word, delete the
329 string from that position to the cursor, and save it to the cut
330 buffer.
331 With an argument, delete that number of words.
332 It is an error if the cursor is at the beginning of the edit buffer.
333 .TP
334 \fBed-digit Pq emacs: 0 to 9\fP
335 If in argument input mode, append the input digit to the argument
336 being read.
337 Otherwise, call
338 \fBed-insert\fP.
339 It is an error if the input character is not a digit or if the
340 existing argument is already greater than a million.
341 .TP
342 \fBed-end-of-file Pq not bound by default\fP
343 Discard the edit buffer and indicate end of file to the program.
344 Ignore any argument.
345 .TP
346 \fBed-ignore Pq various\fP
347 Discard the input character and do nothing.
348 .TP
349 \fBed-insert Pq vi input: almost all; emacs: printable characters\fP
350 In insert mode, insert the input character left of the cursor
351 position.
352 In replace mode, overwrite the character at the cursor and move the
353 cursor to the right by one character position.
354 Accept an argument to do this repeatedly.
355 It is an error if the input character is the NUL character (Ctrl-@).
356 Failure to enlarge the edit buffer also results in an error.
357 .TP
358 \fBed-kill-line Pq vi command: D, Ctrl-K; emacs: Ctrl-K, Ctrl-U\fP
359 Delete the string from the cursor position to the end of the line
360 and save it to the cut buffer.
361 Ignore any argument.
362 .TP
363 \fBed-move-to-beg Pq vi command: ^, Ctrl-A; emacs: Ctrl-A\fP
364 In vi mode, move the cursor to the first non-space character in the
365 edit buffer.
366 In emacs mode, move the cursor to the beginning of the edit buffer.
367 Ignore any argument.
368 Can be used as a movement command after
369 \fBvi_change_meta\fP,
370 \fBvi_delete_meta\fP,
371 or
372 \fBvi_yank\fP.
373 .TP
374 \fBed-move-to-end Pq vi command: $, Ctrl-E; emacs: Ctrl-E\fP
375 Move the cursor to the end of the edit buffer.
376 Ignore any argument.
377 Can be used as a movement command after
378 \fBvi_change_meta\fP,
379 \fBvi_delete_meta\fP,
380 or
381 \fBvi_yank\fP.
382 .TP
383 \fBed-newline Pq all modes: Ctrl-J, LF, Ctrl-M, CR\fP
384 Append a newline character to the edit buffer and return the edit
385 buffer to the program.
386 Ignore any argument.
387 .TP
388 \fBed-next-char Pq vi command: Space, l; emacs: Ctrl-F\fP
389 Move the cursor one character position to the right.
390 With an argument, move by that number of characters.
391 Can be used as a movement command after
392 \fBvi_change_meta\fP,
393 \fBvi_delete_meta\fP,
394 or
395 \fBvi_yank\fP.
396 It is an error if the cursor is already at the end of the edit
397 buffer.
398 .TP
399 \fBed-next-history Pq vi command: j, +, Ctrl-N; emacs: Ctrl-N\fP
400 Replace the edit buffer with the next history line.
401 That line is older than the current line.
402 With an argument, go forward by that number of history lines.
403 It is a non-fatal error to advance by more lines than are available.
404 .TP
405 \fBed-next-line Pq not bound by default\fP
406 Move the cursor down one line.
407 With an argument, move down by that number of lines.
408 It is an error if the edit buffer does not contain enough newline
409 characters to the right of the cursor position.
410 .TP
411 \fBed-prev-char Pq vi command: h; emacs: Ctrl-B\fP
412 Move the cursor one character position to the left.
413 With an argument, move by that number of characters.
414 Can be used as a movement command after
415 \fBvi_change_meta\fP,
416 \fBvi_delete_meta\fP,
417 or
418 \fBvi_yank\fP.
419 It is an error if the cursor is already at the beginning of the
420 edit buffer.
421 .TP
422 \fBed-prev-history Pq vi command: k, -, Ctrl-P; emacs: Ctrl-P\fP
423 Replace the edit buffer with the previous history line.
424 That line is newer than the current line.
425 With an argument, go back by that number of lines.
426 It is a non-fatal error to back up by more lines than are available.
427 .TP
428 \fBed-prev-line Pq not bound by default\fP
429 Move the cursor up one line.
430 With an argument, move up by that number of lines.
431 It is an error if the edit buffer does not contain enough newline
432 characters to the left of the cursor position.
433 .TP
434 \fBed-prev-word Pq emacs: Meta-B, Meta-b\fP
435 Move the cursor to the left to the closest beginning of a word.
436 With an argument, repeat that number of times.
437 Can be used as a movement command after
438 \fBvi_change_meta\fP,
439 \fBvi_delete_meta\fP,
440 or
441 \fBvi_yank\fP.
442 It is an error if the cursor is already at the beginning of the
443 edit buffer.
444 .TP
445 \fBed-quoted-insert Pq vi insert, emacs: Ctrl-V\fP
446 Read one character from the terminal bypassing the normal line
447 editing functionality and call
448 \fBed-insert\fP
449 on it.
450 If trying to read the character returns end of file or an error,
451 call
452 \fBed-end-of-file\fP
453 instead.
454 .TP
455 \fBed-redisplay Pq vi command, emacs: Ctrl-R\fP
456 Redisplay everything.
457 Ignore any argument.
458 .TP
459 \fBed-search-next-history Pq vi command: J; emacs: Meta-N, Meta-n\fP
460 Replace the edit buffer with the next matching history entry.
461 .TP
462 \fBed-search-prev-history Pq vi command: K; emacs: Meta-P, Meta-p\fP
463 Replace the edit buffer with the previous matching history entry.
464 .TP
465 \fBed-sequence-lead-in Pq vi cmd: O, \&[; emacs: Ctrl-X;\\fP
466 both: Meta-O, Meta-[
467 Call a macro.
468 See the section about
469 .B Macros
470 below for details.
471 .TP
472 \fBed-start-over Pq not bound by default\fP
473 Discard the contents of the edit buffer and start from scratch.
474 Ignore any argument.
475 .TP
476 \fBed-transpose-chars Pq emacs: Ctrl-T\fP
477 Exchange the character at the cursor position with the one to the
478 left of it and move the cursor to the character to the right of the
479 two exchanged characters.
480 Ignore any argument.
481 It is an error if the cursor is at the beginning of the edit buffer
482 or if the edit buffer contains less than two characters.
483 .TP
484 \fBed-unassigned Pq all characters not listed\fP
485 This editor command always results in an error.
486 .TP
487 \fBem-capitol-case Pq emacs: Meta-C, Meta-c\fP
488 Capitalize the string from the cursor to the end of the current
489 word.
490 That is, if it contains at least one alphabetic character, convert
491 the first alphabetic character to upper case, and convert all
492 characters to the right of it to lower case.
493 In any case, move the cursor to the next character after the end
494 of the current word.
495 .TP
496 \fBem-copy-prev-word Pq emacs: Ctrl-Meta-_\fP
497 Copy the string from the beginning of the current word to the cursor
498 and insert it to the left of the cursor.
499 Move the cursor to the character after the inserted string.
500 It is an error if the cursor is at the beginning of the edit buffer.
501 .TP
502 \fBem-copy-region Pq emacs: Meta-W, Meta-w\fP
503 Copy the string from the cursor to the mark to the cut buffer.
504 It is an error if the mark is not set.
505 .TP
506 \fBem-delete-next-word Pq emacs: Meta-D, Meta-d\fP
507 Delete the string from the cursor to the end of the current word
508 and save it to the cut buffer.
509 It is an error if the cursor is at the end of the edit buffer.
510 .TP
511 \fBem-delete-or-list Pq emacs: Ctrl-D, EOF\fP
512 If the cursor is not at the end of the line, delete the character
513 at the cursor.
514 If the edit buffer is empty, indicate end of file to the program.
515 It is an error if the cursor is at the end of the edit buffer and
516 the edit buffer is not empty.
517 .TP
518 \fBem-delete-prev-char Pq emacs: Ctrl-H, BS, Ctrl-?, DEL\fP
519 Delete the character to the left of the cursor.
520 It is an error if the cursor is at the beginning of the edit buffer.
521 .TP
522 \fBem-exchange-mark Pq not bound by default\fP
523 Exchange the cursor and the mark.
524 .TP
525 \fBem-gosmacs-transpose Pq not bound by default\fP
526 Exchange the two characters to the left of the cursor.
527 It is an error if the cursor is on the first or second character
528 of the edit buffer.
529 .TP
530 \fBem-inc-search-next Pq not bound by default\fP
531 Emacs incremental next search.
532 .TP
533 \fBem-inc-search-prev Pq not bound by default\fP
534 Emacs incremental reverse search.
535 .TP
536 \fBem-kill-line Pq not bound by default\fP
537 Delete the entire contents of the edit buffer and save it to the
538 cut buffer.
539 .TP
540 \fBem-kill-region Pq emacs: Ctrl-W\fP
541 Delete the string from the cursor to the mark and save it to the
542 cut buffer.
543 It is an error if the mark is not set.
544 .TP
545 \fBem-lower-case Pq emacs: Meta-L, Meta-l\fP
546 Convert the characters from the cursor to the end of the current
547 word to lower case.
548 .TP
549 \fBem-meta-next Pq vi command, emacs: Ctrl-[, ESC\fP
550 Set the bit 0x80 on the next character typed.
551 Unless the resulting code point is printable, holding down the
552 `Meta-'
553 key while typing that character is a simpler way to achieve the
554 same effect.
555 .TP
556 \fBem-next-word Pq Meta-F, Meta-f\fP
557 Move the cursor to the end of the current word.
558 Can be used as a movement command after
559 \fBvi_change_meta\fP,
560 \fBvi_delete_meta\fP,
561 or
562 \fBvi_yank\fP.
563 It is an error if the cursor is already at the end of the edit
564 buffer.
565 .TP
566 \fBem-set-mark Pq emacs: Ctrl-Q, NUL\fP
567 Set the mark at the current cursor position.
568 .TP
569 \fBem-toggle-overwrite Pq insert\fP
570 Switch from insert to overwrite mode or vice versa.
571 .TP
572 \fBem-universal-argument Pq not bound by default\fP
573 If in argument input mode, multiply the argument by 4.
574 Otherwise, switch to argument input mode and set the argument to 4.
575 It is an error if the existing argument is already greater than a
576 million.
577 .TP
578 \fBem-upper-case Pq emacs: Meta-U, Meta-u\fP
579 Convert the characters from the cursor to the end of the current
580 word to upper case.
581 .TP
582 \fBem-yank Pq emacs: Ctrl-Y\fP
583 Paste the cut buffer to the left of the cursor.
584 .TP
585 \fBvi-add Pq vi command: a\fP
586 Switch to vi insert mode.
587 Unless the cursor is already at the end of the edit buffer, move
588 it one character position to the right.
589 .TP
590 \fBvi-add-at-eol Pq vi command: A\fP
591 Switch to vi insert mode and move the cursor to the end of the edit
592 buffer.
593 .TP
594 \fBvi-alias Pq vi command: @\fP
595 If an alias function was defined by calling the
596 \fBel_set\fP(3)
597 or
598 \fBel_wset\fP(3)
599 function with the argument
600 EL_ALIAS_TEXT ,
601 read one character from the terminal bypassing the normal line
602 editing functionality, call the alias function passing the argument that was specified with
603 EL_ALIAS_TEXT
604 as the first argument and the character read, with an underscore
605 prepended, as the second argument, and pass the string returned
606 from the alias function to
607 \fBel_wpush\fP(3).
608 It is an error if no alias function is defined or if trying to read
609 the character results in end of file or an error.
610 .TP
611 \fBvi-change-case Pq vi command: ~\fP
612 Change the case of the character at the cursor and move the cursor
613 one character position to the right.
614 It is an error if the cursor is already at the end of the edit
615 buffer.
616 .TP
617 \fBvi-change-meta Pq vi command: c\fP
618 Delete the string from the cursor to the position specified by the
619 following movement command and save a copy of it to the cut buffer.
620 When given twice in a row, instead delete the whole contents of the
621 edit buffer and save a copy of it to the cut buffer.
622 In either case, switch to vi insert mode after that.
623 .TP
624 \fBvi-change-to-eol Pq vi command: C\fP
625 Delete the string from the cursor position to the end of the line
626 and save it to the cut buffer, then switch to vi insert mode.
627 .TP
628 \fBvi-command-mode Pq vi insert: Ctrl-[, ESC\fP
629 Discard pending actions and arguments and switch to vi command mode.
630 Unless the cursor is already at the beginning of the edit buffer,
631 move it to the left by one character position.
632 .TP
633 \fBvi-comment-out Pq vi command: #\fP
634 Insert a
635 `#'
636 character at the beginning of the edit buffer and return the edit
637 buffer to the program.
638 .TP
639 \fBvi-delete-meta Pq vi command: d\fP
640 Delete the string from the cursor to the position specified by the
641 following movement command and save a copy of it to the cut buffer.
642 When given twice in a row, instead delete the whole contents of the
643 edit buffer and save a copy of it to the cut buffer.
644 .TP
645 \fBvi-delete-prev-char Pq vi insert: Ctrl-H, BS, Ctrl-?, DEL\fP
646 Delete the character to the left of the cursor.
647 It is an error if the cursor is already at the beginning of the
648 edit buffer.
649 .TP
650 \fBvi-end-big-word Pq vi command: E\fP
651 Move the cursor to the end of the current space delimited word.
652 Can be used as a movement command after
653 \fBvi_change_meta\fP,
654 \fBvi_delete_meta\fP,
655 or
656 \fBvi_yank\fP.
657 It is an error if the cursor is already at the end of the edit
658 buffer.
659 .TP
660 \fBvi-end-word Pq vi command: e\fP
661 Move the cursor to the end of the current word.
662 Can be used as a movement command after
663 \fBvi_change_meta\fP,
664 \fBvi_delete_meta\fP,
665 or
666 \fBvi_yank\fP.
667 It is an error if the cursor is already at the end of the edit
668 buffer.
669 .TP
670 \fBvi-history-word Pq vi command: _\fP
671 Insert the first word from the most recent history entry after the
672 cursor, move the cursor after to the character after the inserted
673 word, and switch to vi insert mode.
674 It is an error if there is no history entry or the most recent
675 history entry is empty.
676 .TP
677 \fBvi-insert Pq vi command: i\fP
678 Enter insert mode.
679 .TP
680 \fBvi-insert-at-bol Pq vi command: I\fP
681 Move the cursor to the beginning of the edit buffer and switch to
682 vi insert mode.
683 .TP
684 \fBvi-kill-line-prev Pq vi: Ctrl-U\fP
685 Delete the string from the beginning of the edit buffer to the
686 cursor and save it to the cut buffer.
687 .TP
688 \fBvi-list-or-eof Pq vi insert: Ctrl-D, EOF\fP
689 If the edit buffer is empty, indicate end of file to the program.
690 It is an error if the edit buffer is not empty.
691 .TP
692 \fBvi-match Pq vi command: %\fP
693 Consider opening and closing parentheses, braces, and brackets as
694 delimiters.
695 If the cursor is not at a delimiter, move it to the right until it
696 gets to one, then move it to the matching delimiter.
697 Can be used as a movement command after
698 \fBvi_change_meta\fP,
699 \fBvi_delete_meta\fP,
700 or
701 \fBvi_yank\fP.
702 It is an error if there is no delimiter at the cursor or in the
703 string to the right of the cursor, or if the first such delimiter
704 has no matching delimiter.
705 .TP
706 \fBvi-next-big-word Pq vi command: W\fP
707 Move the cursor to the right to the beginning of the next space
708 delimited word.
709 Can be used as a movement command after
710 \fBvi_change_meta\fP,
711 \fBvi_delete_meta\fP,
712 or
713 \fBvi_yank\fP.
714 It is an error if the cursor is already at the end of the edit
715 buffer or on its last character.
716 .TP
717 \fBvi-next-char Pq vi command: f\fP
718 Read one character from the terminal bypassing the normal line
719 editing functionality and move the cursor to the right to the next
720 instance of that character in the edit buffer.
721 Can be used as a movement command after
722 \fBvi_change_meta\fP,
723 \fBvi_delete_meta\fP,
724 or
725 \fBvi_yank\fP.
726 If trying to read the character results in end of file or an error,
727 call
728 \fBed-end-of-file\fP
729 instead.
730 It is an error if the character is not found searching to the right
731 in the edit buffer.
732 .TP
733 \fBvi-next-word Pq vi command: w\fP
734 Move the cursor to the right to the beginning of the next word.
735 Can be used as a movement command after
736 \fBvi_change_meta\fP,
737 \fBvi_delete_meta\fP,
738 or
739 \fBvi_yank\fP.
740 It is an error if the cursor is already at the end of the edit
741 buffer or on its last character.
742 .TP
743 \fBvi-paste-next Pq vi command: p\fP
744 Insert a copy of the cut buffer to the right of the cursor.
745 It is an error if the cut buffer is empty.
746 .TP
747 \fBvi-paste-prev Pq vi command: P\fP
748 Insert a copy of the cut buffer to the left of the cursor.
749 It is an error if the cut buffer is empty.
750 .TP
751 \fBvi-prev-big-word Pq vi command: B\fP
752 Move the cursor to the left to the next beginning of a space delimited
753 word.
754 Can be used as a movement command after
755 \fBvi_change_meta\fP,
756 \fBvi_delete_meta\fP,
757 or
758 \fBvi_yank\fP.
759 It is an error if the cursor is already at the beginning of the
760 edit buffer.
761 .TP
762 \fBvi-prev-char Pq vi command: F\fP
763 Read one character from the terminal bypassing the normal line
764 editing functionality and move the cursor to the left to the next
765 instance of that character in the edit buffer.
766 Can be used as a movement command after
767 \fBvi_change_meta\fP,
768 \fBvi_delete_meta\fP,
769 or
770 \fBvi_yank\fP.
771 If trying to read the character results in end of file or an error,
772 call
773 \fBed-end-of-file\fP
774 instead.
775 It is an error if the character is not found searching to the left
776 in the edit buffer.
777 .TP
778 \fBvi-prev-word Pq vi command: b\fP
779 Move the cursor to the left to the next beginning of a word.
780 Can be used as a movement command after
781 \fBvi_change_meta\fP,
782 \fBvi_delete_meta\fP,
783 or
784 \fBvi_yank\fP.
785 It is an error if the cursor is already at the beginning of the
786 edit buffer.
787 .TP
788 \fBvi-redo Pq vi command: Sq \&.\fP
789 Redo the last non-motion command.
790 .TP
791 \fBvi-repeat-next-char Pq vi command: Sq \&;\fP
792 Repeat the most recent character search in the same search direction.
793 Can be used as a movement command after
794 \fBvi_change_meta\fP,
795 \fBvi_delete_meta\fP,
796 or
797 \fBvi_yank\fP.
798 .TP
799 \fBvi-repeat-prev-char Pq vi command: Sq \&,\fP
800 Repeat the most recent character search in the opposite search
801 direction.
802 Can be used as a movement command after
803 \fBvi_change_meta\fP,
804 \fBvi_delete_meta\fP,
805 or
806 \fBvi_yank\fP.
807 .TP
808 \fBvi-repeat-search-next Pq vi command: n\fP
809 Repeat the most recent history search in the same search direction.
810 .TP
811 \fBvi-repeat-search-prev Pq vi command: N\fP
812 Repeat the most recent history search in the opposite search
813 direction.
814 .TP
815 \fBvi-replace-char Pq vi command: r\fP
816 Switch to vi replace mode, and automatically switch back to vi
817 command mode after the next character typed.
818 See
819 \fBed-insert\fP
820 for a description of replace mode.
821 It is an error if the cursor is at the end of the edit buffer.
822 .TP
823 \fBvi-replace-mode Pq vi command: R\fP
824 Switch to vi replace mode.
825 This is a variant of vi insert mode; see
826 \fBed-insert\fP
827 for the difference.
828 .TP
829 \fBvi-search-next Pq vi command: \&?\fP
830 Replace the edit buffer with the next matching history entry.
831 .TP
832 \fBvi-search-prev Pq vi command: /\fP
833 Replace the edit buffer with the previous matching history entry.
834 .TP
835 \fBvi-substitute-char Pq vi command: s\fP
836 Delete the character at the cursor and switch to vi insert mode.
837 .TP
838 \fBvi-substitute-line Pq vi command: S\fP
839 Delete the entire contents of the edit buffer, save a copy of it
840 in the cut buffer, and enter vi insert mode.
841 .TP
842 \fBvi-to-column Pq vi command: \&|\fP
843 Move the cursor to the column specified as the argument.
844 Can be used as a movement command after
845 \fBvi_change_meta\fP,
846 \fBvi_delete_meta\fP,
847 or
848 \fBvi_yank\fP.
849 .TP
850 \fBvi-to-history-line Pq vi command: G\fP
851 Replace the edit buffer with the specified history entry.
852 .TP
853 \fBvi-to-next-char Pq vi command: t\fP
854 Read one character from the terminal bypassing the normal line
855 editing functionality and move the cursor to the right to the
856 character before the next instance of that character in the edit
857 buffer.
858 Can be used as a movement command after
859 \fBvi_change_meta\fP,
860 \fBvi_delete_meta\fP,
861 or
862 \fBvi_yank\fP.
863 If trying to read the character results in end of file or an error,
864 call
865 \fBed-end-of-file\fP
866 instead.
867 It is an error if the character is not found searching to the right
868 in the edit buffer.
869 .TP
870 \fBvi-to-prev-char Pq vi command: T\fP
871 Read one character from the terminal bypassing the normal line
872 editing functionality and move the cursor to the left to the character
873 after the next instance of that character in the edit buffer.
874 Can be used as a movement command after
875 \fBvi_change_meta\fP,
876 \fBvi_delete_meta\fP,
877 or
878 \fBvi_yank\fP.
879 If trying to read the character results in end of file or an error,
880 call
881 \fBed-end-of-file\fP
882 instead.
883 It is an error if the character is not found searching to the left
884 in the edit buffer.
885 .TP
886 \fBvi-undo Pq vi command: u\fP
887 Undo the last change.
888 .TP
889 \fBvi-undo-line Pq vi command: U\fP
890 Undo all changes to the edit buffer.
891 .TP
892 \fBvi-yank Pq vi command: y\fP
893 Copy the string from the cursor to the position specified by the
894 following movement command to the cut buffer.
895 When given twice in a row, instead copy the whole contents of the
896 edit buffer to the cut buffer.
897 .TP
898 \fBvi-yank-end Pq vi command: Y\fP
899 Copy the string from the cursor to the end of the edit buffer to
900 the cut buffer.
901 .TP
902 \fBvi-zero Pq vi command: 0\fP
903 If in argument input mode, multiply the argument by ten.
904 Otherwise, move the cursor to the beginning of the edit buffer.
905 Can be used as a movement command after
906 \fBvi_change_meta\fP,
907 \fBvi_delete_meta\fP,
908 or
909 \fBvi_yank\fP.
910 .SS Macros
911 If an input character is bound to the editor command
912 \fBed-sequence-lead-in\fP,
913 \fBeditline\fP
914 attempts to call a macro.
915 If the input character by itself forms the name of a macro, that
916 macro is executed.
917 Otherwise, additional input characters are read until the string
918 read forms the name of a macro, in which case that macro is executed,
919 or until the string read matches the beginning of none of the existing
920 macro names, in which case the string including the final, mismatching
921 character is discarded and the terminal bell is rung.
922
923 There are two kinds of macros.
924 Command macros execute a single editor command.
925 Keyboard macros return a string of characters that is appended
926 as a new line to the
927 .B Input Queue .
928
929 The following command macros are defined by default in vi command
930 mode and in emacs mode:
931 It Esc \&[ A, Esc O A Ta \fBed-prev-history\fP
932 It Esc \&[ B, Esc O B Ta \fBed-next-history\fP
933 It Esc \&[ C, Esc O C Ta \fBed-next-char\fP
934 It Esc \&[ D, Esc O D Ta \fBed-prev-char\fP
935 It Esc \&[ F, Esc O F Ta \fBed-move-to-end\fP
936 It Esc \&[ H, Esc O H Ta \fBed-move-to-beg\fP
937
938 In vi command mode, they are also defined by default without the
939 initial escape character.
940
941 In addition, the
942 \fBeditline\fP
943 library tries to bind the strings generated by the arrow keys
944 as reported by the
945 \fBterminfo\fP(5)
946 database to these editor commands, unless that would clobber
947 user settings.
948
949 In emacs mode, the two-character string
950 ``Ctrl-X Ctrl-X''
951 is bound to the
952 \fBem-exchange-mark\fP
953 editor command.
954 .SS Input Queue
955 The
956 \fBeditline\fP
957 library maintains an input queue operated in FIFO mode.
958 Whenever it needs an input character, it takes the first character
959 from the first line of the input queue.
960 When the queue is empty, it reads from the terminal.
961
962 A line can be appended to the end of the input queue in several ways:
963 It
964 By calling one of the keyboard
965 .B Macros .
966 It
967 By calling the editor command
968 \fBvi-redo\fP.
969 It
970 By calling the editor command
971 \fBvi-alias\fP.
972 It
973 By pressing a key in emacs incremental search mode that doesn't
974 have a special meaning in that mode but returns to normal emacs
975 mode.
976 It
977 If an application program directly calls the functions
978 \fBel_push\fP(3)
979 or
980 \fBel_wpush\fP(3),
981 it can provide additional, program-specific ways
982 of appending to the input queue.
983 .SH SEE ALSO
984 \fBmg\fP(1),
985 \fBvi\fP(1),
986 \fBeditline\fP(3),
987 \fBel_wgets\fP(3),
988 \fBel_wpush\fP(3),
989 \fBel_wset\fP(3),
990 \fBeditrc\fP(5)
991 .SH HISTORY
992 This manual page first appeared in
993 Ox 6.0
994 and
995 Nx 8 .
996 .SH AUTHORS
997
998 -nosplit
999 This manual page was written by
1000
1001 Ingo Schwarze <Mt schwarze@openbsd.org .>