xref: /openbsd/lib/libedit/editrc.5 (revision 905646f0)
1.\"	$OpenBSD: editrc.5,v 1.33 2020/04/23 21:28:08 jmc Exp $
2.\"	$NetBSD: editrc.5,v 1.31 2016/04/28 15:50:34 christos 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: April 23 2020 $
31.Dt EDITRC 5
32.Os
33.Sh NAME
34.Nm editrc
35.Nd configuration file for editline library
36.Sh DESCRIPTION
37The
38.Nm
39file defines various settings to be used by the
40.Xr editline 3
41library.
42.Pp
43The format of each line is:
44.Pp
45.Dl [prog:]command [arg ...]
46.Pp
47.Ar command
48is one of the
49.Xr editline 3
50builtin commands.
51Refer to
52.Sx BUILTIN COMMANDS
53for more information.
54.Pp
55.Ar prog
56is the program name string that a program defines when it calls
57.Xr el_init 3
58to set up
59.Xr editline 3 ,
60which is usually
61.Va argv[0] .
62.Ar command
63will be executed for any program which matches
64.Ar prog .
65.Pp
66.Ar prog
67may also be a
68.Xr regex 3
69style
70regular expression, in which case
71.Ar command
72will be executed for any program that matches the regular expression.
73.Pp
74If
75.Ar prog
76is absent,
77.Ar command
78is executed for all programs.
79.Sh BUILTIN COMMANDS
80The
81.Nm editline
82library has some builtin commands, which affect the way
83that the line editing and history functions operate.
84These are based on similar named builtins present in the tcsh shell.
85.Pp
86The following builtin commands are available:
87.Bl -tag -width 4n
88.It Ic bind Oo Fl aeklrsv Oc Op Ar key Op Ar command
89Without options and arguments, list all bound keys and macros, and
90the editor command or input string to which each one is bound.
91If only
92.Ar key
93is supplied, show the binding for that key or macro.
94If
95.Ar key command
96is supplied, bind the editor
97.Ar command
98to that key or macro.
99.Pp
100The options are as follows:
101.Bl -tag -width 4n
102.It Fl a
103List or change key bindings in the
104.Xr vi 1
105mode alternate (command mode) key map.
106.It Fl e
107Bind all keys to the standard GNU Emacs-like bindings.
108.It Fl k
109.Ar key
110is interpreted as a symbolic arrow key name, which may be one of
111.Sq up ,
112.Sq down ,
113.Sq left
114or
115.Sq right .
116.It Fl l
117List all editor commands and a short description of each.
118.It Fl r
119Remove the binding of the key or macro
120.Ar key .
121.It Fl s
122Define a keyboard macro rather than a key binding or command macro:
123.Ar command
124is taken as a literal string and appended to the input queue whenever
125.Ar key
126is typed.
127Bound keys and macros in
128.Ar command
129are themselves reinterpreted, and this continues for ten levels of
130interpretation.
131.It Fl v
132Bind all keys to the standard
133.Xr vi 1 Ns -like
134bindings.
135.El
136.Pp
137The
138.Xr editline 7
139manual documents all editor commands and contains more information
140about macros and the input queue.
141.Pp
142.Ar key
143and
144.Ar command
145can contain control characters of the form
146.Sm off
147.Sq No ^ Ar character
148.Sm on
149.Po
150e.g.\&
151.Sq ^A
152.Pc ,
153and the following backslashed escape sequences:
154.Pp
155.Bl -tag -compact -offset indent -width 4n
156.It Ic \ea
157Bell
158.It Ic \eb
159Backspace
160.It Ic \ee
161Escape
162.It Ic \ef
163Formfeed
164.It Ic \en
165Newline
166.It Ic \er
167Carriage return
168.It Ic \et
169Horizontal tab
170.It Ic \ev
171Vertical tab
172.Sm off
173.It Sy \e Ar nnn
174.Sm on
175The ASCII character corresponding to the octal number
176.Ar nnn .
177.El
178.Pp
179.Sq \e
180nullifies the special meaning of the following character,
181if it has any, notably
182.Sq \e
183and
184.Sq ^ .
185.It Ic echotc Oo Fl sv Oc Ar arg ...
186Exercise terminal capabilities given in
187.Ar arg ... .
188If
189.Ar arg
190is
191.Sq baud ,
192.Sq cols ,
193.Sq lines ,
194.Sq rows ,
195.Sq meta ,
196or
197.Sq tabs ,
198the value of that capability is printed, with
199.Dq yes
200or
201.Dq no
202indicating that the terminal does or does not have that capability.
203.Pp
204.Fl s
205returns an empty string for non-existent capabilities, rather than
206causing an error.
207.Fl v
208causes messages to be verbose.
209.It Ic edit Op Li on | Li off
210Enable or disable the
211.Nm editline
212functionality in a program.
213.It Ic history Ar list | Ar size Dv n | Ar unique Dv n
214The
215.Ar list
216command lists all entries in the history.
217The
218.Ar size
219command sets the history size to
220.Dv n
221entries.
222The
223.Ar unique
224command controls if history should keep duplicate entries.
225If
226.Dv n
227is non zero, only keep unique history entries.
228If
229.Dv n
230is zero, then keep all entries (the default).
231.It Ic settc Ar cap val
232Set the terminal capability
233.Ar cap
234to
235.Ar val ,
236as defined in
237.Xr termcap 5 .
238No sanity checking is done.
239.It Ic setty Xo
240.Op Fl adqx
241.Op Ar +mode
242.Op Ar -mode
243.Op Ar mode
244.Op Ar char=c
245.Xc
246Control which tty modes that
247.Nm
248won't allow the user to change.
249.Fl d ,
250.Fl q
251or
252.Fl x
253tells
254.Ic setty
255to act on the
256.Sq edit ,
257.Sq quote
258or
259.Sq execute
260set of tty modes respectively; defaulting to
261.Fl x .
262.Pp
263Without other arguments,
264.Ic setty
265lists the modes in the chosen set which are fixed on
266.Po
267.Sq +mode
268.Pc
269or off
270.Po
271.Sq -mode
272.Pc .
273.Fl a
274lists all tty modes in the chosen set regardless of the setting.
275With
276.Ar +mode ,
277.Ar -mode
278or
279.Ar mode ,
280fixes
281.Ar mode
282on or off or removes control of
283.Ar mode
284in the chosen set.
285.Pp
286.Ic Setty
287can also be used to set tty characters to particular values using
288.Ar char=value .
289If
290.Ar value
291is empty
292then the character is set to
293.Dv _POSIX_VDISABLE .
294.It Ic telltc
295List the values of all the terminal capabilities (see
296.Xr termcap 5 ) .
297.El
298.Sh FILES
299.Bl -tag -width "~/.editrcXXX"
300.It Pa ~/.editrc
301User configuration file for the
302.Xr editline 3
303library.
304.El
305.Sh SEE ALSO
306.Xr editline 3 ,
307.Xr regex 3 ,
308.Xr termcap 5 ,
309.Xr editline 7
310.Sh AUTHORS
311.An -nosplit
312The
313.Nm editline
314library was written by
315.An Christos Zoulas ,
316and this manual was written by
317.An Luke Mewburn ,
318with some sections inspired by tcsh.
319