]> git.ipfire.org Git - thirdparty/bash.git/blame - lib/readline/doc/readline.3
commit bash-20060209 snapshot
[thirdparty/bash.git] / lib / readline / doc / readline.3
CommitLineData
5e13499c
CR
1.\"
2.\" MAN PAGE COMMENTS to
3.\"
4.\" Chet Ramey
5.\" Information Network Services
6.\" Case Western Reserve University
7.\" chet@ins.CWRU.Edu
8.\"
8d618825 9.\" Last Change: Thu Feb 9 09:49:51 EST 2006
5e13499c 10.\"
8d618825 11.TH READLINE 3 "2006 Feb 9" "GNU Readline 5.2"
5e13499c
CR
12.\"
13.\" File Name macro. This used to be `.PN', for Path Name,
14.\" but Sun doesn't seem to like that very much.
15.\"
16.de FN
17\fI\|\\$1\|\fP
18..
19.SH NAME
20readline \- get a line from a user with editing
21.SH SYNOPSIS
22.LP
23.nf
24.ft B
25#include <stdio.h>
26#include <readline/readline.h>
27#include <readline/history.h>
28.ft
29.fi
30.LP
31.nf
32\fIchar *\fP
33.br
34\fBreadline\fP (\fIconst char *prompt\fP);
35.fi
36.SH COPYRIGHT
113d85a4
CR
37.if n Readline is Copyright (C) 1989\-2004 by the Free Software Foundation, Inc.
38.if t Readline is Copyright \(co 1989\-2004 by the Free Software Foundation, Inc.
5e13499c
CR
39.SH DESCRIPTION
40.LP
41.B readline
42will read a line from the terminal
43and return it, using
44.B prompt
45as a prompt. If
46.B prompt
47is \fBNULL\fP or the empty string, no prompt is issued.
48The line returned is allocated with
49.IR malloc (3);
50the caller must free it when finished. The line returned
51has the final newline removed, so only the text of the line
52remains.
53.LP
54.B readline
55offers editing capabilities while the user is entering the
56line.
57By default, the line editing commands
58are similar to those of emacs.
59A vi\-style line editing interface is also available.
60.LP
61This manual page describes only the most basic use of \fBreadline\fP.
62Much more functionality is available; see
63\fIThe GNU Readline Library\fP and \fIThe GNU History Library\fP
64for additional information.
65.SH RETURN VALUE
66.LP
67.B readline
68returns the text of the line read. A blank line
69returns the empty string. If
70.B EOF
71is encountered while reading a line, and the line is empty,
72.B NULL
73is returned. If an
74.B EOF
75is read with a non\-empty line, it is
76treated as a newline.
77.SH NOTATION
78.LP
79An emacs-style notation is used to denote
80keystrokes. Control keys are denoted by C\-\fIkey\fR, e.g., C\-n
81means Control\-N. Similarly,
82.I meta
83keys are denoted by M\-\fIkey\fR, so M\-x means Meta\-X. (On keyboards
84without a
85.I meta
86key, M\-\fIx\fP means ESC \fIx\fP, i.e., press the Escape key
87then the
88.I x
89key. This makes ESC the \fImeta prefix\fP.
90The combination M\-C\-\fIx\fP means ESC\-Control\-\fIx\fP,
91or press the Escape key
92then hold the Control key while pressing the
93.I x
94key.)
95.PP
96Readline commands may be given numeric
97.IR arguments ,
98which normally act as a repeat count. Sometimes, however, it is the
99sign of the argument that is significant. Passing a negative argument
100to a command that acts in the forward direction (e.g., \fBkill\-line\fP)
101causes that command to act in a backward direction. Commands whose
102behavior with arguments deviates from this are noted.
103.PP
104When a command is described as \fIkilling\fP text, the text
105deleted is saved for possible future retrieval
106(\fIyanking\fP). The killed text is saved in a
107\fIkill ring\fP. Consecutive kills cause the text to be
108accumulated into one unit, which can be yanked all at once.
109Commands which do not kill text separate the chunks of text
110on the kill ring.
111.SH INITIALIZATION FILE
112.LP
113Readline is customized by putting commands in an initialization
114file (the \fIinputrc\fP file).
115The name of this file is taken from the value of the
116.B INPUTRC
117environment variable. If that variable is unset, the default is
118.IR ~/.inputrc .
8d618825
CR
119If that file does not exist or cannot be read, the ultimate default is
120.IR /etc/inputrc .
5e13499c
CR
121When a program which uses the readline library starts up, the
122init file is read, and the key bindings and variables are set.
123There are only a few basic constructs allowed in the
124readline init file. Blank lines are ignored.
125Lines beginning with a \fB#\fP are comments.
126Lines beginning with a \fB$\fP indicate conditional constructs.
127Other lines denote key bindings and variable settings.
128Each program using this library may add its own commands
129and bindings.
130.PP
131For example, placing
132.RS
133.PP
134M\-Control\-u: universal\-argument
135.RE
136or
137.RS
138C\-Meta\-u: universal\-argument
139.RE
140.sp
141into the
142.I inputrc
143would make M\-C\-u execute the readline command
144.IR universal\-argument .
145.PP
146The following symbolic character names are recognized while
147processing key bindings:
148.IR DEL ,
149.IR ESC ,
150.IR ESCAPE ,
151.IR LFD ,
152.IR NEWLINE ,
153.IR RET ,
154.IR RETURN ,
155.IR RUBOUT ,
156.IR SPACE ,
157.IR SPC ,
158and
159.IR TAB .
160.PP
161In addition to command names, readline allows keys to be bound
162to a string that is inserted when the key is pressed (a \fImacro\fP).
163.PP
164.SS Key Bindings
165.PP
166The syntax for controlling key bindings in the
167.I inputrc
168file is simple. All that is required is the name of the
169command or the text of a macro and a key sequence to which
170it should be bound. The name may be specified in one of two ways:
171as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP
172prefixes, or as a key sequence.
173.PP
174When using the form \fBkeyname\fP:\^\fIfunction-name\fP or \fImacro\fP,
175.I keyname
176is the name of a key spelled out in English. For example:
177.sp
178.RS
179Control\-u: universal\-argument
180.br
181Meta\-Rubout: backward\-kill\-word
182.br
183Control\-o: "> output"
184.RE
185.LP
186In the above example,
187.I C\-u
188is bound to the function
189.BR universal\-argument ,
190.I M-DEL
191is bound to the function
192.BR backward\-kill\-word ,
193and
194.I C\-o
195is bound to run the macro
196expressed on the right hand side (that is, to insert the text
197.if t \f(CW> output\fP
198.if n ``> output''
199into the line).
200.PP
201In the second form, \fB"keyseq"\fP:\^\fIfunction\-name\fP or \fImacro\fP,
202.B keyseq
203differs from
204.B keyname
205above in that strings denoting
206an entire key sequence may be specified by placing the sequence
207within double quotes. Some GNU Emacs style key escapes can be
208used, as in the following example, but the symbolic character names
209are not recognized.
210.sp
211.RS
212"\eC\-u": universal\-argument
213.br
214"\eC\-x\eC\-r": re\-read\-init\-file
215.br
216"\ee[11~": "Function Key 1"
217.RE
218.PP
219In this example,
220.I C-u
221is again bound to the function
222.BR universal\-argument .
223.I "C-x C-r"
224is bound to the function
225.BR re\-read\-init\-file ,
226and
227.I "ESC [ 1 1 ~"
228is bound to insert the text
229.if t \f(CWFunction Key 1\fP.
230.if n ``Function Key 1''.
231.PP
232The full set of GNU Emacs style escape sequences available when specifying
233key sequences is
234.RS
235.PD 0
236.TP
237.B \eC\-
238control prefix
239.TP
240.B \eM\-
241meta prefix
242.TP
243.B \ee
244an escape character
245.TP
246.B \e\e
247backslash
248.TP
249.B \e"
250literal ", a double quote
251.TP
252.B \e'
253literal ', a single quote
254.RE
255.PD
256.PP
257In addition to the GNU Emacs style escape sequences, a second
258set of backslash escapes is available:
259.RS
260.PD 0
261.TP
262.B \ea
263alert (bell)
264.TP
265.B \eb
266backspace
267.TP
268.B \ed
269delete
270.TP
271.B \ef
272form feed
273.TP
274.B \en
275newline
276.TP
277.B \er
278carriage return
279.TP
280.B \et
281horizontal tab
282.TP
283.B \ev
284vertical tab
285.TP
286.B \e\fInnn\fP
287the eight-bit character whose value is the octal value \fInnn\fP
288(one to three digits)
289.TP
290.B \ex\fIHH\fP
291the eight-bit character whose value is the hexadecimal value \fIHH\fP
292(one or two hex digits)
293.RE
294.PD
295.PP
296When entering the text of a macro, single or double quotes should
297be used to indicate a macro definition. Unquoted text
298is assumed to be a function name.
299In the macro body, the backslash escapes described above are expanded.
300Backslash will quote any other character in the macro text,
301including " and '.
302.PP
303.B Bash
304allows the current readline key bindings to be displayed or modified
305with the
306.B bind
307builtin command. The editing mode may be switched during interactive
308use by using the
309.B \-o
310option to the
311.B set
312builtin command. Other programs using this library provide
313similar mechanisms. The
314.I inputrc
315file may be edited and re-read if a program does not provide
316any other means to incorporate new bindings.
317.SS Variables
318.PP
319Readline has variables that can be used to further customize its
320behavior. A variable may be set in the
321.I inputrc
322file with a statement of the form
323.RS
324.PP
325\fBset\fP \fIvariable\-name\fP \fIvalue\fP
326.RE
327.PP
328Except where noted, readline variables can take the values
329.B On
330or
331.B Off
332(without regard to case).
ff247e74
CR
333Unrecognized variable names are ignored.
334When a variable value is read, empty or null values, "on" (case-insensitive),
335and "1" are equivalent to \fBOn\fP. All other values are equivalent to
336\fBOff\fP.
5e13499c
CR
337The variables and their default values are:
338.PP
339.PD 0
340.TP
341.B bell\-style (audible)
342Controls what happens when readline wants to ring the terminal bell.
343If set to \fBnone\fP, readline never rings the bell. If set to
344\fBvisible\fP, readline uses a visible bell if one is available.
345If set to \fBaudible\fP, readline attempts to ring the terminal's bell.
346.TP
453f278a
CR
347.B bind\-tty\-special\-chars (On)
348If set to \fBOn\fP, readline attempts to bind the control characters
349treated specially by the kernel's terminal driver to their readline
350equivalents.
351.TP
5e13499c
CR
352.B comment\-begin (``#'')
353The string that is inserted in \fBvi\fP mode when the
354.B insert\-comment
355command is executed.
356This command is bound to
357.B M\-#
358in emacs mode and to
359.B #
360in vi command mode.
361.TP
362.B completion\-ignore\-case (Off)
363If set to \fBOn\fP, readline performs filename matching and completion
364in a case\-insensitive fashion.
365.TP
366.B completion\-query\-items (100)
367This determines when the user is queried about viewing
368the number of possible completions
369generated by the \fBpossible\-completions\fP command.
370It may be set to any integer value greater than or equal to
371zero. If the number of possible completions is greater than
372or equal to the value of this variable, the user is asked whether
373or not he wishes to view them; otherwise they are simply listed
66e6d7cf 374on the terminal. A negative value causes readline to never ask.
5e13499c
CR
375.TP
376.B convert\-meta (On)
377If set to \fBOn\fP, readline will convert characters with the
378eighth bit set to an ASCII key sequence
379by stripping the eighth bit and prefixing it with an
380escape character (in effect, using escape as the \fImeta prefix\fP).
381.TP
382.B disable\-completion (Off)
383If set to \fBOn\fP, readline will inhibit word completion. Completion
384characters will be inserted into the line as if they had been
385mapped to \fBself-insert\fP.
386.TP
387.B editing\-mode (emacs)
388Controls whether readline begins with a set of key bindings similar
389to emacs or vi.
390.B editing\-mode
391can be set to either
392.B emacs
393or
394.BR vi .
395.TP
396.B enable\-keypad (Off)
397When set to \fBOn\fP, readline will try to enable the application
398keypad when it is called. Some systems need this to enable the
399arrow keys.
400.TP
401.B expand\-tilde (Off)
402If set to \fBon\fP, tilde expansion is performed when readline
403attempts word completion.
404.TP
cdb32d45 405.B history\-preserve\-point (Off)
5e13499c 406If set to \fBon\fP, the history code attempts to place point at the
cdb32d45 407same location on each history line retrieved with \fBprevious-history\fP
5e13499c
CR
408or \fBnext-history\fP.
409.TP
410.B horizontal\-scroll\-mode (Off)
411When set to \fBOn\fP, makes readline use a single line for display,
412scrolling the input horizontally on a single screen line when it
413becomes longer than the screen width rather than wrapping to a new line.
414.TP
415.B input\-meta (Off)
416If set to \fBOn\fP, readline will enable eight-bit input (that is,
417it will not clear the eighth bit in the characters it reads),
418regardless of what the terminal claims it can support. The name
419.B meta\-flag
420is a synonym for this variable.
421.TP
422.B isearch\-terminators (``C\-[ C\-J'')
423The string of characters that should terminate an incremental
424search without subsequently executing the character as a command.
425If this variable has not been given a value, the characters
426\fIESC\fP and \fIC\-J\fP will terminate an incremental search.
427.TP
428.B keymap (emacs)
429Set the current readline keymap. The set of legal keymap names is
430\fIemacs, emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move,
431vi-command\fP, and
432.IR vi-insert .
433\fIvi\fP is equivalent to \fIvi-command\fP; \fIemacs\fP is
434equivalent to \fIemacs-standard\fP. The default value is
435.IR emacs .
436The value of
437.B editing\-mode
438also affects the default keymap.
439.TP
440.B mark\-directories (On)
441If set to \fBOn\fP, completed directory names have a slash
442appended.
443.TP
444.B mark\-modified\-lines (Off)
445If set to \fBOn\fP, history lines that have been modified are displayed
446with a preceding asterisk (\fB*\fP).
447.TP
448.B mark\-symlinked\-directories (Off)
449If set to \fBOn\fP, completed names which are symbolic links to directories
450have a slash appended (subject to the value of
451\fBmark\-directories\fP).
452.TP
453.B match\-hidden\-files (On)
454This variable, when set to \fBOn\fP, causes readline to match files whose
455names begin with a `.' (hidden files) when performing filename
456completion, unless the leading `.' is
457supplied by the user in the filename to be completed.
458.TP
459.B output\-meta (Off)
460If set to \fBOn\fP, readline will display characters with the
461eighth bit set directly rather than as a meta-prefixed escape
462sequence.
463.TP
464.B page\-completions (On)
465If set to \fBOn\fP, readline uses an internal \fImore\fP-like pager
466to display a screenful of possible completions at a time.
467.TP
468.B print\-completions\-horizontally (Off)
469If set to \fBOn\fP, readline will display completions with matches
470sorted horizontally in alphabetical order, rather than down the screen.
471.TP
472.B show\-all\-if\-ambiguous (Off)
473This alters the default behavior of the completion functions. If
474set to
475.BR on ,
476words which have more than one possible completion cause the
477matches to be listed immediately instead of ringing the bell.
478.TP
479.B show\-all\-if\-unmodified (Off)
480This alters the default behavior of the completion functions in
481a fashion similar to \fBshow\-all\-if\-ambiguous\fP.
482If set to
483.BR on ,
484words which have more than one possible completion without any
485possible partial completion (the possible completions don't share
486a common prefix) cause the matches to be listed immediately instead
487of ringing the bell.
488.TP
489.B visible\-stats (Off)
490If set to \fBOn\fP, a character denoting a file's type as reported
491by \fIstat\fP(2) is appended to the filename when listing possible
492completions.
493.PD
494.SS Conditional Constructs
495.PP
496Readline implements a facility similar in spirit to the conditional
497compilation features of the C preprocessor which allows key
498bindings and variable settings to be performed as the result
499of tests. There are four parser directives used.
500.IP \fB$if\fP
501The
502.B $if
503construct allows bindings to be made based on the
504editing mode, the terminal being used, or the application using
505readline. The text of the test extends to the end of the line;
506no characters are required to isolate it.
507.RS
508.IP \fBmode\fP
509The \fBmode=\fP form of the \fB$if\fP directive is used to test
510whether readline is in emacs or vi mode.
511This may be used in conjunction
512with the \fBset keymap\fP command, for instance, to set bindings in
513the \fIemacs-standard\fP and \fIemacs-ctlx\fP keymaps only if
514readline is starting out in emacs mode.
515.IP \fBterm\fP
516The \fBterm=\fP form may be used to include terminal-specific
517key bindings, perhaps to bind the key sequences output by the
518terminal's function keys. The word on the right side of the
519.B =
520is tested against the full name of the terminal and the portion
521of the terminal name before the first \fB\-\fP. This allows
522.I sun
523to match both
524.I sun
525and
526.IR sun\-cmd ,
527for instance.
528.IP \fBapplication\fP
529The \fBapplication\fP construct is used to include
530application-specific settings. Each program using the readline
531library sets the \fIapplication name\fP, and an initialization
532file can test for a particular value.
533This could be used to bind key sequences to functions useful for
534a specific program. For instance, the following command adds a
535key sequence that quotes the current or previous word in Bash:
536.sp 1
537.RS
538.nf
539\fB$if\fP Bash
540# Quote the current or previous word
541"\eC-xq": "\eeb\e"\eef\e""
542\fB$endif\fP
543.fi
544.RE
545.RE
546.IP \fB$endif\fP
547This command, as seen in the previous example, terminates an
548\fB$if\fP command.
549.IP \fB$else\fP
550Commands in this branch of the \fB$if\fP directive are executed if
551the test fails.
552.IP \fB$include\fP
553This directive takes a single filename as an argument and reads commands
554and bindings from that file. For example, the following directive
555would read \fI/etc/inputrc\fP:
556.sp 1
557.RS
558.nf
559\fB$include\fP \^ \fI/etc/inputrc\fP
560.fi
561.RE
562.SH SEARCHING
563.PP
564Readline provides commands for searching through the command history
565for lines containing a specified string.
566There are two search modes:
567.I incremental
568and
569.IR non-incremental .
570.PP
571Incremental searches begin before the user has finished typing the
572search string.
573As each character of the search string is typed, readline displays
574the next entry from the history matching the string typed so far.
575An incremental search requires only as many characters as needed to
576find the desired history entry.
577To search backward in the history for a particular string, type
578\fBC\-r\fP. Typing \fBC\-s\fP searches forward through the history.
579The characters present in the value of the \fBisearch-terminators\fP
580variable are used to terminate an incremental search.
581If that variable has not been assigned a value the \fIEscape\fP and
582\fBC\-J\fP characters will terminate an incremental search.
583\fBC\-G\fP will abort an incremental search and restore the original
584line.
585When the search is terminated, the history entry containing the
586search string becomes the current line.
587.PP
588To find other matching entries in the history list, type \fBC\-s\fP or
589\fBC\-r\fP as appropriate.
590This will search backward or forward in the history for the next
591line matching the search string typed so far.
592Any other key sequence bound to a readline command will terminate
593the search and execute that command.
594For instance, a newline will terminate the search and accept
595the line, thereby executing the command from the history list.
596A movement command will terminate the search, make the last line found
597the current line, and begin editing.
598.PP
599Non-incremental searches read the entire search string before starting
600to search for matching history lines. The search string may be
601typed by the user or be part of the contents of the current line.
602.SH EDITING COMMANDS
603.PP
604The following is a list of the names of the commands and the default
605key sequences to which they are bound.
606Command names without an accompanying key sequence are unbound by default.
607.PP
608In the following descriptions, \fIpoint\fP refers to the current cursor
609position, and \fImark\fP refers to a cursor position saved by the
610\fBset\-mark\fP command.
611The text between the point and mark is referred to as the \fIregion\fP.
612.SS Commands for Moving
613.PP
614.PD 0
615.TP
616.B beginning\-of\-line (C\-a)
617Move to the start of the current line.
618.TP
619.B end\-of\-line (C\-e)
620Move to the end of the line.
621.TP
622.B forward\-char (C\-f)
623Move forward a character.
624.TP
625.B backward\-char (C\-b)
626Move back a character.
627.TP
628.B forward\-word (M\-f)
629Move forward to the end of the next word. Words are composed of
630alphanumeric characters (letters and digits).
631.TP
632.B backward\-word (M\-b)
633Move back to the start of the current or previous word. Words are
634composed of alphanumeric characters (letters and digits).
635.TP
636.B clear\-screen (C\-l)
637Clear the screen leaving the current line at the top of the screen.
638With an argument, refresh the current line without clearing the
639screen.
640.TP
641.B redraw\-current\-line
642Refresh the current line.
643.PD
644.SS Commands for Manipulating the History
645.PP
646.PD 0
647.TP
648.B accept\-line (Newline, Return)
649Accept the line regardless of where the cursor is.
650If this line is
651non-empty, it may be added to the history list for future recall with
652\fBadd_history()\fP.
653If the line is a modified history line, the history line is restored to its original state.
654.TP
655.B previous\-history (C\-p)
656Fetch the previous command from the history list, moving back in
657the list.
658.TP
659.B next\-history (C\-n)
660Fetch the next command from the history list, moving forward in the
661list.
662.TP
663.B beginning\-of\-history (M\-<)
664Move to the first line in the history.
665.TP
666.B end\-of\-history (M\->)
667Move to the end of the input history, i.e., the line currently being
668entered.
669.TP
670.B reverse\-search\-history (C\-r)
671Search backward starting at the current line and moving `up' through
672the history as necessary. This is an incremental search.
673.TP
674.B forward\-search\-history (C\-s)
675Search forward starting at the current line and moving `down' through
676the history as necessary. This is an incremental search.
677.TP
678.B non\-incremental\-reverse\-search\-history (M\-p)
679Search backward through the history starting at the current line
680using a non-incremental search for a string supplied by the user.
681.TP
682.B non\-incremental\-forward\-search\-history (M\-n)
683Search forward through the history using a non-incremental search
684for a string supplied by the user.
685.TP
686.B history\-search\-forward
687Search forward through the history for the string of characters
688between the start of the current line and the current cursor
689position (the \fIpoint\fP).
690This is a non-incremental search.
691.TP
692.B history\-search\-backward
693Search backward through the history for the string of characters
694between the start of the current line and the point.
695This is a non-incremental search.
696.TP
697.B yank\-nth\-arg (M\-C\-y)
698Insert the first argument to the previous command (usually
699the second word on the previous line) at point.
700With an argument
701.IR n ,
702insert the \fIn\fPth word from the previous command (the words
703in the previous command begin with word 0). A negative argument
704inserts the \fIn\fPth word from the end of the previous command.
eb2bb562
CR
705Once the argument \fIn\fP is computed, the argument is extracted
706as if the "!\fIn\fP" history expansion had been specified.
5e13499c
CR
707.TP
708.B
709yank\-last\-arg (M\-.\^, M\-_\^)
710Insert the last argument to the previous command (the last word of
711the previous history entry). With an argument,
712behave exactly like \fByank\-nth\-arg\fP.
713Successive calls to \fByank\-last\-arg\fP move back through the history
714list, inserting the last argument of each line in turn.
eb2bb562
CR
715The history expansion facilities are used to extract the last argument,
716as if the "!$" history expansion had been specified.
5e13499c
CR
717.PD
718.SS Commands for Changing Text
719.PP
720.PD 0
721.TP
722.B delete\-char (C\-d)
723Delete the character at point. If point is at the
724beginning of the line, there are no characters in the line, and
725the last character typed was not bound to \fBdelete\-char\fP, then return
726.SM
727.BR EOF .
728.TP
729.B backward\-delete\-char (Rubout)
730Delete the character behind the cursor. When given a numeric argument,
731save the deleted text on the kill ring.
732.TP
733.B forward\-backward\-delete\-char
734Delete the character under the cursor, unless the cursor is at the
735end of the line, in which case the character behind the cursor is
736deleted.
737.TP
738.B quoted\-insert (C\-q, C\-v)
739Add the next character that you type to the line verbatim. This is
740how to insert characters like \fBC\-q\fP, for example.
741.TP
742.B tab\-insert (M-TAB)
743Insert a tab character.
744.TP
745.B self\-insert (a,\ b,\ A,\ 1,\ !,\ ...)
746Insert the character typed.
747.TP
748.B transpose\-chars (C\-t)
749Drag the character before point forward over the character at point,
750moving point forward as well.
751If point is at the end of the line, then this transposes
752the two characters before point.
753Negative arguments have no effect.
754.TP
755.B transpose\-words (M\-t)
756Drag the word before point past the word after point,
757moving point over that word as well.
758If point is at the end of the line, this transposes
759the last two words on the line.
760.TP
761.B upcase\-word (M\-u)
762Uppercase the current (or following) word. With a negative argument,
763uppercase the previous word, but do not move point.
764.TP
765.B downcase\-word (M\-l)
766Lowercase the current (or following) word. With a negative argument,
767lowercase the previous word, but do not move point.
768.TP
769.B capitalize\-word (M\-c)
770Capitalize the current (or following) word. With a negative argument,
771capitalize the previous word, but do not move point.
772.TP
773.B overwrite\-mode
774Toggle overwrite mode. With an explicit positive numeric argument,
775switches to overwrite mode. With an explicit non-positive numeric
776argument, switches to insert mode. This command affects only
777\fBemacs\fP mode; \fBvi\fP mode does overwrite differently.
778Each call to \fIreadline()\fP starts in insert mode.
779In overwrite mode, characters bound to \fBself\-insert\fP replace
780the text at point rather than pushing the text to the right.
781Characters bound to \fBbackward\-delete\-char\fP replace the character
782before point with a space. By default, this command is unbound.
783.PD
784.SS Killing and Yanking
785.PP
786.PD 0
787.TP
788.B kill\-line (C\-k)
789Kill the text from point to the end of the line.
790.TP
791.B backward\-kill\-line (C\-x Rubout)
792Kill backward to the beginning of the line.
793.TP
794.B unix\-line\-discard (C\-u)
795Kill backward from point to the beginning of the line.
796The killed text is saved on the kill-ring.
797.\" There is no real difference between this and backward-kill-line
798.TP
799.B kill\-whole\-line
800Kill all characters on the current line, no matter where point is.
801.TP
802.B kill\-word (M\-d)
803Kill from point the end of the current word, or if between
804words, to the end of the next word. Word boundaries are the same as
805those used by \fBforward\-word\fP.
806.TP
807.B backward\-kill\-word (M\-Rubout)
808Kill the word behind point.
809Word boundaries are the same as those used by \fBbackward\-word\fP.
810.TP
811.B unix\-word\-rubout (C\-w)
812Kill the word behind point, using white space as a word boundary.
813The killed text is saved on the kill-ring.
814.TP
113d85a4
CR
815.B unix\-filename\-rubout
816Kill the word behind point, using white space and the slash character
817as the word boundaries.
818The killed text is saved on the kill-ring.
819.TP
5e13499c
CR
820.B delete\-horizontal\-space (M\-\e)
821Delete all spaces and tabs around point.
822.TP
823.B kill\-region
824Kill the text between the point and \fImark\fP (saved cursor position).
825This text is referred to as the \fIregion\fP.
826.TP
827.B copy\-region\-as\-kill
828Copy the text in the region to the kill buffer.
829.TP
830.B copy\-backward\-word
831Copy the word before point to the kill buffer.
832The word boundaries are the same as \fBbackward\-word\fP.
833.TP
834.B copy\-forward\-word
835Copy the word following point to the kill buffer.
836The word boundaries are the same as \fBforward\-word\fP.
837.TP
838.B yank (C\-y)
839Yank the top of the kill ring into the buffer at point.
840.TP
841.B yank\-pop (M\-y)
842Rotate the kill ring, and yank the new top. Only works following
843.B yank
844or
845.BR yank\-pop .
846.PD
847.SS Numeric Arguments
848.PP
849.PD 0
850.TP
851.B digit\-argument (M\-0, M\-1, ..., M\-\-)
852Add this digit to the argument already accumulating, or start a new
853argument. M\-\- starts a negative argument.
854.TP
855.B universal\-argument
856This is another way to specify an argument.
857If this command is followed by one or more digits, optionally with a
858leading minus sign, those digits define the argument.
859If the command is followed by digits, executing
860.B universal\-argument
861again ends the numeric argument, but is otherwise ignored.
862As a special case, if this command is immediately followed by a
863character that is neither a digit or minus sign, the argument count
864for the next command is multiplied by four.
865The argument count is initially one, so executing this function the
866first time makes the argument count four, a second time makes the
867argument count sixteen, and so on.
868.PD
869.SS Completing
870.PP
871.PD 0
872.TP
873.B complete (TAB)
874Attempt to perform completion on the text before point.
875The actual completion performed is application-specific.
876.BR Bash ,
877for instance, attempts completion treating the text as a variable
878(if the text begins with \fB$\fP), username (if the text begins with
879\fB~\fP), hostname (if the text begins with \fB@\fP), or
880command (including aliases and functions) in turn. If none
881of these produces a match, filename completion is attempted.
882.BR Gdb ,
883on the other hand,
884allows completion of program functions and variables, and
885only attempts filename completion under certain circumstances.
886.TP
887.B possible\-completions (M\-?)
888List the possible completions of the text before point.
889.TP
890.B insert\-completions (M\-*)
891Insert all completions of the text before point
892that would have been generated by
893\fBpossible\-completions\fP.
894.TP
895.B menu\-complete
896Similar to \fBcomplete\fP, but replaces the word to be completed
897with a single match from the list of possible completions.
898Repeated execution of \fBmenu\-complete\fP steps through the list
899of possible completions, inserting each match in turn.
900At the end of the list of completions, the bell is rung
901(subject to the setting of \fBbell\-style\fP)
902and the original text is restored.
903An argument of \fIn\fP moves \fIn\fP positions forward in the list
904of matches; a negative argument may be used to move backward
905through the list.
906This command is intended to be bound to \fBTAB\fP, but is unbound
907by default.
908.TP
909.B delete\-char\-or\-list
910Deletes the character under the cursor if not at the beginning or
911end of the line (like \fBdelete-char\fP).
912If at the end of the line, behaves identically to
913\fBpossible-completions\fP.
914.PD
915.SS Keyboard Macros
916.PP
917.PD 0
918.TP
919.B start\-kbd\-macro (C\-x (\^)
920Begin saving the characters typed into the current keyboard macro.
921.TP
922.B end\-kbd\-macro (C\-x )\^)
923Stop saving the characters typed into the current keyboard macro
924and store the definition.
925.TP
926.B call\-last\-kbd\-macro (C\-x e)
927Re-execute the last keyboard macro defined, by making the characters
928in the macro appear as if typed at the keyboard.
929.PD
930.SS Miscellaneous
931.PP
932.PD 0
933.TP
934.B re\-read\-init\-file (C\-x C\-r)
935Read in the contents of the \fIinputrc\fP file, and incorporate
936any bindings or variable assignments found there.
937.TP
938.B abort (C\-g)
939Abort the current editing command and
940ring the terminal's bell (subject to the setting of
941.BR bell\-style ).
942.TP
943.B do\-uppercase\-version (M\-a, M\-b, M\-\fIx\fP, ...)
944If the metafied character \fIx\fP is lowercase, run the command
945that is bound to the corresponding uppercase character.
946.TP
947.B prefix\-meta (ESC)
948Metafy the next character typed.
949.SM
950.B ESC
951.B f
952is equivalent to
953.BR Meta\-f .
954.TP
955.B undo (C\-_, C\-x C\-u)
956Incremental undo, separately remembered for each line.
957.TP
958.B revert\-line (M\-r)
959Undo all changes made to this line. This is like executing the
960.B undo
961command enough times to return the line to its initial state.
962.TP
963.B tilde\-expand (M\-&)
964Perform tilde expansion on the current word.
965.TP
966.B set\-mark (C\-@, M\-<space>)
967Set the mark to the point. If a
968numeric argument is supplied, the mark is set to that position.
969.TP
970.B exchange\-point\-and\-mark (C\-x C\-x)
971Swap the point with the mark. The current cursor position is set to
972the saved position, and the old cursor position is saved as the mark.
973.TP
974.B character\-search (C\-])
975A character is read and point is moved to the next occurrence of that
976character. A negative count searches for previous occurrences.
977.TP
978.B character\-search\-backward (M\-C\-])
979A character is read and point is moved to the previous occurrence of that
980character. A negative count searches for subsequent occurrences.
981.TP
982.B insert\-comment (M\-#)
983Without a numeric argument, the value of the readline
984.B comment\-begin
985variable is inserted at the beginning of the current line.
986If a numeric argument is supplied, this command acts as a toggle: if
987the characters at the beginning of the line do not match the value
988of \fBcomment\-begin\fP, the value is inserted, otherwise
989the characters in \fBcomment-begin\fP are deleted from the beginning of
990the line.
991In either case, the line is accepted as if a newline had been typed.
992The default value of
993.B comment\-begin
994makes the current line a shell comment.
995If a numeric argument causes the comment character to be removed, the line
996will be executed by the shell.
997.TP
998.B dump\-functions
999Print all of the functions and their key bindings to the
1000readline output stream. If a numeric argument is supplied,
1001the output is formatted in such a way that it can be made part
1002of an \fIinputrc\fP file.
1003.TP
1004.B dump\-variables
1005Print all of the settable variables and their values to the
1006readline output stream. If a numeric argument is supplied,
1007the output is formatted in such a way that it can be made part
1008of an \fIinputrc\fP file.
1009.TP
1010.B dump\-macros
1011Print all of the readline key sequences bound to macros and the
1012strings they output. If a numeric argument is supplied,
1013the output is formatted in such a way that it can be made part
1014of an \fIinputrc\fP file.
1015.TP
1016.B emacs\-editing\-mode (C\-e)
1017When in
1018.B vi
1019command mode, this causes a switch to
1020.B emacs
1021editing mode.
1022.TP
1023.B vi\-editing\-mode (M\-C\-j)
1024When in
1025.B emacs
1026editing mode, this causes a switch to
1027.B vi
1028editing mode.
1029.PD
1030.SH DEFAULT KEY BINDINGS
1031.LP
1032The following is a list of the default emacs and vi bindings.
1033Characters with the eighth bit set are written as M\-<character>, and
1034are referred to as
1035.I metafied
1036characters.
1037The printable ASCII characters not mentioned in the list of emacs
1038standard bindings are bound to the
1039.B self\-insert
1040function, which just inserts the given character into the input line.
1041In vi insertion mode, all characters not specifically mentioned are
1042bound to
1043.BR self\-insert .
1044Characters assigned to signal generation by
1045.IR stty (1)
1046or the terminal driver, such as C-Z or C-C,
1047retain that function.
1048Upper and lower case metafied characters are bound to the same function in
1049the emacs mode meta keymap.
1050The remaining characters are unbound, which causes readline
1051to ring the bell (subject to the setting of the
1052.B bell\-style
1053variable).
1054.SS Emacs Mode
1055.RS +.6i
1056.nf
1057.ta 2.5i
1058.sp
1059Emacs Standard bindings
1060.sp
1061"C-@" set-mark
1062"C-A" beginning-of-line
1063"C-B" backward-char
1064"C-D" delete-char
1065"C-E" end-of-line
1066"C-F" forward-char
1067"C-G" abort
1068"C-H" backward-delete-char
1069"C-I" complete
1070"C-J" accept-line
1071"C-K" kill-line
1072"C-L" clear-screen
1073"C-M" accept-line
1074"C-N" next-history
1075"C-P" previous-history
1076"C-Q" quoted-insert
1077"C-R" reverse-search-history
1078"C-S" forward-search-history
1079"C-T" transpose-chars
1080"C-U" unix-line-discard
1081"C-V" quoted-insert
1082"C-W" unix-word-rubout
1083"C-Y" yank
1084"C-]" character-search
1085"C-_" undo
1086"\^ " to "/" self-insert
1087"0" to "9" self-insert
1088":" to "~" self-insert
1089"C-?" backward-delete-char
1090.PP
1091Emacs Meta bindings
1092.sp
1093"M-C-G" abort
1094"M-C-H" backward-kill-word
1095"M-C-I" tab-insert
1096"M-C-J" vi-editing-mode
1097"M-C-M" vi-editing-mode
1098"M-C-R" revert-line
1099"M-C-Y" yank-nth-arg
1100"M-C-[" complete
1101"M-C-]" character-search-backward
1102"M-space" set-mark
1103"M-#" insert-comment
1104"M-&" tilde-expand
1105"M-*" insert-completions
1106"M--" digit-argument
1107"M-." yank-last-arg
1108"M-0" digit-argument
1109"M-1" digit-argument
1110"M-2" digit-argument
1111"M-3" digit-argument
1112"M-4" digit-argument
1113"M-5" digit-argument
1114"M-6" digit-argument
1115"M-7" digit-argument
1116"M-8" digit-argument
1117"M-9" digit-argument
1118"M-<" beginning-of-history
1119"M-=" possible-completions
1120"M->" end-of-history
1121"M-?" possible-completions
1122"M-B" backward-word
1123"M-C" capitalize-word
1124"M-D" kill-word
1125"M-F" forward-word
1126"M-L" downcase-word
1127"M-N" non-incremental-forward-search-history
1128"M-P" non-incremental-reverse-search-history
1129"M-R" revert-line
1130"M-T" transpose-words
1131"M-U" upcase-word
1132"M-Y" yank-pop
1133"M-\e" delete-horizontal-space
1134"M-~" tilde-expand
1135"M-C-?" backward-kill-word
1136"M-_" yank-last-arg
1137.PP
1138Emacs Control-X bindings
1139.sp
1140"C-XC-G" abort
1141"C-XC-R" re-read-init-file
1142"C-XC-U" undo
1143"C-XC-X" exchange-point-and-mark
1144"C-X(" start-kbd-macro
1145"C-X)" end-kbd-macro
1146"C-XE" call-last-kbd-macro
1147"C-XC-?" backward-kill-line
1148.sp
1149.RE
1150.SS VI Mode bindings
1151.RS +.6i
1152.nf
1153.ta 2.5i
1154.sp
1155.PP
1156VI Insert Mode functions
1157.sp
1158"C-D" vi-eof-maybe
1159"C-H" backward-delete-char
1160"C-I" complete
1161"C-J" accept-line
1162"C-M" accept-line
1163"C-R" reverse-search-history
1164"C-S" forward-search-history
1165"C-T" transpose-chars
1166"C-U" unix-line-discard
1167"C-V" quoted-insert
1168"C-W" unix-word-rubout
1169"C-Y" yank
1170"C-[" vi-movement-mode
1171"C-_" undo
1172"\^ " to "~" self-insert
1173"C-?" backward-delete-char
1174.PP
1175VI Command Mode functions
1176.sp
1177"C-D" vi-eof-maybe
1178"C-E" emacs-editing-mode
1179"C-G" abort
1180"C-H" backward-char
1181"C-J" accept-line
1182"C-K" kill-line
1183"C-L" clear-screen
1184"C-M" accept-line
1185"C-N" next-history
1186"C-P" previous-history
1187"C-Q" quoted-insert
1188"C-R" reverse-search-history
1189"C-S" forward-search-history
1190"C-T" transpose-chars
1191"C-U" unix-line-discard
1192"C-V" quoted-insert
1193"C-W" unix-word-rubout
1194"C-Y" yank
1195"C-_" vi-undo
1196"\^ " forward-char
1197"#" insert-comment
1198"$" end-of-line
1199"%" vi-match
1200"&" vi-tilde-expand
1201"*" vi-complete
1202"+" next-history
1203"," vi-char-search
1204"-" previous-history
1205"." vi-redo
1206"/" vi-search
1207"0" beginning-of-line
1208"1" to "9" vi-arg-digit
1209";" vi-char-search
1210"=" vi-complete
1211"?" vi-search
1212"A" vi-append-eol
1213"B" vi-prev-word
1214"C" vi-change-to
1215"D" vi-delete-to
1216"E" vi-end-word
1217"F" vi-char-search
1218"G" vi-fetch-history
1219"I" vi-insert-beg
1220"N" vi-search-again
1221"P" vi-put
1222"R" vi-replace
1223"S" vi-subst
1224"T" vi-char-search
1225"U" revert-line
1226"W" vi-next-word
1227"X" backward-delete-char
1228"Y" vi-yank-to
1229"\e" vi-complete
1230"^" vi-first-print
1231"_" vi-yank-arg
1232"`" vi-goto-mark
1233"a" vi-append-mode
1234"b" vi-prev-word
1235"c" vi-change-to
1236"d" vi-delete-to
1237"e" vi-end-word
1238"f" vi-char-search
1239"h" backward-char
1240"i" vi-insertion-mode
1241"j" next-history
1242"k" prev-history
1243"l" forward-char
1244"m" vi-set-mark
1245"n" vi-search-again
1246"p" vi-put
1247"r" vi-change-char
1248"s" vi-subst
1249"t" vi-char-search
1250"u" vi-undo
1251"w" vi-next-word
1252"x" vi-delete
1253"y" vi-yank-to
1254"|" vi-column
1255"~" vi-change-case
1256.RE
1257.SH "SEE ALSO"
1258.PD 0
1259.TP
1260\fIThe Gnu Readline Library\fP, Brian Fox and Chet Ramey
1261.TP
1262\fIThe Gnu History Library\fP, Brian Fox and Chet Ramey
1263.TP
1264\fIbash\fP(1)
1265.PD
1266.SH FILES
1267.PD 0
1268.TP
1269.FN ~/.inputrc
1270Individual \fBreadline\fP initialization file
1271.PD
1272.SH AUTHORS
1273Brian Fox, Free Software Foundation
1274.br
1275bfox@gnu.org
1276.PP
1277Chet Ramey, Case Western Reserve University
1278.br
1279chet@ins.CWRU.Edu
1280.SH BUG REPORTS
1281If you find a bug in
1282.B readline,
1283you should report it. But first, you should
1284make sure that it really is a bug, and that it appears in the latest
1285version of the
1286.B readline
1287library that you have.
1288.PP
1289Once you have determined that a bug actually exists, mail a
1290bug report to \fIbug\-readline\fP@\fIgnu.org\fP.
1291If you have a fix, you are welcome to mail that
1292as well! Suggestions and `philosophical' bug reports may be mailed
1293to \fPbug-readline\fP@\fIgnu.org\fP or posted to the Usenet
1294newsgroup
1295.BR gnu.bash.bug .
1296.PP
1297Comments and bug reports concerning
1298this manual page should be directed to
1299.IR chet@ins.CWRU.Edu .
1300.SH BUGS
1301.PP
1302It's too big and too slow.