]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - lib/libedit/editrc.5
libkern: Bring in arc4random_uniform(9) from libc
[FreeBSD/FreeBSD.git] / lib / libedit / editrc.5
1 .\"     $NetBSD: editrc.5,v 1.29 2014/12/25 13:39:41 wiz Exp $
2 .\"
3 .\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
5 .\"
6 .\" This file was contributed to The NetBSD Foundation by Luke Mewburn.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in the
15 .\"    documentation and/or other materials provided with the distribution.
16 .\"
17 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 .\" POSSIBILITY OF SUCH DAMAGE.
28 .\"
29 .\" $FreeBSD$
30 .\"
31 .Dd December 25, 2014
32 .Dt EDITRC 5
33 .Os
34 .Sh NAME
35 .Nm editrc
36 .Nd configuration file for editline library
37 .Sh SYNOPSIS
38 .Nm
39 .Sh DESCRIPTION
40 The
41 .Nm
42 file defines various settings to be used by the
43 .Xr editline 3
44 library.
45 .Pp
46 The format of each line is:
47 .Pp
48 .Dl [prog:]command [arg ...]
49 .Pp
50 .Ar command
51 is one of the
52 .Xr editline 3
53 builtin commands.
54 Refer to
55 .Sx BUILTIN COMMANDS
56 for more information.
57 .Pp
58 .Ar prog
59 is the program name string that a program defines when it calls
60 .Xr el_init 3
61 to set up
62 .Xr editline 3 ,
63 which is usually
64 .Va argv[0] .
65 .Ar command
66 will be executed for any program which matches
67 .Ar prog .
68 .Pp
69 .Ar prog
70 may also be a
71 .Xr regex 3
72 style
73 regular expression, in which case
74 .Ar command
75 will be executed for any program that matches the regular expression.
76 .Pp
77 If
78 .Ar prog
79 is absent,
80 .Ar command
81 is executed for all programs.
82 .Sh BUILTIN COMMANDS
83 The
84 .Nm editline
85 library has some builtin commands, which affect the way
86 that the line editing and history functions operate.
87 These are based on similar named builtins present in the
88 .Xr tcsh 1
89 shell.
90 .Pp
91 The following builtin commands are available:
92 .Bl -tag -width 4n
93 .It Ic bind Oo Fl a Oc Oo Fl e Oc Oo Fl k Oc Oo Fl l Oc Oo Fl r Oc \
94 Oo Fl s Oc Oo Fl v Oc Oo Ar key Oo Ar command Oc Oc
95 Without options, list all bound keys, and the editor command to which
96 each is bound.
97 If
98 .Ar key
99 is supplied, show the bindings for
100 .Ar key .
101 If
102 .Ar key command
103 is supplied, bind
104 .Ar command
105 to
106 .Ar key .
107 Options include:
108 .Bl -tag -width 4n
109 .It Fl a
110 List or change key bindings in the
111 .Xr vi 1
112 mode alternate (command mode) key map.
113 .It Fl e
114 Bind all keys to the standard GNU Emacs-like bindings.
115 .It Fl k
116 .Ar key
117 is interpreted as a symbolic arrow key name, which may be one of
118 .Sq up ,
119 .Sq down ,
120 .Sq left
121 or
122 .Sq right .
123 .It Fl l
124 List all editor commands and a short description of each.
125 .It Fl r
126 Remove a key's binding.
127 .It Fl s
128 .Ar command
129 is taken as a literal string and treated as terminal input when
130 .Ar key
131 is typed.
132 Bound keys in
133 .Ar command
134 are themselves reinterpreted, and this continues for ten levels of
135 interpretation.
136 .It Fl v
137 Bind all keys to the standard
138 .Xr vi 1 Ns -like
139 bindings.
140 .El
141 .Pp
142 .Ar command
143 may be one of the commands documented in
144 .Sx "EDITOR COMMANDS"
145 below, or another key.
146 .Pp
147 .Ar key
148 and
149 .Ar command
150 can contain control characters of the form
151 .Sm off
152 .Sq No ^ Ar character
153 .Sm on
154 .Po
155 e.g.\&
156 .Sq ^A
157 .Pc ,
158 and the following backslashed escape sequences:
159 .Pp
160 .Bl -tag -compact -offset indent -width 4n
161 .It Ic \ea
162 Bell
163 .It Ic \eb
164 Backspace
165 .It Ic \ee
166 Escape
167 .It Ic \ef
168 Formfeed
169 .It Ic \en
170 Newline
171 .It Ic \er
172 Carriage return
173 .It Ic \et
174 Horizontal tab
175 .It Ic \ev
176 Vertical tab
177 .Sm off
178 .It Sy \e Ar nnn
179 .Sm on
180 The ASCII character corresponding to the octal number
181 .Ar nnn .
182 .El
183 .Pp
184 .Sq \e
185 nullifies the special meaning of the following character,
186 if it has any, notably
187 .Sq \e
188 and
189 .Sq ^ .
190 .It Ic echotc Oo Fl sv Oc Ar arg Ar ...
191 Exercise terminal capabilities given in
192 .Ar arg ... .
193 If
194 .Ar arg
195 is
196 .Sq baud ,
197 .Sq cols ,
198 .Sq lines ,
199 .Sq rows ,
200 .Sq meta ,
201 or
202 .Sq tabs ,
203 the value of that capability is printed, with
204 .Dq yes
205 or
206 .Dq no
207 indicating that the terminal does or does not have that capability.
208 .Pp
209 .Fl s
210 returns an empty string for non-existent capabilities, rather than
211 causing an error.
212 .Fl v
213 causes messages to be verbose.
214 .It Ic edit Op Li on | Li off
215 Enable or disable the
216 .Nm editline
217 functionality in a program.
218 .It Ic history Ar list | Ar size Dv n | Ar unique Dv n
219 The
220 .Ar list
221 command lists all entries in the history.
222 The
223 .Ar size
224 command sets the history size to
225 .Dv n
226 entries.
227 The
228 .Ar unique
229 command controls if history should keep duplicate entries.
230 If
231 .Dv n
232 is non zero, only keep unique history entries.
233 If
234 .Dv n
235 is zero, then keep all entries (the default).
236 .It Ic settc Ar cap Ar val
237 Set the terminal capability
238 .Ar cap
239 to
240 .Ar val ,
241 as defined in
242 .Xr termcap 5 .
243 No sanity checking is done.
244 .It Ic setty Oo Fl a Oc Oo Fl d Oc Oo Fl q Oc Oo Fl x Oc Oo Ar +mode Oc \
245 Oo Ar -mode Oc Oo Ar mode Oc Oo Ar char=c Oc
246 Control which tty modes that
247 .Nm
248 will not allow the user to change.
249 .Fl d ,
250 .Fl q
251 or
252 .Fl x
253 tells
254 .Ic setty
255 to act on the
256 .Sq edit ,
257 .Sq quote
258 or
259 .Sq execute
260 set of tty modes respectively; defaulting to
261 .Fl x .
262 .Pp
263 Without other arguments,
264 .Ic setty
265 lists the modes in the chosen set which are fixed on
266 .Po
267 .Sq +mode
268 .Pc
269 or off
270 .Po
271 .Sq -mode
272 .Pc .
273 .Fl a
274 lists all tty modes in the chosen set regardless of the setting.
275 With
276 .Ar +mode ,
277 .Ar -mode
278 or
279 .Ar mode ,
280 fixes
281 .Ar mode
282 on or off or removes control of
283 .Ar mode
284 in the chosen set.
285 .Pp
286 .Ic Setty
287 can also be used to set tty characters to particular values using
288 .Ar char=value .
289 If
290 .Ar value
291 is empty
292 then the character is set to
293 .Dv _POSIX_VDISABLE .
294 .It Ic telltc
295 List the values of all the terminal capabilities (see
296 .Xr termcap 5 ) .
297 .El
298 .Sh EDITOR COMMANDS
299 The following editor commands are available for use in key bindings:
300 .\" Section automatically generated with makelist
301 .Bl -tag -width 4n
302 .It Ic vi-paste-next
303 Vi paste previous deletion to the right of the cursor.
304 .It Ic vi-paste-prev
305 Vi paste previous deletion to the left of the cursor.
306 .It Ic vi-prev-big-word
307 Vi move to the previous space delimited word.
308 .It Ic vi-prev-word
309 Vi move to the previous word.
310 .It Ic vi-next-big-word
311 Vi move to the next space delimited word.
312 .It Ic vi-next-word
313 Vi move to the next word.
314 .It Ic vi-change-case
315 Vi change case of character under the cursor and advance one character.
316 .It Ic vi-change-meta
317 Vi change prefix command.
318 .It Ic vi-insert-at-bol
319 Vi enter insert mode at the beginning of line.
320 .It Ic vi-replace-char
321 Vi replace character under the cursor with the next character typed.
322 .It Ic vi-replace-mode
323 Vi enter replace mode.
324 .It Ic vi-substitute-char
325 Vi replace character under the cursor and enter insert mode.
326 .It Ic vi-substitute-line
327 Vi substitute entire line.
328 .It Ic vi-change-to-eol
329 Vi change to end of line.
330 .It Ic vi-insert
331 Vi enter insert mode.
332 .It Ic vi-add
333 Vi enter insert mode after the cursor.
334 .It Ic vi-add-at-eol
335 Vi enter insert mode at end of line.
336 .It Ic vi-delete-meta
337 Vi delete prefix command.
338 .It Ic vi-end-big-word
339 Vi move to the end of the current space delimited word.
340 .It Ic vi-end-word
341 Vi move to the end of the current word.
342 .It Ic vi-undo
343 Vi undo last change.
344 .It Ic vi-command-mode
345 Vi enter command mode (use alternative key bindings).
346 .It Ic vi-zero
347 Vi move to the beginning of line.
348 .It Ic vi-delete-prev-char
349 Vi move to previous character (backspace).
350 .It Ic vi-list-or-eof
351 Vi list choices for completion or indicate end of file if empty line.
352 .It Ic vi-kill-line-prev
353 Vi cut from beginning of line to cursor.
354 .It Ic vi-search-prev
355 Vi search history previous.
356 .It Ic vi-search-next
357 Vi search history next.
358 .It Ic vi-repeat-search-next
359 Vi repeat current search in the same search direction.
360 .It Ic vi-repeat-search-prev
361 Vi repeat current search in the opposite search direction.
362 .It Ic vi-next-char
363 Vi move to the character specified next.
364 .It Ic vi-prev-char
365 Vi move to the character specified previous.
366 .It Ic vi-to-next-char
367 Vi move up to the character specified next.
368 .It Ic vi-to-prev-char
369 Vi move up to the character specified previous.
370 .It Ic vi-repeat-next-char
371 Vi repeat current character search in the same search direction.
372 .It Ic vi-repeat-prev-char
373 Vi repeat current character search in the opposite search direction.
374 .It Ic vi-match
375 Vi go to matching () {} or [].
376 .It Ic vi-undo-line
377 Vi undo all changes to line.
378 .It Ic vi-to-column
379 Vi go to specified column.
380 .It Ic vi-yank-end
381 Vi yank to end of line.
382 .It Ic vi-yank
383 Vi yank.
384 .It Ic vi-comment-out
385 Vi comment out current command.
386 .It Ic vi-alias
387 Vi include shell alias.
388 .It Ic vi-to-history-line
389 Vi go to specified history file line..
390 .It Ic vi-histedit
391 Vi edit history line with vi.
392 .It Ic vi-history-word
393 Vi append word from previous input line.
394 .It Ic vi-redo
395 Vi redo last non-motion command.
396 .It Ic em-delete-or-list
397 Delete character under cursor or list completions if at end of line.
398 .It Ic em-delete-next-word
399 Cut from cursor to end of current word.
400 .It Ic em-yank
401 Paste cut buffer at cursor position.
402 .It Ic em-kill-line
403 Cut the entire line and save in cut buffer.
404 .It Ic em-kill-region
405 Cut area between mark and cursor and save in cut buffer.
406 .It Ic em-copy-region
407 Copy area between mark and cursor to cut buffer.
408 .It Ic em-gosmacs-transpose
409 Exchange the two characters before the cursor.
410 .It Ic em-next-word
411 Move next to end of current word.
412 .It Ic em-upper-case
413 Uppercase the characters from cursor to end of current word.
414 .It Ic em-capitol-case
415 Capitalize the characters from cursor to end of current word.
416 .It Ic em-lower-case
417 Lowercase the characters from cursor to end of current word.
418 .It Ic em-set-mark
419 Set the mark at cursor.
420 .It Ic em-exchange-mark
421 Exchange the cursor and mark.
422 .It Ic em-universal-argument
423 Universal argument (argument times 4).
424 .It Ic em-meta-next
425 Add 8th bit to next character typed.
426 .It Ic em-toggle-overwrite
427 Switch from insert to overwrite mode or vice versa.
428 .It Ic em-copy-prev-word
429 Copy current word to cursor.
430 .It Ic em-inc-search-next
431 Emacs incremental next search.
432 .It Ic em-inc-search-prev
433 Emacs incremental reverse search.
434 .It Ic ed-end-of-file
435 Indicate end of file.
436 .It Ic ed-insert
437 Add character to the line.
438 .It Ic ed-delete-prev-word
439 Delete from beginning of current word to cursor.
440 .It Ic ed-delete-next-char
441 Delete character under cursor.
442 .It Ic ed-kill-line
443 Cut to the end of line.
444 .It Ic ed-move-to-end
445 Move cursor to the end of line.
446 .It Ic ed-move-to-beg
447 Move cursor to the beginning of line.
448 .It Ic ed-transpose-chars
449 Exchange the character to the left of the cursor with the one under it.
450 .It Ic ed-next-char
451 Move to the right one character.
452 .It Ic ed-prev-word
453 Move to the beginning of the current word.
454 .It Ic ed-prev-char
455 Move to the left one character.
456 .It Ic ed-quoted-insert
457 Add the next character typed verbatim.
458 .It Ic ed-digit
459 Adds to argument or enters a digit.
460 .It Ic ed-argument-digit
461 Digit that starts argument.
462 .It Ic ed-unassigned
463 Indicates unbound character.
464 .It Ic ed-tty-sigint
465 Tty interrupt character.
466 .It Ic ed-tty-dsusp
467 Tty delayed suspend character.
468 .It Ic ed-tty-flush-output
469 Tty flush output characters.
470 .It Ic ed-tty-sigquit
471 Tty quit character.
472 .It Ic ed-tty-sigtstp
473 Tty suspend character.
474 .It Ic ed-tty-stop-output
475 Tty disallow output characters.
476 .It Ic ed-tty-start-output
477 Tty allow output characters.
478 .It Ic ed-newline
479 Execute command.
480 .It Ic ed-delete-prev-char
481 Delete the character to the left of the cursor.
482 .It Ic ed-clear-screen
483 Clear screen leaving current line at the top.
484 .It Ic ed-redisplay
485 Redisplay everything.
486 .It Ic ed-start-over
487 Erase current line and start from scratch.
488 .It Ic ed-sequence-lead-in
489 First character in a bound sequence.
490 .It Ic ed-prev-history
491 Move to the previous history line.
492 .It Ic ed-next-history
493 Move to the next history line.
494 .It Ic ed-search-prev-history
495 Search previous in history for a line matching the current.
496 .It Ic ed-search-next-history
497 Search next in history for a line matching the current.
498 .It Ic ed-prev-line
499 Move up one line.
500 .It Ic ed-next-line
501 Move down one line.
502 .It Ic ed-command
503 Editline extended command.
504 .El
505 .\" End of section automatically generated with makelist
506 .Sh FILES
507 .Bl -tag -width "~/.editrcXXX"
508 .It Pa ~/.editrc
509 User configuration file for the
510 .Xr editline 3
511 library.
512 .El
513 .Sh SEE ALSO
514 .Xr editline 3 ,
515 .Xr regex 3 ,
516 .Xr termcap 5
517 .Sh AUTHORS
518 .An -nosplit
519 The
520 .Nm editline
521 library was written by
522 .An Christos Zoulas ,
523 and this manual was written by
524 .An Luke Mewburn ,
525 with some sections inspired by
526 .Xr tcsh 1 .