1EDITLINE(7) Miscellaneous Information Manual EDITLINE(7)
2
3
4
6 editline - line editing user interface
7
9 When a program using the editline(3) library prompts for an input
10 string using the function el_wgets(3), it reads characters from the
11 terminal. Invalid input bytes that do not form characters are silently
12 discarded. For each character read, one editor command is executed.
13 The mapping of input characters to editor commands depends on the edit‐
14 ing mode. There are three editing modes: vi insert mode, vi command
15 mode, and emacs mode. The default is vi insert mode. The program can
16 switch the default to emacs mode by using the el_set(3) or el_parse(3)
17 functions, and the user can switch to emacs mode either in the
18 editrc(5) configuration file or interactively with the ed-command edi‐
19 tor command, in all three cases executing the bind Fl e builtin com‐
20 mand.
21
22 If trying to read from the terminal results in end of file or an error,
23 the library signals end of file to the program and does not return a
24 string.
25
26 Input character bindings
27 All default bindings described below can be overridden by individual
28 programs and can be changed with the editrc(5) bind builtin command.
29
30 In the following tables, `Ctrl-' indicates a character with the bit
31 0x40 flipped, and `Meta-' indicates a character with the bit 0x80 set.
32 In vi insert mode and in emacs mode, all Meta-characters considered
33 printable by the current locale(1) are bound to ed-insert instead of to
34 the editor command listed below. Consequently, in UTF-8 mode, most of
35 the Meta-characters are not directly accessible because their code
36 points are occupied by printable Unicode characters, and Meta-charac‐
37 ters are usually input using the em-meta-next editor command. For
38 example, to enter `Meta-B' in order to call the ed-prev-word editor
39 command in emacs mode, call em-meta-next by pressing and releasing the
40 escape key (or equivalently, Ctrl-[), then press and release the `B'
41 key. If you have configured a Meta-key on your keyboard, for example
42 with `setxkbmap' -option altwin:left_meta_win , the Ctrl-Meta-charac‐
43 ters are directly accessible. For example, to enter `Ctrl-Meta-H' in
44 order to call the ed-delete-prev-word editor command in emacs mode,
45 hold down the keys `Ctrl', `Meta', and `H' at the same time. Alterna‐
46 tively, press and release the escape key, then press and release `Ctrl-
47 H'.
48
49 In vi input mode, input characters are bound to the following editor
50 commands by default: It Ctrl-D, EOF Ta vi-list-or-eof It Ctrl-H, BS Ta
51 vi-delete-prev-char It Ctrl-J, LF Ta ed-newline It Ctrl-M, CR Ta ed-
52 newline It Ctrl-Q Ta ed-tty-start-output It Ctrl-S Ta ed-tty-stop-out‐
53 put It Ctrl-U Ta vi-kill-line-prev It Ctrl-V Ta ed-quoted-insert It
54 Ctrl-W Ta ed-delete-prev-word It Ctrl-[, ESC Ta vi-command-mode It
55 Ctrl-\, QUIT Ta ed-tty-sigquit It Ctrl-?, DEL Ta vi-delete-prev-char
56
57 All other input characters except the NUL character (Ctrl-@) are bound
58 to ed-insert.
59
60 In vi command mode, input characters are bound to the following editor
61 commands by default: It Ctrl-A Ta ed-move-to-beg It Ctrl-C, INT Ta ed-
62 tty-sigint It Ctrl-E Ta ed-move-to-end It Ctrl-H, BS Ta ed-delete-prev-
63 char It Ctrl-J, LF Ta ed-newline It Ctrl-K Ta ed-kill-line It Ctrl-L,
64 FF Ta ed-clear-screen It Ctrl-M, CR Ta ed-newline It Ctrl-N Ta ed-next-
65 history It Ctrl-O Ta ed-tty-flush-output It Ctrl-P Ta ed-prev-history
66 It Ctrl-Q Ta ed-tty-start-output It Ctrl-R Ta ed-redisplay It Ctrl-S Ta
67 ed-tty-stop-output It Ctrl-U Ta vi-kill-line-prev It Ctrl-W Ta ed-
68 delete-prev-word It Ctrl-[, ESC Ta em-meta-next It Ctrl-\, QUIT Ta ed-
69 tty-sigquit It Space Ta ed-next-char It # Ta vi-comment-out It $ Ta ed-
70 move-to-end It % Ta vi-match It + Ta ed-next-history It , Ta vi-repeat-
71 prev-char It - Ta ed-prev-history It . Ta vi-redo It / Ta vi-search-
72 prev It 0 Ta vi-zero It 1 to 9 Ta ed-argument-digit It : Ta ed-command
73 It ; Ta vi-repeat-next-char It ? Ta vi-search-next It @ Ta vi-alias It
74 A Ta vi-add-at-eol It B Ta vi-prev-big-word It C Ta vi-change-to-eol It
75 D Ta ed-kill-line It E Ta vi-end-big-word It F Ta vi-prev-char It G Ta
76 vi-to-history-line It I Ta vi-insert-at-bol It J Ta ed-search-next-his‐
77 tory It K Ta ed-search-prev-history It N Ta vi-repeat-search-prev It O
78 Ta ed-sequence-lead-in It P Ta vi-paste-prev It R Ta vi-replace-mode It
79 S Ta vi-substitute-line It T Ta vi-to-prev-char It U Ta vi-undo-line It
80 W Ta vi-next-big-word It X Ta ed-delete-prev-char It Y Ta vi-yank-end
81 It [ Ta ed-sequence-lead-in It ^ Ta ed-move-to-beg It _ Ta vi-history-
82 word It a Ta vi-add It b Ta vi-prev-word It c Ta vi-change-meta It d Ta
83 vi-delete-meta It e Ta vi-end-word It f Ta vi-next-char It h Ta ed-
84 prev-char It i Ta vi-insert It j Ta ed-next-history It k Ta ed-prev-
85 history It l Ta ed-next-char It n Ta vi-repeat-search-next It p Ta vi-
86 paste-next It r Ta vi-replace-char It s Ta vi-substitute-char It t Ta
87 vi-to-next-char It u Ta vi-undo It v Ta vi-histedit It w Ta vi-next-
88 word It x Ta ed-delete-next-char It y Ta vi-yank It | Ta vi-to-column
89 It ~ Ta vi-change-case It Ctrl-?, DEL Ta ed-delete-prev-char It Meta-O
90 Ta ed-sequence-lead-in It Meta-[ Ta ed-sequence-lead-in
91
92 In emacs mode, input characters are bound to the following editor com‐
93 mands by default: It 0 to 9 Ta ed-digit It Ctrl-@, NUL Ta em-set-mark
94 It Ctrl-A Ta ed-move-to-beg It Ctrl-B Ta ed-prev-char It Ctrl-C, INT Ta
95 ed-tty-sigint It Ctrl-D, EOF Ta em-delete-or-list It Ctrl-E Ta ed-move-
96 to-end It Ctrl-F Ta ed-next-char It Ctrl-H, BS Ta em-delete-prev-char
97 It Ctrl-J, LF Ta ed-newline It Ctrl-K Ta ed-kill-line It Ctrl-L, FF Ta
98 ed-clear-screen It Ctrl-M, CR Ta ed-newline It Ctrl-N Ta ed-next-his‐
99 tory It Ctrl-O Ta ed-tty-flush-output It Ctrl-P Ta ed-prev-history It
100 Ctrl-Q Ta ed-tty-start-output It Ctrl-R Ta ed-redisplay It Ctrl-S Ta
101 ed-tty-stop-output It Ctrl-T Ta ed-transpose-chars It Ctrl-U Ta ed-
102 kill-line It Ctrl-V Ta ed-quoted-insert It Ctrl-W Ta em-kill-region It
103 Ctrl-X Ta ed-sequence-lead-in It Ctrl-Y Ta em-yank It Ctrl-Z, TSTP Ta
104 ed-tty-sigtstp It Ctrl-[, ESC Ta em-meta-next It Ctrl-\, QUIT Ta ed-
105 tty-sigquit It Ctrl-] Ta ed-tty-dsusp It Ctrl-?, DEL Ta em-delete-prev-
106 char It Ctrl-Meta-H Ta ed-delete-prev-word It Ctrl-Meta-L Ta ed-clear-
107 screen It Ctrl-Meta-_ Ta em-copy-prev-word It Meta-0 to 9 Ta ed-argu‐
108 ment-digit It Meta-B Ta ed-prev-word It Meta-C Ta em-capitol-case It
109 Meta-D Ta em-delete-next-word It Meta-F Ta em-next-word It Meta-L Ta
110 em-lower-case It Meta-N Ta ed-search-next-history It Meta-O Ta ed-
111 sequence-lead-in It Meta-P Ta ed-search-prev-history It Meta-U Ta em-
112 upper-case It Meta-W Ta em-copy-region It Meta-X Ta ed-command It
113 Meta-[ Ta ed-sequence-lead-in It Meta-b Ta ed-prev-word It Meta-c Ta
114 em-capitol-case It Meta-d Ta em-delete-next-word It Meta-f Ta em-next-
115 word It Meta-l Ta em-lower-case It Meta-n Ta ed-search-next-history It
116 Meta-p Ta ed-search-prev-history It Meta-u Ta em-upper-case It Meta-w
117 Ta em-copy-region It Meta-x Ta ed-command It Ctrl-Meta-? Ta ed-delete-
118 prev-word
119
120 The remaining ascii(7) characters in the range 0x20 to 0x7e are bound
121 to ed-insert.
122
123 If standard output is not connected to a terminal device or el_set(3)
124 was used to set EL_EDITMODE to 0, all input character bindings are dis‐
125 abled and all characters typed are appended to the edit buffer. In
126 that case, the edit buffer is returned to the program after a newline
127 or carriage return character is typed, or after the first character
128 typed if el_set(3) was used to set EL_UNBUFFERED to non-zero.
129
130 Editor commands
131 Most editor commands accept an optional argument. The argument is
132 entered by prefixing the editor command with one or more of the editor
133 commands ed-argument-digit, ed-digit, em-universal-argument, or vi-
134 zero. When an argument is not provided, it defaults to 1. For most
135 editor commands, the effect of an argument is to repeatedly execute the
136 command that number of times.
137
138 When talking about a character string from a left character to a right
139 character, the left character is included in the string, while the
140 right character is not included.
141
142 If an editor command causes an error, the input character is discarded,
143 no action occurs, and the terminal bell is rung. In case of a non-
144 fatal error, the terminal bell is also rung, but the editor command
145 takes effect anyway.
146
147 In the following list, the default key bindings are listed after each
148 editor command.
149
150 ed-argument-digit Pq vi command: 1 to 9; emacs: Meta-0 to Meta-9
151 If in argument input mode, append the input digit to the argu‐
152 ment being read. Otherwise, switch to argument input mode and
153 use the input digit as the most significant digit of the argu‐
154 ment. It is an error if the input character is not a digit or
155 if the existing argument is already greater than a million.
156
157 ed-clear-screen Pq vi command: Ctrl-L; emacs: Ctrl-L, Ctrl-Meta-L
158 Clear the screen and display the edit buffer at the top. Ignore
159 any argument.
160
161 ed-command Pq vi command: So : Sc ; emacs: Meta-X, Meta-x
162 Read a line from the terminal bypassing the normal line editing
163 functionality and execute that line as an editrc(5) builtin com‐
164 mand. If in vi command mode, also switch back to vi insert
165 mode. Ignore any argument.
166
167 ed-delete-next-char Pq vi command: x
168 Delete the character at the cursor position. With an argument,
169 delete that number of characters. In emacs mode, it is an error
170 if the cursor is at the end of the edit buffer. In vi mode, the
171 last character in the edit buffer is deleted in that case, and
172 it is an error if the buffer is empty.
173
174 ed-delete-prev-char Pq vi command: X, Ctrl-H, BS, Ctrl-?, DEL
175 Delete the character to the left of the cursor position. With
176 an argument, delete that number of characters. It is an error
177 if the cursor is at the beginning of the edit buffer.
178
179 ed-delete-prev-word Pq vi: Ctrl-W; emacs: Ctrl-Meta-H, Ctrl-Meta-?
180 Move to the left to the closest beginning of a word, delete the
181 string from that position to the cursor, and save it to the cut
182 buffer. With an argument, delete that number of words. It is
183 an error if the cursor is at the beginning of the edit buffer.
184
185 ed-digit Pq emacs: 0 to 9
186 If in argument input mode, append the input digit to the argu‐
187 ment being read. Otherwise, call ed-insert. It is an error if
188 the input character is not a digit or if the existing argument
189 is already greater than a million.
190
191 ed-end-of-file Pq not bound by default
192 Discard the edit buffer and indicate end of file to the program.
193 Ignore any argument.
194
195 ed-ignore Pq various
196 Discard the input character and do nothing.
197
198 ed-insert Pq vi input: almost all; emacs: printable characters
199 In insert mode, insert the input character left of the cursor
200 position. In replace mode, overwrite the character at the cur‐
201 sor and move the cursor to the right by one character position.
202 Accept an argument to do this repeatedly. It is an error if the
203 input character is the NUL character (Ctrl-@). Failure to
204 enlarge the edit buffer also results in an error.
205
206 ed-kill-line Pq vi command: D, Ctrl-K; emacs: Ctrl-K, Ctrl-U
207 Delete the string from the cursor position to the end of the
208 line and save it to the cut buffer. Ignore any argument.
209
210 ed-move-to-beg Pq vi command: ^, Ctrl-A; emacs: Ctrl-A
211 In vi mode, move the cursor to the first non-space character in
212 the edit buffer. In emacs mode, move the cursor to the begin‐
213 ning of the edit buffer. Ignore any argument. Can be used as a
214 movement command after vi_change_meta, vi_delete_meta, or
215 vi_yank.
216
217 ed-move-to-end Pq vi command: $, Ctrl-E; emacs: Ctrl-E
218 Move the cursor to the end of the edit buffer. Ignore any argu‐
219 ment. Can be used as a movement command after vi_change_meta,
220 vi_delete_meta, or vi_yank.
221
222 ed-newline Pq all modes: Ctrl-J, LF, Ctrl-M, CR
223 Append a newline character to the edit buffer and return the
224 edit buffer to the program. Ignore any argument.
225
226 ed-next-char Pq vi command: Space, l; emacs: Ctrl-F
227 Move the cursor one character position to the right. With an
228 argument, move by that number of characters. Can be used as a
229 movement command after vi_change_meta, vi_delete_meta, or
230 vi_yank. It is an error if the cursor is already at the end of
231 the edit buffer.
232
233 ed-next-history Pq vi command: j, +, Ctrl-N; emacs: Ctrl-N
234 Replace the edit buffer with the next history line. That line
235 is older than the current line. With an argument, go forward by
236 that number of history lines. It is a non-fatal error to
237 advance by more lines than are available.
238
239 ed-next-line Pq not bound by default
240 Move the cursor down one line. With an argument, move down by
241 that number of lines. It is an error if the edit buffer does
242 not contain enough newline characters to the right of the cursor
243 position.
244
245 ed-prev-char Pq vi command: h; emacs: Ctrl-B
246 Move the cursor one character position to the left. With an
247 argument, move by that number of characters. Can be used as a
248 movement command after vi_change_meta, vi_delete_meta, or
249 vi_yank. It is an error if the cursor is already at the begin‐
250 ning of the edit buffer.
251
252 ed-prev-history Pq vi command: k, -, Ctrl-P; emacs: Ctrl-P
253 Replace the edit buffer with the previous history line. That
254 line is newer than the current line. With an argument, go back
255 by that number of lines. It is a non-fatal error to back up by
256 more lines than are available.
257
258 ed-prev-line Pq not bound by default
259 Move the cursor up one line. With an argument, move up by that
260 number of lines. It is an error if the edit buffer does not
261 contain enough newline characters to the left of the cursor
262 position.
263
264 ed-prev-word Pq emacs: Meta-B, Meta-b
265 Move the cursor to the left to the closest beginning of a word.
266 With an argument, repeat that number of times. Can be used as a
267 movement command after vi_change_meta, vi_delete_meta, or
268 vi_yank. It is an error if the cursor is already at the begin‐
269 ning of the edit buffer.
270
271 ed-quoted-insert Pq vi insert, emacs: Ctrl-V
272 Read one character from the terminal bypassing the normal line
273 editing functionality and call ed-insert on it. If trying to
274 read the character returns end of file or an error, call ed-end-
275 of-file instead.
276
277 ed-redisplay Pq vi command, emacs: Ctrl-R
278 Redisplay everything. Ignore any argument.
279
280 ed-search-next-history Pq vi command: J; emacs: Meta-N, Meta-n
281 Replace the edit buffer with the next matching history entry.
282
283 ed-search-prev-history Pq vi command: K; emacs: Meta-P, Meta-p
284 Replace the edit buffer with the previous matching history
285 entry.
286
287 ed-sequence-lead-in Pq vi cmd: O, [; emacs: Ctrl-X;\fP
288 both: Meta-O, Meta-[ Call a macro. See the section about
289 Macros below for details.
290
291 ed-start-over Pq not bound by default
292 Discard the contents of the edit buffer and start from scratch.
293 Ignore any argument.
294
295 ed-transpose-chars Pq emacs: Ctrl-T
296 Exchange the character at the cursor position with the one to
297 the left of it and move the cursor to the character to the right
298 of the two exchanged characters. Ignore any argument. It is an
299 error if the cursor is at the beginning of the edit buffer or if
300 the edit buffer contains less than two characters.
301
302 ed-unassigned Pq all characters not listed
303 This editor command always results in an error.
304
305 em-capitol-case Pq emacs: Meta-C, Meta-c
306 Capitalize the string from the cursor to the end of the current
307 word. That is, if it contains at least one alphabetic charac‐
308 ter, convert the first alphabetic character to upper case, and
309 convert all characters to the right of it to lower case. In any
310 case, move the cursor to the next character after the end of the
311 current word.
312
313 em-copy-prev-word Pq emacs: Ctrl-Meta-_
314 Copy the string from the beginning of the current word to the
315 cursor and insert it to the left of the cursor. Move the cursor
316 to the character after the inserted string. It is an error if
317 the cursor is at the beginning of the edit buffer.
318
319 em-copy-region Pq emacs: Meta-W, Meta-w
320 Copy the string from the cursor to the mark to the cut buffer.
321 It is an error if the mark is not set.
322
323 em-delete-next-word Pq emacs: Meta-D, Meta-d
324 Delete the string from the cursor to the end of the current word
325 and save it to the cut buffer. It is an error if the cursor is
326 at the end of the edit buffer.
327
328 em-delete-or-list Pq emacs: Ctrl-D, EOF
329 If the cursor is not at the end of the line, delete the charac‐
330 ter at the cursor. If the edit buffer is empty, indicate end of
331 file to the program. It is an error if the cursor is at the end
332 of the edit buffer and the edit buffer is not empty.
333
334 em-delete-prev-char Pq emacs: Ctrl-H, BS, Ctrl-?, DEL
335 Delete the character to the left of the cursor. It is an error
336 if the cursor is at the beginning of the edit buffer.
337
338 em-exchange-mark Pq not bound by default
339 Exchange the cursor and the mark.
340
341 em-gosmacs-transpose Pq not bound by default
342 Exchange the two characters to the left of the cursor. It is an
343 error if the cursor is on the first or second character of the
344 edit buffer.
345
346 em-inc-search-next Pq not bound by default
347 Emacs incremental next search.
348
349 em-inc-search-prev Pq not bound by default
350 Emacs incremental reverse search.
351
352 em-kill-line Pq not bound by default
353 Delete the entire contents of the edit buffer and save it to the
354 cut buffer.
355
356 em-kill-region Pq emacs: Ctrl-W
357 Delete the string from the cursor to the mark and save it to the
358 cut buffer. It is an error if the mark is not set.
359
360 em-lower-case Pq emacs: Meta-L, Meta-l
361 Convert the characters from the cursor to the end of the current
362 word to lower case.
363
364 em-meta-next Pq vi command, emacs: Ctrl-[, ESC
365 Set the bit 0x80 on the next character typed. Unless the
366 resulting code point is printable, holding down the `Meta-' key
367 while typing that character is a simpler way to achieve the same
368 effect.
369
370 em-next-word Pq Meta-F, Meta-f
371 Move the cursor to the end of the current word. Can be used as
372 a movement command after vi_change_meta, vi_delete_meta, or
373 vi_yank. It is an error if the cursor is already at the end of
374 the edit buffer.
375
376 em-set-mark Pq emacs: Ctrl-Q, NUL
377 Set the mark at the current cursor position.
378
379 em-toggle-overwrite Pq not bound by default
380 Switch from insert to overwrite mode or vice versa.
381
382 em-universal-argument Pq not bound by default
383 If in argument input mode, multiply the argument by 4. Other‐
384 wise, switch to argument input mode and set the argument to 4.
385 It is an error if the existing argument is already greater than
386 a million.
387
388 em-upper-case Pq emacs: Meta-U, Meta-u
389 Convert the characters from the cursor to the end of the current
390 word to upper case.
391
392 em-yank Pq emacs: Ctrl-Y
393 Paste the cut buffer to the left of the cursor.
394
395 vi-add Pq vi command: a
396 Switch to vi insert mode. Unless the cursor is already at the
397 end of the edit buffer, move it one character position to the
398 right.
399
400 vi-add-at-eol Pq vi command: A
401 Switch to vi insert mode and move the cursor to the end of the
402 edit buffer.
403
404 vi-alias Pq vi command: @
405 If an alias function was defined by calling the el_set(3) or
406 el_wset(3) function with the argument EL_ALIAS_TEXT , read one
407 character from the terminal bypassing the normal line editing
408 functionality, call the alias function passing the argument that
409 was specified with EL_ALIAS_TEXT as the first argument and the
410 character read, with an underscore prepended, as the second
411 argument, and pass the string returned from the alias function
412 to el_wpush(3). It is an error if no alias function is defined
413 or if trying to read the character results in end of file or an
414 error.
415
416 vi-change-case Pq vi command: ~
417 Change the case of the character at the cursor and move the cur‐
418 sor one character position to the right. It is an error if the
419 cursor is already at the end of the edit buffer.
420
421 vi-change-meta Pq vi command: c
422 Delete the string from the cursor to the position specified by
423 the following movement command and save a copy of it to the cut
424 buffer. When given twice in a row, instead delete the whole
425 contents of the edit buffer and save a copy of it to the cut
426 buffer. In either case, switch to vi insert mode after that.
427
428 vi-change-to-eol Pq vi command: C
429 Delete the string from the cursor position to the end of the
430 line and save it to the cut buffer, then switch to vi insert
431 mode.
432
433 vi-command-mode Pq vi insert: Ctrl-[, ESC
434 Discard pending actions and arguments and switch to vi command
435 mode. Unless the cursor is already at the beginning of the edit
436 buffer, move it to the left by one character position.
437
438 vi-comment-out Pq vi command: #
439 Insert a `#' character at the beginning of the edit buffer and
440 return the edit buffer to the program.
441
442 vi-delete-meta Pq vi command: d
443 Delete the string from the cursor to the position specified by
444 the following movement command and save a copy of it to the cut
445 buffer. When given twice in a row, instead delete the whole
446 contents of the edit buffer and save a copy of it to the cut
447 buffer.
448
449 vi-delete-prev-char Pq vi insert: Ctrl-H, BS, Ctrl-?, DEL
450 Delete the character to the left of the cursor. It is an error
451 if the cursor is already at the beginning of the edit buffer.
452
453 vi-end-big-word Pq vi command: E
454 Move the cursor to the end of the current space delimited word.
455 Can be used as a movement command after vi_change_meta,
456 vi_delete_meta, or vi_yank. It is an error if the cursor is
457 already at the end of the edit buffer.
458
459 vi-end-word Pq vi command: e
460 Move the cursor to the end of the current word. Can be used as
461 a movement command after vi_change_meta, vi_delete_meta, or
462 vi_yank. It is an error if the cursor is already at the end of
463 the edit buffer.
464
465 vi-history-word Pq vi command: _
466 Insert the first word from the most recent history entry after
467 the cursor, move the cursor after to the character after the
468 inserted word, and switch to vi insert mode. It is an error if
469 there is no history entry or the most recent history entry is
470 empty.
471
472 vi-insert Pq vi command: i
473 Enter insert mode.
474
475 vi-insert-at-bol Pq vi command: I
476 Move the cursor to the beginning of the edit buffer and switch
477 to vi insert mode.
478
479 vi-kill-line-prev Pq vi: Ctrl-U
480 Delete the string from the beginning of the edit buffer to the
481 cursor and save it to the cut buffer.
482
483 vi-list-or-eof Pq vi insert: Ctrl-D, EOF
484 If the edit buffer is empty, indicate end of file to the pro‐
485 gram. It is an error if the edit buffer is not empty.
486
487 vi-match Pq vi command: %
488 Consider opening and closing parentheses, braces, and brackets
489 as delimiters. If the cursor is not at a delimiter, move it to
490 the right until it gets to one, then move it to the matching
491 delimiter. Can be used as a movement command after
492 vi_change_meta, vi_delete_meta, or vi_yank. It is an error if
493 there is no delimiter at the cursor or in the string to the
494 right of the cursor, or if the first such delimiter has no
495 matching delimiter.
496
497 vi-next-big-word Pq vi command: W
498 Move the cursor to the right to the beginning of the next space
499 delimited word. Can be used as a movement command after
500 vi_change_meta, vi_delete_meta, or vi_yank. It is an error if
501 the cursor is already at the end of the edit buffer or on its
502 last character.
503
504 vi-next-char Pq vi command: f
505 Read one character from the terminal bypassing the normal line
506 editing functionality and move the cursor to the right to the
507 next instance of that character in the edit buffer. Can be used
508 as a movement command after vi_change_meta, vi_delete_meta, or
509 vi_yank. If trying to read the character results in end of file
510 or an error, call ed-end-of-file instead. It is an error if the
511 character is not found searching to the right in the edit buf‐
512 fer.
513
514 vi-next-word Pq vi command: w
515 Move the cursor to the right to the beginning of the next word.
516 Can be used as a movement command after vi_change_meta,
517 vi_delete_meta, or vi_yank. It is an error if the cursor is
518 already at the end of the edit buffer or on its last character.
519
520 vi-paste-next Pq vi command: p
521 Insert a copy of the cut buffer to the right of the cursor. It
522 is an error if the cut buffer is empty.
523
524 vi-paste-prev Pq vi command: P
525 Insert a copy of the cut buffer to the left of the cursor. It
526 is an error if the cut buffer is empty.
527
528 vi-prev-big-word Pq vi command: B
529 Move the cursor to the left to the next beginning of a space
530 delimited word. Can be used as a movement command after
531 vi_change_meta, vi_delete_meta, or vi_yank. It is an error if
532 the cursor is already at the beginning of the edit buffer.
533
534 vi-prev-char Pq vi command: F
535 Read one character from the terminal bypassing the normal line
536 editing functionality and move the cursor to the left to the
537 next instance of that character in the edit buffer. Can be used
538 as a movement command after vi_change_meta, vi_delete_meta, or
539 vi_yank. If trying to read the character results in end of file
540 or an error, call ed-end-of-file instead. It is an error if the
541 character is not found searching to the left in the edit buffer.
542
543 vi-prev-word Pq vi command: b
544 Move the cursor to the left to the next beginning of a word.
545 Can be used as a movement command after vi_change_meta,
546 vi_delete_meta, or vi_yank. It is an error if the cursor is
547 already at the beginning of the edit buffer.
548
549 vi-redo Pq vi command: Sq .
550 Redo the last non-motion command.
551
552 vi-repeat-next-char Pq vi command: Sq ;
553 Repeat the most recent character search in the same search
554 direction. Can be used as a movement command after
555 vi_change_meta, vi_delete_meta, or vi_yank.
556
557 vi-repeat-prev-char Pq vi command: Sq ,
558 Repeat the most recent character search in the opposite search
559 direction. Can be used as a movement command after
560 vi_change_meta, vi_delete_meta, or vi_yank.
561
562 vi-repeat-search-next Pq vi command: n
563 Repeat the most recent history search in the same search direc‐
564 tion.
565
566 vi-repeat-search-prev Pq vi command: N
567 Repeat the most recent history search in the opposite search
568 direction.
569
570 vi-replace-char Pq vi command: r
571 Switch to vi replace mode, and automatically switch back to vi
572 command mode after the next character typed. See ed-insert for
573 a description of replace mode. It is an error if the cursor is
574 at the end of the edit buffer.
575
576 vi-replace-mode Pq vi command: R
577 Switch to vi replace mode. This is a variant of vi insert mode;
578 see ed-insert for the difference.
579
580 vi-search-next Pq vi command: ?
581 Replace the edit buffer with the next matching history entry.
582
583 vi-search-prev Pq vi command: /
584 Replace the edit buffer with the previous matching history
585 entry.
586
587 vi-substitute-char Pq vi command: s
588 Delete the character at the cursor and switch to vi insert mode.
589
590 vi-substitute-line Pq vi command: S
591 Delete the entire contents of the edit buffer, save a copy of it
592 in the cut buffer, and enter vi insert mode.
593
594 vi-to-column Pq vi command: |
595 Move the cursor to the column specified as the argument. Can be
596 used as a movement command after vi_change_meta, vi_delete_meta,
597 or vi_yank.
598
599 vi-to-history-line Pq vi command: G
600 Replace the edit buffer with the specified history entry.
601
602 vi-to-next-char Pq vi command: t
603 Read one character from the terminal bypassing the normal line
604 editing functionality and move the cursor to the right to the
605 character before the next instance of that character in the edit
606 buffer. Can be used as a movement command after vi_change_meta,
607 vi_delete_meta, or vi_yank. If trying to read the character
608 results in end of file or an error, call ed-end-of-file instead.
609 It is an error if the character is not found searching to the
610 right in the edit buffer.
611
612 vi-to-prev-char Pq vi command: T
613 Read one character from the terminal bypassing the normal line
614 editing functionality and move the cursor to the left to the
615 character after the next instance of that character in the edit
616 buffer. Can be used as a movement command after vi_change_meta,
617 vi_delete_meta, or vi_yank. If trying to read the character
618 results in end of file or an error, call ed-end-of-file instead.
619 It is an error if the character is not found searching to the
620 left in the edit buffer.
621
622 vi-undo Pq vi command: u
623 Undo the last change.
624
625 vi-undo-line Pq vi command: U
626 Undo all changes to the edit buffer.
627
628 vi-yank Pq vi command: y
629 Copy the string from the cursor to the position specified by the
630 following movement command to the cut buffer. When given twice
631 in a row, instead copy the whole contents of the edit buffer to
632 the cut buffer.
633
634 vi-yank-end Pq vi command: Y
635 Copy the string from the cursor to the end of the edit buffer to
636 the cut buffer.
637
638 vi-zero Pq vi command: 0
639 If in argument input mode, multiply the argument by ten. Other‐
640 wise, move the cursor to the beginning of the edit buffer. Can
641 be used as a movement command after vi_change_meta,
642 vi_delete_meta, or vi_yank.
643
644 Macros
645 If an input character is bound to the editor command ed-sequence-lead-
646 in, editline attempts to call a macro. If the input character by
647 itself forms the name of a macro, that macro is executed. Otherwise,
648 additional input characters are read until the string read forms the
649 name of a macro, in which case that macro is executed, or until the
650 string read matches the beginning of none of the existing macro names,
651 in which case the string including the final, mismatching character is
652 discarded and the terminal bell is rung.
653
654 There are two kinds of macros. Command macros execute a single editor
655 command. Keyboard macros return a string of characters that is
656 appended as a new line to the Input Queue .
657
658 The following command macros are defined by default in vi command mode
659 and in emacs mode: It Esc [ A, Esc O A Ta ed-prev-history It Esc [ B,
660 Esc O B Ta ed-next-history It Esc [ C, Esc O C Ta ed-next-char It Esc [
661 D, Esc O D Ta ed-prev-char It Esc [ F, Esc O F Ta ed-move-to-end It Esc
662 [ H, Esc O H Ta ed-move-to-beg
663
664 In vi command mode, they are also defined by default without the ini‐
665 tial escape character.
666
667 In addition, the editline library tries to bind the strings generated
668 by the arrow keys as reported by the terminfo(5) database to these edi‐
669 tor commands, unless that would clobber user settings.
670
671 In emacs mode, the two-character string ``Ctrl-X Ctrl-X'' is bound to
672 the em-exchange-mark editor command.
673
674 Input Queue
675 The editline library maintains an input queue operated in FIFO mode.
676 Whenever it needs an input character, it takes the first character from
677 the first line of the input queue. When the queue is empty, it reads
678 from the terminal.
679
680 A line can be appended to the end of the input queue in several ways:
681 It By calling one of the keyboard Macros . It By calling the editor
682 command vi-redo. It By calling the editor command vi-alias. It By
683 pressing a key in emacs incremental search mode that doesn't have a
684 special meaning in that mode but returns to normal emacs mode. It If
685 an application program directly calls the functions el_push(3) or
686 el_wpush(3), it can provide additional, program-specific ways of
687 appending to the input queue.
688
690 mg(1), vi(1), editline(3), el_wgets(3), el_wpush(3), el_wset(3),
691 editrc(5)
692
694 This manual page first appeared in Ox 6.0 and Nx 8 .
695
697 -nosplit This manual page was written by
698
699 Ingo Schwarze <Mt schwarze@openbsd.org .>
700
701
702
703 May 7, 2016 EDITLINE(7)