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