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