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