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