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-2011 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-display-width (-1)
190              The  number  of  screen columns used to display possible matches
191              when performing completion.  The value is ignored if it is  less
192              than  0 or greater than the terminal screen width.  A value of 0
193              will cause matches to be displayed one per  line.   The  default
194              value is -1.
195       completion-ignore-case (Off)
196              If set to On, readline performs filename matching and completion
197              in a case-insensitive fashion.
198       completion-map-case (Off)
199              If set to On, and completion-ignore-case  is  enabled,  readline
200              treats  hyphens  (-) and underscores (_) as equivalent when per‐
201              forming case-insensitive filename matching and completion.
202       completion-prefix-display-length (0)
203              The length in characters of the common prefix of a list of  pos‐
204              sible  completions that is displayed without modification.  When
205              set to a value greater than zero, common  prefixes  longer  than
206              this  value are replaced with an ellipsis when displaying possi‐
207              ble completions.
208       completion-query-items (100)
209              This determines when the user is queried about viewing the  num‐
210              ber  of  possible  completions generated by the possible-comple‐
211              tions command.  It may be set to any integer value greater  than
212              or  equal  to  zero.   If  the number of possible completions is
213              greater than or equal to the value of this variable, the user is
214              asked  whether or not he wishes to view them; otherwise they are
215              simply listed on the terminal.  A negative value causes readline
216              to never ask.
217       convert-meta (On)
218              If  set  to On, readline will convert characters with the eighth
219              bit set to an ASCII key sequence by stripping the eighth bit and
220              prefixing  it  with an escape character (in effect, using escape
221              as the meta prefix).
222       disable-completion (Off)
223              If set to On, readline will inhibit word completion.  Completion
224              characters  will  be  inserted into the line as if they had been
225              mapped to self-insert.
226       editing-mode (emacs)
227              Controls whether readline begins with a set of key bindings sim‐
228              ilar to Emacs or vi.  editing-mode can be set to either emacs or
229              vi.
230       echo-control-characters (On)
231              When set to On, on operating systems that indicate they  support
232              it, readline echoes a character corresponding to a signal gener‐
233              ated from the keyboard.
234       enable-keypad (Off)
235              When set to On, readline will try to enable the application key‐
236              pad  when  it  is  called.  Some systems need this to enable the
237              arrow keys.
238       enable-meta-key (On)
239              When set to On, readline will try to enable  any  meta  modifier
240              key  the  terminal claims to support when it is called.  On many
241              terminals, the meta key is used to send eight-bit characters.
242       expand-tilde (Off)
243              If set  to  On,  tilde  expansion  is  performed  when  readline
244              attempts word completion.
245       history-preserve-point (Off)
246              If  set  to  On, the history code attempts to place point at the
247              same location on each history line retrieved with  previous-his‐
248              tory or next-history.
249       history-size (0)
250              Set  the  maximum number of history entries saved in the history
251              list.  If set to zero, the number of entries in the history list
252              is not limited.
253       horizontal-scroll-mode (Off)
254              When  set  to  On, makes readline use a single line for display,
255              scrolling the input horizontally on a single screen line when it
256              becomes  longer  than the screen width rather than wrapping to a
257              new line.
258       input-meta (Off)
259              If set to On, readline will enable eight-bit input (that is,  it
260              will  not  clear  the  eighth  bit  in the characters it reads),
261              regardless of what the terminal claims it can support.  The name
262              meta-flag is a synonym for this variable.
263       isearch-terminators (``C-[ C-J'')
264              The  string  of  characters that should terminate an incremental
265              search without subsequently executing the character  as  a  com‐
266              mand.   If this variable has not been given a value, the charac‐
267              ters ESC and C-J will terminate an incremental search.
268       keymap (emacs)
269              Set the current readline keymap.  The set of legal keymap  names
270              is  emacs,  emacs-standard, emacs-meta, emacs-ctlx, vi, vi-move,
271              vi-command, and vi-insert.   vi  is  equivalent  to  vi-command;
272              emacs  is  equivalent  to  emacs-standard.  The default value is
273              emacs.  The value  of  editing-mode  also  affects  the  default
274              keymap.
275       mark-directories (On)
276              If set to On, completed directory names have a slash appended.
277       mark-modified-lines (Off)
278              If  set  to  On,  history lines that have been modified are dis‐
279              played with a preceding asterisk (*).
280       mark-symlinked-directories (Off)
281              If set to On, completed names which are symbolic links to direc‐
282              tories   have   a  slash  appended  (subject  to  the  value  of
283              mark-directories).
284       match-hidden-files (On)
285              This variable, when set to On, causes readline  to  match  files
286              whose  names  begin  with  a  `.' (hidden files) when performing
287              filename completion.  If set to Off, the  leading  `.'  must  be
288              supplied by the user in the filename to be completed.
289       menu-complete-display-prefix (Off)
290              If  set to On, menu completion displays the common prefix of the
291              list of possible completions (which may be empty) before cycling
292              through the list.
293       output-meta (Off)
294              If  set  to On, readline will display characters with the eighth
295              bit set directly rather than as a meta-prefixed escape sequence.
296       page-completions (On)
297              If set to On, readline uses an internal more-like pager to  dis‐
298              play a screenful of possible completions at a time.
299       print-completions-horizontally (Off)
300              If  set  to  On,  readline will display completions with matches
301              sorted horizontally in alphabetical order, rather than down  the
302              screen.
303       revert-all-at-newline (Off)
304              If  set  to  On, readline will undo all changes to history lines
305              before returning when accept-line is executed.  By default, his‐
306              tory  lines  may  be  modified  and retain individual undo lists
307              across calls to readline.
308       show-all-if-ambiguous (Off)
309              This alters the default behavior of  the  completion  functions.
310              If set to On, words which have more than one possible completion
311              cause the matches to be listed immediately  instead  of  ringing
312              the bell.
313       show-all-if-unmodified (Off)
314              This  alters the default behavior of the completion functions in
315              a fashion similar to show-all-if-ambiguous.  If set to On, words
316              which  have more than one possible completion without any possi‐
317              ble partial completion (the possible completions don't  share  a
318              common  prefix)  cause  the  matches  to  be  listed immediately
319              instead of ringing the bell.
320       skip-completed-text (Off)
321              If set to On, this alters the default completion  behavior  when
322              inserting  a  single match into the line.  It's only active when
323              performing completion in the middle  of  a  word.   If  enabled,
324              readline  does  not  insert  characters from the completion that
325              match characters after point in the  word  being  completed,  so
326              portions of the word following the cursor are not duplicated.
327       visible-stats (Off)
328              If  set to On, a character denoting a file's type as reported by
329              stat(2) is appended to the filename when listing  possible  com‐
330              pletions.
331
332   Conditional Constructs
333       Readline  implements  a  facility  similar in spirit to the conditional
334       compilation features of the C preprocessor which  allows  key  bindings
335       and  variable  settings  to be performed as the result of tests.  There
336       are four parser directives used.
337
338       $if    The $if construct allows bindings to be made based on the  edit‐
339              ing  mode,  the  terminal  being  used, or the application using
340              readline.  The text of the test extends to the end of the  line;
341              no characters are required to isolate it.
342
343              mode   The  mode=  form  of  the  $if  directive is used to test
344                     whether readline is in emacs or vi  mode.   This  may  be
345                     used  in  conjunction  with  the  set keymap command, for
346                     instance, to  set  bindings  in  the  emacs-standard  and
347                     emacs-ctlx  keymaps  only  if readline is starting out in
348                     emacs mode.
349
350              term   The term= form may be used to  include  terminal-specific
351                     key bindings, perhaps to bind the key sequences output by
352                     the terminal's function keys.  The word on the right side
353                     of  the = is tested against the full name of the terminal
354                     and the portion of the terminal name before the first  -.
355                     This  allows  sun  to  match  both  sun  and sun-cmd, for
356                     instance.
357
358              application
359                     The application construct is used to include application-
360                     specific  settings.   Each  program  using  the  readline
361                     library sets the application name, and an  initialization
362                     file can test for a particular value.  This could be used
363                     to bind key sequences to functions useful for a  specific
364                     program.   For instance, the following command adds a key
365                     sequence that quotes the  current  or  previous  word  in
366                     bash:
367
368                     $if Bash
369                     # Quote the current or previous word
370                     "\C-xq": "\eb\"\ef\""
371                     $endif
372
373       $endif This command, as seen in the previous example, terminates an $if
374              command.
375
376       $else  Commands in this branch of the $if directive are executed if the
377              test fails.
378
379       $include
380              This  directive takes a single filename as an argument and reads
381              commands and bindings from that file.  For example, the  follow‐
382              ing directive would read /etc/inputrc:
383
384              $include  /etc/inputrc
385

SEARCHING

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

EDITING COMMANDS

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

DEFAULT KEY BINDINGS

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

SEE ALSO

957       The Gnu Readline Library, Brian Fox and Chet Ramey
958       The Gnu History Library, Brian Fox and Chet Ramey
959       bash(1)
960

FILES

962       ~/.inputrc
963              Individual readline initialization file
964

AUTHORS

966       Brian Fox, Free Software Foundation
967       bfox@gnu.org
968
969       Chet Ramey, Case Western Reserve University
970       chet@ins.CWRU.Edu
971

BUG REPORTS

973       If you find a bug in readline, you should report it.   But  first,  you
974       should  make  sure  that it really is a bug, and that it appears in the
975       latest version of the readline library that you have.
976
977       Once you have determined that a bug actually exists, mail a bug  report
978       to  bug-readline@gnu.org.   If  you have a fix, you are welcome to mail
979       that as well!  Suggestions  and  `philosophical'  bug  reports  may  be
980       mailed  to  bug-readline@gnu.org  or  posted  to  the  Usenet newsgroup
981       gnu.bash.bug.
982
983       Comments and bug reports concerning this manual page should be directed
984       to chet@ins.CWRU.Edu.
985

BUGS

987       It's too big and too slow.
988
989
990
991GNU Readline 6.2                2010 August 28                     READLINE(3)
Impressum