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