1READLINE(3)                Library Functions Manual                READLINE(3)
2
3
4

NAME

6       readline - get a line from a user with editing
7

SYNOPSIS

9       #include <stdio.h>
10       #include <readline/readline.h>
11       #include <readline/history.h>
12
13       char *
14       readline (const char *prompt);
15
17       Readline is Copyright (C) 1989-2009 Free Software Foundation,  Inc.
18

DESCRIPTION

20       readline will read a line from the terminal and return it, using prompt
21       as a prompt.  If prompt is NULL or  the  empty  string,  no  prompt  is
22       issued.  The line returned is allocated with malloc(3); the caller must
23       free it when  finished.   The  line  returned  has  the  final  newline
24       removed, so only the text of the line remains.
25
26       readline  offers  editing  capabilities  while the user is entering the
27       line.  By default, the line editing commands are similar  to  those  of
28       emacs.  A vi-style line editing interface is also available.
29
30       This  manual  page describes only the most basic use of readline.  Much
31       more functionality is available; see The GNU Readline Library  and  The
32       GNU History Library for additional information.
33

RETURN VALUE

35       readline  returns  the text of the line read.  A blank line returns the
36       empty string.  If EOF is encountered while reading a line, and the line
37       is  empty,  NULL is returned.  If an EOF is read with a non-empty line,
38       it is treated as a newline.
39

NOTATION

41       An emacs-style notation is used to denote keystrokes.  Control keys are
42       denoted  by C-key, e.g., C-n means Control-N.  Similarly, meta keys are
43       denoted by M-key, so M-x means Meta-X.  (On keyboards  without  a  meta
44       key,  M-x means ESC x, i.e., press the Escape key then the x key.  This
45       makes ESC the meta prefix.  The combination M-C-x means  ESC-Control-x,
46       or  press the Escape key then hold the Control key while pressing the x
47       key.)
48
49       Readline commands may be given numeric arguments, which normally act as
50       a  repeat  count.   Sometimes,  however, it is the sign of the argument
51       that is significant.  Passing a negative argument  to  a  command  that
52       acts  in the forward direction (e.g., kill-line) causes that command to
53       act in a backward direction.  Commands whose  behavior  with  arguments
54       deviates from this are noted.
55
56       When  a command is described as killing text, the text deleted is saved
57       for possible future retrieval (yanking).  The killed text is saved in a
58       kill ring.  Consecutive kills cause the text to be accumulated into one
59       unit, which can be yanked all at once.  Commands which do not kill text
60       separate the chunks of text on the kill ring.
61

INITIALIZATION FILE

