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