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