63       Readline  is  customized  by putting commands in an initialization file
64       (the inputrc file).  The name of this file is taken from the  value  of
65       the  INPUTRC  environment  variable.   If  that  variable is unset, the
66       default is ~/.inputrc.  If that file  does not exist or cannot be read,
67       the  ultimate  default  is /etc/inputrc.  When a program which uses the
68       readline library starts up, the init file is read, and the key bindings
69       and  variables  are set.  There are only a few basic constructs allowed
70       in the readline init file.  Blank lines are ignored.   Lines  beginning
71       with  a  # are comments.  Lines beginning with a $ indicate conditional
72       constructs.  Other lines denote key  bindings  and  variable  settings.
73       Each program using this library may add its own commands and bindings.
74
75       For example, placing
76
77              M-Control-u: universal-argument
78       or
79              C-Meta-u: universal-argument
80
81       into  the inputrc would make M-C-u execute the readline command univer‐
82       sal-argument.
83
84       The following symbolic character names are recognized while  processing
85       key  bindings:  DEL,  ESC,  ESCAPE,  LFD, NEWLINE, RET, RETURN, RUBOUT,
86       SPACE, SPC, and TAB.
87
88       In addition to command names, readline allows keys to  be  bound  to  a
89       string that is inserted when the key is pressed (a macro).
90
91   Key Bindings
92       The  syntax for controlling key bindings in the inputrc file is simple.
93       All that is required is the name of the command or the text of a  macro
94       and  a key sequence to which it should be bound. The name may be speci‐
95       fied in one of two ways: as a symbolic key name, possibly with Meta- or
96       Control- prefixes, or as a key sequence.  The name and key sequence are
97       separated by a colon.  There can be no whitespace between the name  and
98       the colon.
99
100       When using the form keyname:function-name or macro, keyname is the name
101       of a key spelled out in English.  For example:
102
103              Control-u: universal-argument
104              Meta-Rubout: backward-kill-word
105              Control-o: "> output"
106
107       In the above example, C-u is bound to the function  universal-argument,
108       M-DEL  is bound to the function backward-kill-word, and C-o is bound to
109       run the macro expressed on the right hand side (that is, to insert  the
110       text ``> output'' into the line).
111
112       In  the  second  form,  "keyseq":function-name or macro, keyseq differs
113       from keyname above in that strings denoting an entire key sequence  may
114       be  specified  by  placing the sequence within double quotes.  Some GNU
115       Emacs style key escapes can be used, as in the following  example,  but
116       the symbolic character names are not recognized.
117
118              "\C-u": universal-argument
119              "\C-x\C-r": re-read-init-file
120              "\e[11~": "Function Key 1"
121
122       In this example, C-u is again bound to the function universal-argument.
123       C-x C-r is bound to the function re-read-init-file, and ESC [ 1 1 ~  is
124       bound to insert the text ``Function Key 1''.
125
126       The  full set of GNU Emacs style escape sequences available when speci‐
127       fying key sequences is
128              \C-    control prefix
129              \M-    meta prefix
130              \e     an escape character
131              \\     backslash
132              \"     literal ", a double quote
133              \'     literal ', a single quote
134
135       In addition to the GNU Emacs style escape sequences, a  second  set  of
136       backslash escapes is available:
137              \a     alert (bell)
138              \b     backspace
139              \d     delete
140              \f     form feed
141              \n     newline
142              \r     carriage return
143              \t     horizontal tab
144              \v     vertical tab
145              \nnn   the  eight-bit  character  whose value is the octal value
146                     nnn (one to three digits)
147              \xHH   the eight-bit character whose value  is  the  hexadecimal
148                     value HH (one or two hex digits)
149
150       When  entering  the  text of a macro, single or double quotes should be
151       used to indicate a macro definition.  Unquoted text is assumed to be  a
152       function  name.   In  the  macro  body, the backslash escapes described
153       above are expanded.  Backslash will quote any other  character  in  the
154       macro text, including " and '.
155
156       Bash  allows the current readline key bindings to be displayed or modi‐
157       fied with the bind builtin command.  The editing mode may  be  switched
158       during  interactive  use by using the -o option to the set builtin com‐
159       mand.  Other programs using this library  provide  similar  mechanisms.
160       The  inputrc  file may be edited and re-read if a program does not pro‐
161       vide any other means to incorporate new bindings.
162
163   Variables
164       Readline has variables that can be used to further customize its behav‐
165       ior.  A variable may be set in the inputrc file with a statement of the
166       form
167
168              set variable-name value
169
170       Except where noted, readline variables can take the values  On  or  Off
171       (without  regard  to  case).   Unrecognized variable names are ignored.
172       When a variable value is read, empty or null values, "on"  (case-insen‐
173       sitive), and "1" are equivalent to On.  All other values are equivalent
174       to Off.  The variables and their default values are:
175
176       bell-style (audible)
177              Controls what happens when readline wants to ring  the  terminal
178              bell.  If set to none, readline never rings the bell.  If set to
179              visible, readline uses a visible bell if one is  available.   If
180              set to audible, readline attempts to ring the terminal's bell.
181       bind-tty-special-chars (On)
182              If  set  to On, readline attempts to bind the control characters
183              treated specially by the kernel's terminal driver to their read‐
184              line equivalents.
185       comment-begin (``#'')
186              The  string  that is inserted in vi mode when the insert-comment
187              command is executed.  This command is bound to M-# in emacs mode
188              and to # in vi command mode.
189       completion-ignore-case (Off)
190              If set to On, readline performs filename matching and completion
191              in a case-insensitive fashion.
192       completion-prefix-display-length (0)
193              The length in characters of the common prefix of a list of  pos‐
194              sible  completions that is displayed without modification.  When
195              set to a value greater than zero, common  prefixes  longer  than
196              this  value are replaced with an ellipsis when displaying possi‐
197              ble completions.
198       completion-query-items (100)
199              This determines when the user is queried about viewing the  num‐
200              ber  of  possible  completions generated by the possible-comple‐
201              tions command.  It may be set to any integer value greater  than
202              or  equal  to  zero.   If  the number of possible completions is
203              greater than or equal to the value of this variable, the user is
204              asked  whether or not he wishes to view them; otherwise they are
205              simply listed on the terminal.  A negative value causes readline
206              to never ask.
207       convert-meta (On)
208              If  set  to On, readline will convert characters with the eighth
209              bit set to an ASCII key sequence by stripping the eighth bit and
210              prefixing  it  with an escape character (in effect, using escape
211              as the meta prefix).
212       disable-completion (Off)
213              If set to On, readline will inhibit word completion.  Completion
214              characters  will  be  inserted into the line as if they had been
215              mapped to self-insert.
216       editing-mode (emacs)
217              Controls whether readline begins with a set of key bindings sim‐
218              ilar to emacs or vi.  editing-mode can be set to either emacs or
219              vi.
220       echo-control-characters (On)
221              When set to On, on operating systems that indicate they  support
222              it, readline echoes a character corresponding to a signal gener‐
223              ated from the keyboard.
224       enable-keypad (Off)
225              When set to On, readline will try to enable the application key‐
226              pad  when  it  is  called.  Some systems need this to enable the
227              arrow keys.
228       enable-meta-key (On)
229              When set to On, readline will try to enable  any  meta  modifier
230              key  the  terminal claims to support when it is called.  On many
231              terminals, the meta key is used to send eight-bit characters.
232       expand-tilde (Off)
233              If set  to  on,  tilde  expansion  is  performed  when  readline
234              attempts word completion.
235       history-preserve-point (Off)
236              If  set  to  on, the history code attempts to place point at the
237              same location on each history line retrieved with  previous-his‐
238              tory or next-history.
239       history-size (0)
240              Set  the  maximum number of history entries saved in the history
241              list.  If set to zero, the number of entries in the history list
242              is not limited.
243       horizontal-scroll-mode (Off)
244              When  set  to  On, makes readline use a single line for display,
245              scrolling the input horizontally on a single screen line when it
246              becomes  longer  than the screen width rather than wrapping to a
247              new line.
248       input-meta (Off)
249              If set to On, readline will enable eight-bit input (that is,  it
250              will  not  clear  the  eighth  bit  in the characters it reads),
251              regardless of what the terminal claims it can support.  The name
252              meta-flag is a synonym for this variable.
253       isearch-terminators (``C-[ C-J'')
254              The  string  of  characters that should terminate an incremental
255              search without subsequently executing the character  as  a  com‐
256              mand.   If this variable has not been given a value, the charac‐
257              ters ESC and C-J will terminate an incremental search.
258       keymap (emacs)
259              Set the current readline keymap.  The set of legal keymap  names
260              is  emacs,  emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move,
261              vi-command, and vi-insert.   vi  is  equivalent  to  vi-command;
262              emacs  is  equivalent  to  emacs-standard.  The default value is
263              emacs.  The value  of  editing-mode  also  affects  the  default
264              keymap.
265       mark-directories (On)
266              If set to On, completed directory names have a slash appended.
267       mark-modified-lines (Off)
268              If  set  to  On,  history lines that have been modified are dis‐
269              played with a preceding asterisk (*).
270       mark-symlinked-directories (Off)
271              If set to On, completed names which are symbolic links to direc‐
272              tories   have   a  slash  appended  (subject  to  the  value  of
273              mark-directories).
274       match-hidden-files (On)
275              This variable, when set to On, causes readline  to  match  files
276              whose  names  begin  with  a  `.' (hidden files) when performing
277              filename completion, unless the leading `.' is supplied  by  the
278              user in the filename to be completed.
279       output-meta (Off)
280              If  set  to On, readline will display characters with the eighth
281              bit set directly rather than as a meta-prefixed escape sequence.
282       page-completions (On)
283              If set to On, readline uses an internal more-like pager to  dis‐
284              play a screenful of possible completions at a time.
285       print-completions-horizontally (Off)
286              If  set  to  On,  readline will display completions with matches
287              sorted horizontally in alphabetical order, rather than down  the
288              screen.
289       revert-all-at-newline (Off)
290              If  set  to  on, readline will undo all changes to history lines
291              before returning when accept-line is executed.  By default, his‐
292              tory  lines  may  be  modified  and retain individual undo lists
293              across calls to readline.
294       show-all-if-ambiguous (Off)
295              This alters the default behavior of  the  completion  functions.
296              If set to on, words which have more than one possible completion
297              cause the matches to be listed immediately  instead  of  ringing
298              the bell.
299       show-all-if-unmodified (Off)
300              This  alters the default behavior of the completion functions in
301              a fashion similar to show-all-if-ambiguous.  If set to on, words
302              which  have more than one possible completion without any possi‐
303              ble partial completion (the possible completions don't  share  a
304              common  prefix)  cause  the  matches  to  be  listed immediately
305              instead of ringing the bell.
306       skip-completed-text (Off)
307              If set to On, this alters the default completion  behavior  when
308              inserting  a  single match into the line.  It's only active when
309              performing completion in the middle  of  a  word.   If  enabled,
310              readline  does  not  insert  characters from the completion that
311              match characters after point in the  word  being  completed,  so
312              portions of the word following the cursor are not duplicated.
313       visible-stats (Off)
314              If  set to On, a character denoting a file's type as reported by
315              stat(2) is appended to the filename when listing  possible  com‐
316              pletions.
317
318   Conditional Constructs
319       Readline  implements  a  facility  similar in spirit to the conditional
320       compilation features of the C preprocessor which  allows  key  bindings
321       and  variable  settings  to be performed as the result of tests.  There
322       are four parser directives used.
323
324       $if    The $if construct allows bindings to be made based on the  edit‐
325              ing  mode,  the  terminal  being  used, or the application using
326              readline.  The text of the test extends to the end of the  line;
327              no characters are required to isolate it.
328
329              mode   The  mode=  form  of  the  $if  directive is used to test
330                     whether readline is in emacs or vi  mode.   This  may  be
331                     used  in  conjunction  with  the  set keymap command, for
332                     instance, to  set  bindings  in  the  emacs-standard  and
333                     emacs-ctlx  keymaps  only  if readline is starting out in
334                     emacs mode.
335
336              term   The term= form may be used to  include  terminal-specific
337                     key bindings, perhaps to bind the key sequences output by
338                     the terminal's function keys.  The word on the right side
339                     of  the = is tested against the full name of the terminal
340                     and the portion of the terminal name before the first  -.
341                     This  allows  sun  to  match  both  sun  and sun-cmd, for
342                     instance.
343
344              application
345                     The application construct is used to include application-
346                     specific  settings.   Each  program  using  the  readline
347                     library sets the application name, and an  initialization
348                     file can test for a particular value.  This could be used
349                     to bind key sequences to functions useful for a  specific
350                     program.   For instance, the following command adds a key
351                     sequence that quotes the  current  or  previous  word  in
352                     Bash:
353
354                     $if Bash
355                     # Quote the current or previous word
356                     "\C-xq": "\eb\"\ef\""
357                     $endif
358
359       $endif This command, as seen in the previous example, terminates an $if
360              command.
361
362       $else  Commands in this branch of the $if directive are executed if the
363              test fails.
364
365       $include
366              This  directive takes a single filename as an argument and reads
367              commands and bindings from that file.  For example, the  follow‐
368              ing directive would read /etc/inputrc:
369
370              $include  /etc/inputrc
371

SEARCHING

373       Readline  provides  commands  for searching through the command history
374       for lines containing a specified string.  There are two  search  modes:
375       incremental and non-incremental.
376
377       Incremental  searches  begin  before  the  user has finished typing the
378       search string.  As each character of the search string is typed,  read‐
379       line displays the next entry from the history matching the string typed
380       so far.  An incremental search requires  only  as  many  characters  as
381       needed  to  find  the desired history entry.  To search backward in the
382       history for a particular string, type C-r.  Typing C-s searches forward
383       through  the  history.   The  characters  present  in  the value of the
384       isearch-terminators variable  are  used  to  terminate  an  incremental
385       search.   If that variable has not been assigned a value the Escape and
386       C-J characters will terminate an incremental search.  C-G will abort an
387       incremental  search  and restore the original line.  When the search is
388       terminated, the history entry containing the search string becomes  the
389       current line.
390
391       To  find other matching entries in the history list, type C-s or C-r as
392       appropriate.  This will search backward or forward in the  history  for
393       the  next  line matching the search string typed so far.  Any other key
394       sequence bound to a readline command will terminate the search and exe‐
395       cute  that  command.  For instance, a newline will terminate the search
396       and accept the line, thereby executing the  command  from  the  history
397       list.  A movement command will terminate the search, make the last line
398       found the current line, and begin editing.
399
400       Non-incremental searches read the entire search string before  starting
401       to  search  for matching history lines.  The search string may be typed
402       by the user or be part of the contents of the current line.
403

EDITING COMMANDS

405       The following is a list of the names of the commands  and  the  default
406       key sequences to which they are bound.  Command names without an accom‐
407       panying key sequence are unbound by default.
408
409       In the following descriptions, point refers to the current cursor posi‐
410       tion,  and  mark refers to a cursor position saved by the set-mark com‐
411       mand.  The text between the point  and  mark  is  referred  to  as  the
412       region.
413
414   Commands for Moving
415       beginning-of-line (C-a)
416              Move to the start of the current line.
417       end-of-line (C-e)
418              Move to the end of the line.
419       forward-char (C-f)
420              Move forward a character.
421       backward-char (C-b)
422              Move back a character.
423       forward-word (M-f)
424              Move forward to the end of the next word.  Words are composed of
425              alphanumeric characters (letters and digits).
426       backward-word (M-b)
427              Move back to the start of the current or previous  word.   Words
428              are composed of alphanumeric characters (letters and digits).
429       clear-screen (C-l)
430              Clear  the  screen  leaving  the  current line at the top of the
431              screen.  With an argument,  refresh  the  current  line  without
432              clearing the screen.
433       redraw-current-line
434              Refresh the current line.
435
436   Commands for Manipulating the History
437       accept-line (Newline, Return)
438              Accept the line regardless of where the cursor is.  If this line
439              is non-empty, it may be added to the  history  list  for  future
440              recall  with  add_history().   If the line is a modified history
441              line, the history line is restored to its original state.
442       previous-history (C-p)
443              Fetch the previous command from the history list, moving back in
444              the list.
445       next-history (C-n)
446              Fetch  the next command from the history list, moving forward in
447              the list.
448       beginning-of-history (M-<)
449              Move to the first line in the history.
450       end-of-history (M->)
451              Move to the end of the input history, i.e., the  line  currently
452              being entered.
453       reverse-search-history (C-r)
454              Search  backward  starting  at  the current line and moving `up'
455              through the  history  as  necessary.   This  is  an  incremental
456              search.
457       forward-search-history (C-s)
458              Search  forward  starting  at the current line and moving `down'
459              through the  history  as  necessary.   This  is  an  incremental
460              search.
461       non-incremental-reverse-search-history (M-p)
462              Search backward through the history starting at the current line
463              using a non-incremental search for  a  string  supplied  by  the
464              user.
465       non-incremental-forward-search-history (M-n)
466              Search  forward  through  the  history  using  a non-incremental
467              search for a string supplied by the user.
468       history-search-forward
469              Search forward through the history for the string of  characters
470              between  the  start  of  the current line and the current cursor
471              position (the point).  This is a non-incremental search.
472       history-search-backward
473              Search backward through the history for the string of characters
474              between  the start of the current line and the point.  This is a
475              non-incremental search.
476       yank-nth-arg (M-C-y)
477              Insert the first argument to the previous command  (usually  the
478              second word on the previous line) at point.  With an argument n,
479              insert the nth word from the previous command (the words in  the
480              previous  command  begin  with  word  0).   A  negative argument
481              inserts the nth word from the end of the previous command.  Once
482              the  argument n is computed, the argument is extracted as if the
483              "!n" history expansion had been specified.
484       yank-last-arg (M-., M-_)
485              Insert the last argument to the previous command (the last  word
486              of  the  previous  history  entry).   With  an  argument, behave
487              exactly like yank-nth-arg.  Successive  calls  to  yank-last-arg
488              move  back through the history list, inserting the last argument
489              of each line in turn.  The history expansion facilities are used
490              to  extract  the last argument, as if the "!$" history expansion
491              had been specified.
492
493   Commands for Changing Text
494       delete-char (C-d)
495              Delete the character at point.  If point is at the beginning  of
496              the  line,  there  are  no  characters in the line, and the last
497              character typed was not bound to delete-char, then return EOF.
498       backward-delete-char (Rubout)
499              Delete the character behind the cursor.  When  given  a  numeric
500              argument, save the deleted text on the kill ring.
501       forward-backward-delete-char
502              Delete  the  character under the cursor, unless the cursor is at
503              the end of the line, in which case the character behind the cur‐
504              sor is deleted.
505       quoted-insert (C-q, C-v)
506              Add the next character that you type to the line verbatim.  This
507              is how to insert characters like C-q, for example.
508       tab-insert (M-TAB)
509              Insert a tab character.
510       self-insert (a, b, A, 1, !, ...)
511              Insert the character typed.
512       transpose-chars (C-t)
513              Drag the character before point forward over  the  character  at
514              point,  moving point forward as well.  If point is at the end of
515              the line, then this transposes the two characters before  point.
516              Negative arguments have no effect.
517       transpose-words (M-t)
518              Drag  the  word  before  point past the word after point, moving
519              point over that word as well.  If point is at  the  end  of  the
520              line, this transposes the last two words on the line.
521       upcase-word (M-u)
522              Uppercase  the  current  (or  following)  word.  With a negative
523              argument, uppercase the previous word, but do not move point.
524       downcase-word (M-l)
525              Lowercase the current (or  following)  word.   With  a  negative
526              argument, lowercase the previous word, but do not move point.
527       capitalize-word (M-c)
528              Capitalize  the  current  (or  following) word.  With a negative
529              argument, capitalize the previous word, but do not move point.
530       overwrite-mode
531              Toggle overwrite mode.  With an explicit positive numeric  argu‐
532              ment, switches to overwrite mode.  With an explicit non-positive
533              numeric argument, switches to insert mode.  This command affects
534              only  emacs mode; vi mode does overwrite differently.  Each call
535              to readline() starts in insert mode.  In overwrite mode, charac‐
536              ters  bound to self-insert replace the text at point rather than
537              pushing the text  to  the  right.   Characters  bound  to  back‐
538              ward-delete-char  replace  the  character  before  point  with a
539              space.  By default, this command is unbound.
540
541   Killing and Yanking
542       kill-line (C-k)
543              Kill the text from point to the end of the line.
544       backward-kill-line (C-x Rubout)
545              Kill backward to the beginning of the line.
546       unix-line-discard (C-u)
547              Kill backward from point to the  beginning  of  the  line.   The
548              killed text is saved on the kill-ring.
549       kill-whole-line
550              Kill  all  characters on the current line, no matter where point
551              is.
552       kill-word (M-d)
553              Kill from point the end of  the  current  word,  or  if  between
554              words,  to  the  end  of the next word.  Word boundaries are the
555              same as those used by forward-word.
556       backward-kill-word (M-Rubout)
557              Kill the word behind point.  Word boundaries  are  the  same  as
558              those used by backward-word.
559       unix-word-rubout (C-w)
560              Kill  the  word behind point, using white space as a word bound‐
561              ary.  The killed text is saved on the kill-ring.
562       unix-filename-rubout
563              Kill the word behind point, using  white  space  and  the  slash
564              character  as  the word boundaries.  The killed text is saved on
565              the kill-ring.
566       delete-horizontal-space (M-\)
567              Delete all spaces and tabs around point.
568       kill-region
569              Kill the text between the point and  mark  (saved  cursor  posi‐
570              tion).  This text is referred to as the region.
571       copy-region-as-kill
572              Copy the text in the region to the kill buffer.
573       copy-backward-word
574              Copy  the word before point to the kill buffer.  The word bound‐
575              aries are the same as backward-word.
576       copy-forward-word
577              Copy the word following point to  the  kill  buffer.   The  word
578              boundaries are the same as forward-word.
579       yank (C-y)
580              Yank the top of the kill ring into the buffer at point.
581       yank-pop (M-y)
582              Rotate  the kill ring, and yank the new top.  Only works follow‐
583              ing yank or yank-pop.
584
585   Numeric Arguments
586       digit-argument (M-0, M-1, ..., M--)
587              Add this digit to the argument already accumulating, or start  a
588              new argument.  M-- starts a negative argument.
589       universal-argument
590              This  is another way to specify an argument.  If this command is
591              followed by one or more digits, optionally with a leading  minus
592              sign,  those digits define the argument.  If the command is fol‐
593              lowed by digits, executing  universal-argument  again  ends  the
594              numeric  argument, but is otherwise ignored.  As a special case,
595              if this command is immediately followed by a character  that  is
596              neither  a  digit or minus sign, the argument count for the next
597              command is multiplied by four.  The argument count is  initially
598              one,  so  executing this function the first time makes the argu‐
599              ment count four, a second time makes the argument count sixteen,
600              and so on.
601
602   Completing
603       complete (TAB)
604              Attempt  to  perform  completion  on the text before point.  The
605              actual completion performed is application-specific.  Bash,  for
606              instance,  attempts  completion  treating the text as a variable
607              (if the text begins with $), username (if the text  begins  with
608              ~),  hostname (if the text begins with @), or command (including
609              aliases and functions) in turn.  If none  of  these  produces  a
610              match,  filename  completion  is  attempted.   Gdb, on the other
611              hand, allows completion of program functions and variables,  and
612              only attempts filename completion under certain circumstances.
613       possible-completions (M-?)
614              List the possible completions of the text before point.
615       insert-completions (M-*)
616              Insert  all completions of the text before point that would have
617              been generated by possible-completions.
618       menu-complete
619              Similar to complete, but replaces the word to be completed  with
620              a  single match from the list of possible completions.  Repeated
621              execution of menu-complete steps through the  list  of  possible
622              completions,  inserting  each  match in turn.  At the end of the
623              list of completions, the bell is rung (subject to the setting of
624              bell-style) and the original text is restored.  An argument of n
625              moves n positions forward in the list  of  matches;  a  negative
626              argument  may  be  used to move backward through the list.  This
627              command is intended to be  bound  to  TAB,  but  is  unbound  by
628              default.c
629       menu-complete-krd
630              Identicwal  to menu-complete, but moves backward through the list
631              of possible completions, as if menu-complete had  been  given  a
632              negative argument.  This command is unbound by default.
633       delete-char-or-list
634              Deletes  the  character under the cursor if not at the beginning
635              or end of the line (like delete-char).  If at  the  end  of  the
636              line, behaves identically to possible-completions.
637
638   Keyboard Macros
639       start-kbd-macro (C-x ()
640              Begin  saving  the  characters  typed  into the current keyboard
641              macro.
642       end-kbd-macro (C-x ))
643              Stop saving the characters typed into the current keyboard macro
644              and store the definition.
645       call-last-kbd-macro (C-x e)
646              Re-execute  the last keyboard macro defined, by making the char‐
647              acters in the macro appear as if typed at the keyboard.
648
649   Miscellaneous
650       re-read-init-file (C-x C-r)
651              Read in the contents of the inputrc file,  and  incorporate  any
652              bindings or variable assignments found there.
653       abort (C-g)
654              Abort  the  current editing command and ring the terminal's bell
655              (subject to the setting of bell-style).
656       do-uppercase-version (M-a, M-b, M-x, ...)
657              If the metafied character x is lowercase, run the  command  that
658              is bound to the corresponding uppercase character.
659       prefix-meta (ESC)
660              Metafy the next character typed.  ESC f is equivalent to Meta-f.
661       undo (C-_, C-x C-u)
662              Incremental undo, separately remembered for each line.
663       revert-line (M-r)
664              Undo  all changes made to this line.  This is like executing the
665              undo command enough times to return  the  line  to  its  initial
666              state.
667       tilde-expand (M-&)
668              Perform tilde expansion on the current word.
669       set-mark (C-@, M-<space>)
670              Set  the  mark to the point.  If a numeric argument is supplied,
671              the mark is set to that position.
672       exchange-point-and-mark (C-x C-x)
673              Swap the point with the mark.  The current  cursor  position  is
674              set  to the saved position, and the old cursor position is saved
675              as the mark.
676       character-search (C-])
677              A character is read and point is moved to the next occurrence of
678              that  character.   A negative count searches for previous occur‐
679              rences.
680       character-search-backward (M-C-])
681              A character is read and point is moved to  the  previous  occur‐
682              rence  of  that character.  A negative count searches for subse‐
683              quent occurrences.
684       skip-csi-sequence ()
685              Read enough characters to consume a multi-key sequence  such  as
686              those  defined for keys like Home and End.  Such sequences begin
687              with a Control Sequence Indicator (CSI), usually ESC-[.  If this
688              sequence  is  bound  to "\[", keys producing such sequences will
689              have no effect unless explicitly bound to  a  readline  command,
690              instead  of  inserting stray characters into the editing buffer.
691              This is unbound by default, but usually bound to ESC-[.
692       insert-comment (M-#)
693              Without a numeric argument,  the  value  of  the  readline  com‐
694              ment-begin  variable is inserted at the beginning of the current
695              line.  If a numeric argument is supplied, this command acts as a
696              toggle:   if  the characters at the beginning of the line do not
697              match the value of comment-begin, the value is inserted,  other‐
698              wise the characters in comment-begin are deleted from the begin‐
699              ning of the line.  In either case, the line is accepted as if  a
700              newline  had  been  typed.   The  default value of comment-begin
701              makes the current line a shell comment.  If a  numeric  argument
702              causes  the  comment  character  to be removed, the line will be
703              executed by the shell.
704       dump-functions
705              Print all of the functions and their key bindings to  the  read‐
706              line output stream.  If a numeric argument is supplied, the out‐
707              put is formatted in such a way that it can be made  part  of  an
708              inputrc file.
709       dump-variables
710              Print  all  of  the  settable  variables and their values to the
711              readline output stream.  If a numeric argument is supplied,  the
712              output is formatted in such a way that it can be made part of an
713              inputrc file.
714       dump-macros
715              Print all of the readline key sequences bound to macros and  the
716              strings  they  output.   If  a numeric argument is supplied, the
717              output is formatted in such a way that it can be made part of an
718              inputrc file.
719       emacs-editing-mode (C-e)
720              When  in  vi command mode, this causes a switch to emacs editing
721              mode.
722       vi-editing-mode (M-C-j)
723              When in emacs editing mode, this causes a switch to  vi  editing
724              mode.
725

DEFAULT KEY BINDINGS

727       The  following is a list of the default emacs and vi bindings.  Charac‐
728       ters with the eighth bit set are  written  as  M-<character>,  and  are
729       referred to as metafied characters.  The printable ASCII characters not
730       mentioned in the list of emacs  standard  bindings  are  bound  to  the
731       self-insert  function,  which just inserts the given character into the
732       input line.  In vi insertion mode, all characters not specifically men‐
733       tioned are bound to self-insert.  Characters assigned to signal genera‐
734       tion by stty(1) or the terminal driver, such as C-Z or C-C, retain that
735       function.   Upper  and  lower case metafied characters are bound to the
736       same function in the emacs mode meta keymap.  The remaining  characters
737       are  unbound,  which  causes  readline to ring the bell (subject to the
738       setting of the bell-style variable).
739
740   Emacs Mode
741             Emacs Standard bindings
742
743             "C-@"  set-mark
744             "C-A"  beginning-of-line
745             "C-B"  backward-char
746             "C-D"  delete-char
747             "C-E"  end-of-line
748             "C-F"  forward-char
749             "C-G"  abort
750             "C-H"  backward-delete-char
751             "C-I"  complete
752             "C-J"  accept-line
753             "C-K"  kill-line
754             "C-L"  clear-screen
755             "C-M"  accept-line
756             "C-N"  next-history
757             "C-P"  previous-history
758             "C-Q"  quoted-insert
759             "C-R"  reverse-search-history
760             "C-S"  forward-search-history
761             "C-T"  transpose-chars
762             "C-U"  unix-line-discard
763             "C-V"  quoted-insert
764             "C-W"  unix-word-rubout
765             "C-Y"  yank
766             "C-]"  character-search
767             "C-_"  undo
768             " " to "/"  self-insert
769             "0"  to "9"  self-insert
770             ":"  to "~"  self-insert
771             "C-?"  backward-delete-char
772
773             Emacs Meta bindings
774
775             "M-C-G"  abort
776             "M-C-H"  backward-kill-word
777             "M-C-I"  tab-insert
778             "M-C-J"  vi-editing-mode
779             "M-C-M"  vi-editing-mode
780             "M-C-R"  revert-line
781             "M-C-Y"  yank-nth-arg
782             "M-C-["  complete
783             "M-C-]"  character-search-backward
784             "M-space"  set-mark
785             "M-#"  insert-comment
786             "M-&"  tilde-expand
787             "M-*"  insert-completions
788             "M--"  digit-argument
789             "M-."  yank-last-arg
790             "M-0"  digit-argument
791             "M-1"  digit-argument
792             "M-2"  digit-argument
793             "M-3"  digit-argument
794             "M-4"  digit-argument
795             "M-5"  digit-argument
796             "M-6"  digit-argument
797             "M-7"  digit-argument
798             "M-8"  digit-argument
799             "M-9"  digit-argument
800             "M-<"  beginning-of-history
801             "M-="  possible-completions
802             "M->"  end-of-history
803             "M-?"  possible-completions
804             "M-B"  backward-word
805             "M-C"  capitalize-word
806             "M-D"  kill-word
807             "M-F"  forward-word
808             "M-L"  downcase-word
809             "M-N"  non-incremental-forward-search-history
810             "M-P"  non-incremental-reverse-search-history
811             "M-R"  revert-line
812             "M-T"  transpose-words
813             "M-U"  upcase-word
814             "M-Y"  yank-pop
815             "M-\"  delete-horizontal-space
816             "M-~"  tilde-expand
817             "M-C-?"  backward-kill-word
818             "M-_"  yank-last-arg
819
820             Emacs Control-X bindings
821
822             "C-XC-G"  abort
823             "C-XC-R"  re-read-init-file
824             "C-XC-U"  undo
825             "C-XC-X"  exchange-point-and-mark
826             "C-X("  start-kbd-macro
827             "C-X)"  end-kbd-macro
828             "C-XE"  call-last-kbd-macro
829             "C-XC-?"  backward-kill-line
830
831
832   VI Mode bindings
833             VI Insert Mode functions
834
835             "C-D"  vi-eof-maybe
836             "C-H"  backward-delete-char
837             "C-I"  complete
838             "C-J"  accept-line
839             "C-M"  accept-line
840             "C-R"  reverse-search-history
841             "C-S"  forward-search-history
842             "C-T"  transpose-chars
843             "C-U"  unix-line-discard
844             "C-V"  quoted-insert
845             "C-W"  unix-word-rubout
846             "C-Y"  yank
847             "C-["  vi-movement-mode
848             "C-_"  undo
849             " " to "~"  self-insert
850             "C-?"  backward-delete-char
851
852             VI Command Mode functions
853
854             "C-D"  vi-eof-maybe
855             "C-E"  emacs-editing-mode
856             "C-G"  abort
857             "C-H"  backward-char
858             "C-J"  accept-line
859             "C-K"  kill-line
860             "C-L"  clear-screen
861             "C-M"  accept-line
862             "C-N"  next-history
863             "C-P"  previous-history
864             "C-Q"  quoted-insert
865             "C-R"  reverse-search-history
866             "C-S"  forward-search-history
867             "C-T"  transpose-chars
868             "C-U"  unix-line-discard
869             "C-V"  quoted-insert
870             "C-W"  unix-word-rubout
871             "C-Y"  yank
872             "C-_"  vi-undo
873             " "  forward-char
874             "#"  insert-comment
875             "$"  end-of-line
876             "%"  vi-match
877             "&"  vi-tilde-expand
878             "*"  vi-complete
879             "+"  next-history
880             ","  vi-char-search
881             "-"  previous-history
882             "."  vi-redo
883             "/"  vi-search
884             "0"  beginning-of-line
885             "1" to "9"  vi-arg-digit
886             ";"  vi-char-search
887             "="  vi-complete
888             "?"  vi-search
889             "A"  vi-append-eol
890             "B"  vi-prev-word
891             "C"  vi-change-to
892             "D"  vi-delete-to
893             "E"  vi-end-word
894             "F"  vi-char-search
895             "G"  vi-fetch-history
896             "I"  vi-insert-beg
897             "N"  vi-search-again
898             "P"  vi-put
899             "R"  vi-replace
900             "S"  vi-subst
901             "T"  vi-char-search
902             "U"  revert-line
903             "W"  vi-next-word
904             "X"  backward-delete-char
905             "Y"  vi-yank-to
906             "\"  vi-complete
907             "^"  vi-first-print
908             "_"  vi-yank-arg
909             "`"  vi-goto-mark
910             "a"  vi-append-mode
911             "b"  vi-prev-word
912             "c"  vi-change-to
913             "d"  vi-delete-to
914             "e"  vi-end-word
915             "f"  vi-char-search
916             "h"  backward-char
917             "i"  vi-insertion-mode
918             "j"  next-history
919             "k"  prev-history
920             "l"  forward-char
921             "m"  vi-set-mark
922             "n"  vi-search-again
923             "p"  vi-put
924             "r"  vi-change-char
925             "s"  vi-subst
926             "t"  vi-char-search
927             "u"  vi-undo
928             "w"  vi-next-word
929             "x"  vi-delete
930             "y"  vi-yank-to
931             "|"  vi-column
932             "~"  vi-change-case
933

SEE ALSO

935       The Gnu Readline Library, Brian Fox and Chet Ramey
936       The Gnu History Library, Brian Fox and Chet Ramey
937       bash(1)
938

FILES

940       ~/.inputrc
941              Individual readline initialization file
942

AUTHORS

944       Brian Fox, Free Software Foundation
945       bfox@gnu.org
946
947       Chet Ramey, Case Western Reserve University
948       chet@ins.CWRU.Edu
949

BUG REPORTS

951       If you find a bug in readline, you should report it.   But  first,  you
952       should  make  sure  that it really is a bug, and that it appears in the
953       latest version of the readline library that you have.
954
955       Once you have determined that a bug actually exists, mail a bug  report
956       to  bug-readline@gnu.org.   If  you have a fix, you are welcome to mail
957       that as well!  Suggestions  and  `philosophical'  bug  reports  may  be
958       mailed  to  bug-readline@gnu.org  or  posted  to  the  Usenet newsgroup
959       gnu.bash.bug.
960
961       Comments and bug reports concerning this manual page should be directed
962       to chet@ins.CWRU.Edu.
963

BUGS

965       It's too big and too slow.
966
967
968
969GNU Readline 6.1                2009 October 9                     READLINE(3)
Impressum