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