573453155e08be15a2ce1d08840d3358ccb7476b
[dragonfly.git] / lib / libedit / editrc.5
1 .\" Copyright (c) 1997-2000 The NetBSD Foundation, Inc.
2 .\" All rights reserved.
3 .\"
4 .\" This file was contributed to The NetBSD Foundation by Luke Mewburn.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
8 .\" are met:
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in the
13 .\"    documentation and/or other materials provided with the distribution.
14 .\"
15 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 .\" POSSIBILITY OF SUCH DAMAGE.
26 .\"
27 .\" $NetBSD: editrc.5,v 1.21 2008/04/30 13:10:51 martin Exp $
28 .\"
29 .Dd October 18, 2003
30 .Dt EDITRC 5
31 .Os
32 .Sh NAME
33 .Nm editrc
34 .Nd configuration file for editline library
35 .Sh SYNOPSIS
36 .Nm
37 .Sh DESCRIPTION
38 The
39 .Nm
40 file defines various settings to be used by the
41 .Xr editline 3
42 library.
43 .Pp
44 The format of each line is:
45 .Dl [prog:]command [arg [...]]
46 .Pp
47 .Ar command
48 is one of the
49 .Xr editline 3
50 builtin commands.
51 Refer to
52 .Sx BUILTIN COMMANDS
53 for more information.
54 .Pp
55 .Ar prog
56 is the program name string that a program defines when it calls
57 .Xr el_init 3
58 to set up
59 .Xr editline 3 ,
60 which is usually
61 .Va argv[0] .
62 .Ar command
63 will be executed for any program which matches
64 .Ar prog .
65 .Pp
66 .Ar prog
67 may also be a
68 .Xr regex 3
69 style
70 regular expression, in which case
71 .Ar command
72 will be executed for any program that matches the regular expression.
73 .Pp
74 If
75 .Ar prog
76 is absent,
77 .Ar command
78 is executed for all programs.
79 .Sh BUILTIN COMMANDS
80 The
81 .Nm editline
82 library has some builtin commands, which affect the way
83 that the line editing and history functions operate.
84 These are based on similar named builtins present in the
85 .Xr tcsh 1
86 shell.
87 .Pp
88 The following builtin commands are available:
89 .Bl -tag -width 4n
90 .It Ic bind Xo
91 .Op Fl a
92 .Op Fl e
93 .Op Fl k
94 .Op Fl l
95 .Op Fl r
96 .Op Fl s
97 .Op Fl v
98 .Op Ar key Op Ar command
99 .Xc
100 Without options, list all bound keys, and the editor command to which
101 each is bound.
102 If
103 .Ar key
104 is supplied, show the bindings for
105 .Ar key .
106 If
107 .Ar key command
108 is supplied, bind
109 .Ar command
110 to
111 .Ar key .
112 Options include:
113 .Bl -tag -width 4n
114 .It Fl e
115 Bind all keys to the standard GNU Emacs-like bindings.
116 .It Fl v
117 Bind all keys to the standard
118 .Xr vi 1 Ns -like
119 bindings.
120 .It Fl a
121 List or change key bindings in the
122 .Xr vi 1
123 mode alternate (command mode) key map.
124 .It Fl k
125 .Ar key
126 is interpreted as a symbolic arrow key name, which may be one of
127 .Sq up ,
128 .Sq down ,
129 .Sq left
130 or
131 .Sq right .
132 .It Fl l
133 List all editor commands and a short description of each.
134 .It Fl r
135 Remove a key's binding.
136 .It Fl s
137 .Ar command
138 is taken as a literal string and treated as terminal input when
139 .Ar key
140 is typed.
141 Bound keys in
142 .Ar command
143 are themselves reinterpreted, and this continues for ten levels of
144 interpretation.
145 .El
146 .Pp
147 .Ar command
148 may be one of the commands documented in
149 .Sx "EDITOR COMMANDS"
150 below, or another key.
151 .Pp
152 .Ar key
153 and
154 .Ar command
155 can contain control characters of the form
156 .Sm off
157 .Sq No ^ Ar character
158 .Sm on
159 .Po
160 e.g.
161 .Sq ^A
162 .Pc ,
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 Li on | Li 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 won't 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 .Po
286 .Sq +mode
287 .Pc
288 or off
289 .Po
290 .Sq -mode
291 .Pc .
292 .Fl a
293 lists all tty modes in the chosen set regardless of the setting.
294 With
295 .Ar +mode ,
296 .Ar -mode
297 or
298 .Ar mode ,
299 fixes
300 .Ar mode
301 on or off or removes control of
302 .Ar mode
303 in the chosen set.
304 .Pp
305 .Ic Setty
306 can also be used to set tty characters to particular values using
307 .Ar char=value .
308 If
309 .Ar value
310 is empty
311 then the character is set to
312 .Dv _POSIX_VDISABLE .
313 .El
314 .Sh EDITOR COMMANDS
315 The following editor commands are available for use in key bindings:
316 .\" Section automatically generated with makelist
317 .Bl -tag -width 4n
318 .It Ic vi-paste-next
319 Vi paste previous deletion to the right of the cursor.
320 .It Ic vi-paste-prev
321 Vi paste previous deletion to the left of the cursor.
322 .It Ic vi-prev-space-word
323 Vi move to the previous space delimited word.
324 .It Ic vi-prev-word
325 Vi move to the previous word.
326 .It Ic vi-next-space-word
327 Vi move to the next space delimited word.
328 .It Ic vi-next-word
329 Vi move to the next word.
330 .It Ic vi-change-case
331 Vi change case of character under the cursor and advance one character.
332 .It Ic vi-change-meta
333 Vi change prefix command.
334 .It Ic vi-insert-at-bol
335 Vi enter insert mode at the beginning of line.
336 .It Ic vi-replace-char
337 Vi replace character under the cursor with the next character typed.
338 .It Ic vi-replace-mode
339 Vi enter replace mode.
340 .It Ic vi-substitute-char
341 Vi replace character under the cursor and enter insert mode.
342 .It Ic vi-substitute-line
343 Vi substitute entire line.
344 .It Ic vi-change-to-eol
345 Vi change to end of line.
346 .It Ic vi-insert
347 Vi enter insert mode.
348 .It Ic vi-add
349 Vi enter insert mode after the cursor.
350 .It Ic vi-add-at-eol
351 Vi enter insert mode at end of line.
352 .It Ic vi-delete-meta
353 Vi delete prefix command.
354 .It Ic vi-end-word
355 Vi move to the end of the current space delimited word.
356 .It Ic vi-to-end-word
357 Vi move to the end of the current word.
358 .It Ic vi-undo
359 Vi undo last change.
360 .It Ic vi-command-mode
361 Vi enter command mode (use alternative key bindings).
362 .It Ic vi-zero
363 Vi move to the beginning of line.
364 .It Ic vi-delete-prev-char
365 Vi move to previous character (backspace).
366 .It Ic vi-list-or-eof
367 Vi list choices for completion or indicate end of file if empty line.
368 .It Ic vi-kill-line-prev
369 Vi cut from beginning of line to cursor.
370 .It Ic vi-search-prev
371 Vi search history previous.
372 .It Ic vi-search-next
373 Vi search history next.
374 .It Ic vi-repeat-search-next
375 Vi repeat current search in the same search direction.
376 .It Ic vi-repeat-search-prev
377 Vi repeat current search in the opposite search direction.
378 .It Ic vi-next-char
379 Vi move to the character specified next.
380 .It Ic vi-prev-char
381 Vi move to the character specified previous.
382 .It Ic vi-to-next-char
383 Vi move up to the character specified next.
384 .It Ic vi-to-prev-char
385 Vi move up to the character specified previous.
386 .It Ic vi-repeat-next-char
387 Vi repeat current character search in the same search direction.
388 .It Ic vi-repeat-prev-char
389 Vi repeat current character search in the opposite search direction.
390 .It Ic em-delete-or-list
391 Delete character under cursor or list completions if at end of line.
392 .It Ic em-delete-next-word
393 Cut from cursor to end of current word.
394 .It Ic em-yank
395 Paste cut buffer at cursor position.
396 .It Ic em-kill-line
397 Cut the entire line and save in cut buffer.
398 .It Ic em-kill-region
399 Cut area between mark and cursor and save in cut buffer.
400 .It Ic em-copy-region
401 Copy area between mark and cursor to cut buffer.
402 .It Ic em-gosmacs-transpose
403 Exchange the two characters before the cursor.
404 .It Ic em-next-word
405 Move next to end of current word.
406 .It Ic em-upper-case
407 Uppercase the characters from cursor to end of current word.
408 .It Ic em-capitol-case
409 Capitalize the characters from cursor to end of current word.
410 .It Ic em-lower-case
411 Lowercase the characters from cursor to end of current word.
412 .It Ic em-set-mark
413 Set the mark at cursor.
414 .It Ic em-exchange-mark
415 Exchange the cursor and mark.
416 .It Ic em-universal-argument
417 Universal argument (argument times 4).
418 .It Ic em-meta-next
419 Add 8th bit to next character typed.
420 .It Ic em-toggle-overwrite
421 Switch from insert to overwrite mode or vice versa.
422 .It Ic em-copy-prev-word
423 Copy current word to cursor.
424 .It Ic em-inc-search-next
425 Emacs incremental next search.
426 .It Ic em-inc-search-prev
427 Emacs incremental reverse search.
428 .It Ic ed-end-of-file
429 Indicate end of file.
430 .It Ic ed-insert
431 Add character to the line.
432 .It Ic ed-delete-prev-word
433 Delete from beginning of current word to cursor.
434 .It Ic ed-delete-next-char
435 Delete character under cursor.
436 .It Ic ed-kill-line
437 Cut to the end of line.
438 .It Ic ed-move-to-end
439 Move cursor to the end of line.
440 .It Ic ed-move-to-beg
441 Move cursor to the beginning of line.
442 .It Ic ed-transpose-chars
443 Exchange the character to the left of the cursor with the one under it.
444 .It Ic ed-next-char
445 Move to the right one character.
446 .It Ic ed-prev-word
447 Move to the beginning of the current word.
448 .It Ic ed-prev-char
449 Move to the left one character.
450 .It Ic ed-quoted-insert
451 Add the next character typed verbatim.
452 .It Ic ed-digit
453 Adds to argument or enters a digit.
454 .It Ic ed-argument-digit
455 Digit that starts argument.
456 .It Ic ed-unassigned
457 Indicates unbound character.
458 .It Ic ed-tty-sigint
459 Tty interrupt character.
460 .It Ic ed-tty-dsusp
461 Tty delayed suspend character.
462 .It Ic ed-tty-flush-output
463 Tty flush output characters.
464 .It Ic ed-tty-sigquit
465 Tty quit character.
466 .It Ic ed-tty-sigtstp
467 Tty suspend character.
468 .It Ic ed-tty-stop-output
469 Tty disallow output characters.
470 .It Ic ed-tty-start-output
471 Tty allow output characters.
472 .It Ic ed-newline
473 Execute command.
474 .It Ic ed-delete-prev-char
475 Delete the character to the left of the cursor.
476 .It Ic ed-clear-screen
477 Clear screen leaving current line at the top.
478 .It Ic ed-redisplay
479 Redisplay everything.
480 .It Ic ed-start-over
481 Erase current line and start from scratch.
482 .It Ic ed-sequence-lead-in
483 First character in a bound sequence.
484 .It Ic ed-prev-history
485 Move to the previous history line.
486 .It Ic ed-next-history
487 Move to the next history line.
488 .It Ic ed-search-prev-history
489 Search previous in history for a line matching the current.
490 .It Ic ed-search-next-history
491 Search next in history for a line matching the current.
492 .It Ic ed-prev-line
493 Move up one line.
494 .It Ic ed-next-line
495 Move down one line.
496 .It Ic ed-command
497 Editline extended command.
498 .El
499 .\" End of section automatically generated with makelist
500 .Sh SEE ALSO
501 .Xr editline 3 ,
502 .Xr regex 3 ,
503 .Xr termcap 5
504 .Sh AUTHORS
505 The
506 .Nm editline
507 library was written by Christos Zoulas,
508 and this manual was written by Luke Mewburn,
509 with some sections inspired by
510 .Xr tcsh 1 .