home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / AP / TERMNET / READLINE.0 / DOC / RLUSER.TEX < prev    next >
Encoding:
Text File  |  1995-04-20  |  29.9 KB  |  876 lines

  1. @comment %**start of header (This is for running Texinfo on a region.)
  2. @setfilename rluser.info
  3. @comment %**end of header (This is for running Texinfo on a region.)
  4. @setchapternewpage odd
  5.  
  6. @ignore
  7. This file documents the end user interface to the GNU command line
  8. editing features.  It is to be an appendix to manuals for programs which
  9. use these features.  There is a document entitled "readline.texinfo"
  10. which contains both end-user and programmer documentation for the GNU
  11. Readline Library.
  12.  
  13. Copyright (C) 1988 Free Software Foundation, Inc.
  14.  
  15. Authored by Brian Fox and Chet Ramey.
  16.  
  17. Permission is granted to process this file through Tex and print the
  18. results, provided the printed document carries copying permission notice
  19. identical to this one except for the removal of this paragraph (this
  20. paragraph not being relevant to the printed manual).
  21.  
  22. Permission is granted to make and distribute verbatim copies of this manual
  23. provided the copyright notice and this permission notice are preserved on
  24. all copies.
  25.  
  26. Permission is granted to copy and distribute modified versions of this
  27. manual under the conditions for verbatim copying, provided also that the
  28. GNU Copyright statement is available to the distributee, and provided that
  29. the entire resulting derived work is distributed under the terms of a
  30. permission notice identical to this one.
  31.  
  32. Permission is granted to copy and distribute translations of this manual
  33. into another language, under the above conditions for modified versions.
  34. @end ignore
  35.  
  36. @comment If you are including this manual as an appendix, then set the
  37. @comment variable readline-appendix.
  38.  
  39. @node Command Line Editing
  40. @chapter Command Line Editing
  41.  
  42. This chapter describes the basic features of the GNU
  43. command line editing interface.
  44.  
  45. @menu
  46. * Introduction and Notation::    Notation used in this text.
  47. * Readline Interaction::    The minimum set of commands for editing a line.
  48. * Readline Init File::        Customizing Readline from a user's view.
  49. * Bindable Readline Commands::    A description of most of the Readline commands
  50.                 available for binding
  51. * Readline vi Mode::        A short description of how to make Readline
  52.                 behave like the vi editor.
  53. @end menu
  54.  
  55. @node Introduction and Notation
  56. @section Introduction to Line Editing
  57.  
  58. The following paragraphs describe the notation used to represent
  59. keystrokes.
  60.  
  61. The text @key{C-k} is read as `Control-K' and describes the character
  62. produced when the Control key is depressed and the @key{k} key is struck.
  63.  
  64. The text @key{M-k} is read as `Meta-K' and describes the character
  65. produced when the meta key (if you have one) is depressed, and the @key{k}
  66. key is struck.  If you do not have a meta key, the identical keystroke
  67. can be generated by typing @key{ESC} @i{first}, and then typing @key{k}.
  68. Either process is known as @dfn{metafying} the @key{k} key.
  69.  
  70. The text @key{M-C-k} is read as `Meta-Control-k' and describes the
  71. character produced by @dfn{metafying} @key{C-k}.
  72.  
  73. In addition, several keys have their own names.  Specifically,
  74. @key{DEL}, @key{ESC}, @key{LFD}, @key{SPC}, @key{RET}, and @key{TAB} all
  75. stand for themselves when seen in this text, or in an init file
  76. (@pxref{Readline Init File}, for more info).
  77.  
  78. @node Readline Interaction
  79. @section Readline Interaction
  80. @cindex interaction, readline
  81.  
  82. Often during an interactive session you type in a long line of text,
  83. only to notice that the first word on the line is misspelled.  The
  84. Readline library gives you a set of commands for manipulating the text
  85. as you type it in, allowing you to just fix your typo, and not forcing
  86. you to retype the majority of the line.  Using these editing commands,
  87. you move the cursor to the place that needs correction, and delete or
  88. insert the text of the corrections.  Then, when you are satisfied with
  89. the line, you simply press @key{RETURN}.  You do not have to be at the
  90. end of the line to press @key{RETURN}; the entire line is accepted
  91. regardless of the location of the cursor within the line.
  92.  
  93. @menu
  94. * Readline Bare Essentials::    The least you need to know about Readline.
  95. * Readline Movement Commands::    Moving about the input line.
  96. * Readline Killing Commands::    How to delete text, and how to get it back!
  97. * Readline Arguments::        Giving numeric arguments to commands.
  98. @end menu
  99.  
  100. @node Readline Bare Essentials
  101. @subsection Readline Bare Essentials
  102.  
  103. In order to enter characters into the line, simply type them.  The typed
  104. character appears where the cursor was, and then the cursor moves one
  105. space to the right.  If you mistype a character, you can use your
  106. erase character to back up and delete the mistyped character.
  107.  
  108. Sometimes you may miss typing a character that you wanted to type, and
  109. not notice your error until you have typed several other characters.  In
  110. that case, you can type @key{C-b} to move the cursor to the left, and then
  111. correct your mistake.  Afterwards, you can move the cursor to the right
  112. with @key{C-f}.
  113.  
  114. When you add text in the middle of a line, you will notice that characters
  115. to the right of the cursor are `pushed over' to make room for the text
  116. that you have inserted.  Likewise, when you delete text behind the cursor,
  117. characters to the right of the cursor are `pulled back' to fill in the
  118. blank space created by the removal of the text.  A list of the basic bare
  119. essentials for editing the text of an input line follows.
  120.  
  121. @table @asis
  122. @item @key{C-b}
  123. Move back one character.
  124. @item @key{C-f}
  125. Move forward one character.
  126. @item @key{DEL}
  127. Delete the character to the left of the cursor.
  128. @item @key{C-d}
  129. Delete the character underneath the cursor.
  130. @item @w{Printing characters}
  131. Insert the character into the line at the cursor.
  132. @item @key{C-_}
  133. Undo the last thing that you did.  You can undo all the way back to an
  134. empty line.
  135. @end table
  136.  
  137. @node Readline Movement Commands
  138. @subsection Readline Movement Commands
  139.  
  140.  
  141. The above table describes the most basic possible keystrokes that you need
  142. in order to do editing of the input line.  For your convenience, many
  143. other commands have been added in addition to @key{C-b}, @key{C-f},
  144. @key{C-d}, and @key{DEL}.  Here are some commands for moving more rapidly
  145. about the line.
  146.  
  147. @table @key
  148. @item C-a
  149. Move to the start of the line.
  150. @item C-e
  151. Move to the end of the line.
  152. @item M-f
  153. Move forward a word.
  154. @item M-b
  155. Move backward a word.
  156. @item C-l
  157. Clear the screen, reprinting the current line at the top.
  158. @end table
  159.  
  160. Notice how @key{C-f} moves forward a character, while @key{M-f} moves
  161. forward a word.  It is a loose convention that control keystrokes
  162. operate on characters while meta keystrokes operate on words.
  163.  
  164. @node Readline Killing Commands
  165. @subsection Readline Killing Commands
  166.  
  167. @cindex Killing text
  168. @cindex Yanking text
  169.  
  170. @dfn{Killing} text means to delete the text from the line, but to save
  171. it away for later use, usually by @dfn{yanking} (re-inserting)
  172. it back into the line.
  173. If the description for a command says that it `kills' text, then you can
  174. be sure that you can get the text back in a different (or the same)
  175. place later.
  176.  
  177. When you use a kill command, the text is saved in a @dfn{kill-ring}.
  178. Any number of consecutive kills save all of the killed text together, so
  179. that when you yank it back, you get it all.  The kill
  180. ring is not line specific; the text that you killed on a previously
  181. typed line is available to be yanked back later, when you are typing
  182. another line.
  183. @cindex Kill ring
  184.  
  185. Here is the list of commands for killing text.
  186.  
  187. @table @key
  188. @item C-k
  189. Kill the text from the current cursor position to the end of the line.
  190.  
  191. @item M-d
  192. Kill from the cursor to the end of the current word, or if between
  193. words, to the end of the next word.
  194.  
  195. @item M-DEL
  196. Kill from the cursor the start of the previous word, or if between
  197. words, to the start of the previous word.
  198.  
  199. @item C-w
  200. Kill from the cursor to the previous whitespace.  This is different than
  201. @key{M-DEL} because the word boundaries differ.
  202.  
  203. @end table
  204.  
  205. And, here is how to @dfn{yank} the text back into the line.  Yanking
  206. means to copy the most-recently-killed text from the kill buffer.
  207.  
  208. @table @key
  209. @item C-y
  210. Yank the most recently killed text back into the buffer at the cursor.
  211.  
  212. @item M-y
  213. Rotate the kill-ring, and yank the new top.  You can only do this if
  214. the prior command is @key{C-y} or @key{M-y}.
  215. @end table
  216.  
  217. @node Readline Arguments
  218. @subsection Readline Arguments
  219.  
  220. You can pass numeric arguments to Readline commands.  Sometimes the
  221. argument acts as a repeat count, other times it is the @i{sign} of the
  222. argument that is significant.  If you pass a negative argument to a
  223. command which normally acts in a forward direction, that command will
  224. act in a backward direction.  For example, to kill text back to the
  225. start of the line, you might type @key{M--} @key{C-k}.
  226.  
  227. The general way to pass numeric arguments to a command is to type meta
  228. digits before the command.  If the first `digit' you type is a minus
  229. sign (@key{-}), then the sign of the argument will be negative.  Once
  230. you have typed one meta digit to get the argument started, you can type
  231. the remainder of the digits, and then the command.  For example, to give
  232. the @key{C-d} command an argument of 10, you could type @key{M-1 0 C-d}.
  233.  
  234.  
  235. @node Readline Init File
  236. @section Readline Init File
  237.  
  238. Although the Readline library comes with a set of Emacs-like
  239. keybindings installed by default,
  240. it is possible that you would like to use a different set
  241. of keybindings.  You can customize programs that use Readline by putting
  242. commands in an @dfn{init} file in your home directory.  The name of this
  243. @ifset BashFeatures
  244. file is taken from the value of the shell variable @code{INPUTRC}.  If
  245. @end ifset
  246. @ifclear BashFeatures
  247. file is taken from the value of the environment variable @code{INPUTRC}.  If
  248. @end ifclear
  249. that variable is unset, the default is @file{~/.inputrc}.
  250.  
  251. When a program which uses the Readline library starts up, the
  252. init file is read, and the key bindings are set.
  253.  
  254. In addition, the @code{C-x C-r} command re-reads this init file, thus
  255. incorporating any changes that you might have made to it.
  256.  
  257. @menu
  258. * Readline Init Syntax::    Syntax for the commands in the inputrc file.
  259. * Conditional Init Constructs::    Conditional key bindings in the inputrc file.
  260. @end menu
  261.  
  262. @node Readline Init Syntax
  263. @subsection Readline Init Syntax
  264.  
  265. There are only a few basic constructs allowed in the
  266. Readline init file.  Blank lines are ignored.
  267. Lines beginning with a @key{#} are comments.
  268. Lines beginning with a @key{$} indicate conditional
  269. constructs (@pxref{Conditional Init Constructs}).  Other lines
  270. denote variable settings and key bindings.
  271.  
  272. @table @asis
  273. @item Variable Settings
  274. You can change the state of a few variables in Readline by
  275. using the @code{set} command within the init file.  Here is how you
  276. would specify that you wish to use @code{vi} line editing commands:
  277.  
  278. @example
  279. set editing-mode vi
  280. @end example
  281.  
  282. Right now, there are only a few variables which can be set;
  283. so few, in fact, that we just list them here:
  284.  
  285. @table @code
  286.  
  287. @item editing-mode
  288. @vindex editing-mode
  289. The @code{editing-mode} variable controls which editing mode you are
  290. using.  By default, Readline starts up in Emacs editing mode, where
  291. the keystrokes are most similar to Emacs.  This variable can be
  292. set to either @code{emacs} or @code{vi}.
  293.  
  294. @item horizontal-scroll-mode
  295. @vindex horizontal-scroll-mode
  296. This variable can be set to either @code{On} or @code{Off}.  Setting it
  297. to @code{On} means that the text of the lines that you edit will scroll
  298. horizontally on a single screen line when they are longer than the width
  299. of the screen, instead of wrapping onto a new screen line.  By default,
  300. this variable is set to @code{Off}.
  301.  
  302. @item mark-modified-lines
  303. @vindex mark-modified-lines
  304. This variable, when set to @code{On}, says to display an asterisk
  305. (@samp{*}) at the start of history lines which have been modified.
  306. This variable is @code{off} by default.
  307.  
  308. @item bell-style
  309. @vindex bell-style
  310. Controls what happens when Readline wants to ring the terminal bell.
  311. If set to @code{none}, Readline never rings the bell.  If set to
  312. @code{visible}, Readline uses a visible bell if one is available.
  313. If set to @code{audible} (the default), Readline attempts to ring
  314. the terminal's bell.
  315.  
  316. @item comment-begin
  317. @vindex comment-begin
  318. The string to insert at the beginning of the line when the
  319. @code{vi-comment} command is executed.  The default value
  320. is @code{"#"}.
  321.  
  322. @item meta-flag
  323. @vindex meta-flag
  324. If set to @code{on}, Readline will enable eight-bit input (it
  325. will not strip the eighth bit from the characters it reads),
  326. regardless of what the terminal claims it can support.  The
  327. default value is @code{off}.
  328.  
  329. @item convert-meta
  330. @vindex convert-meta
  331. If set to @code{on}, Readline will convert characters with the
  332. eigth bit set to an ASCII key sequence by stripping the eigth
  333. bit and prepending an @key{ESC} character, converting them to a
  334. meta-prefixed key sequence.  The default value is @code{on}.
  335.  
  336. @item output-meta
  337. @vindex output-meta
  338. If set to @code{on}, Readline will display characters with the
  339. eighth bit set directly rather than as a meta-prefixed escape
  340. sequence.  The default is @code{off}.
  341.  
  342. @item completion-query-items
  343. @vindex completion-query-items
  344. The number of possible completions that determines when the user is
  345. asked whether he wants to see the list of possibilities.  If the
  346. number of possible completions is greater than this value,
  347. Readline will ask the user whether or not he wishes to view
  348. them; otherwise, they are simply listed.  The default limit is
  349. @code{100}.
  350.  
  351. @item keymap
  352. @vindex keymap
  353. Sets Readline's idea of the current keymap for key binding commands.
  354. Acceptable @code{keymap} names are
  355. @code{emacs},
  356. @code{emacs-standard},
  357. @code{emacs-meta},
  358. @code{emacs-ctlx},
  359. @code{vi},
  360. @code{vi-move},
  361. @code{vi-command}, and
  362. @code{vi-insert}.
  363. @code{vi} is equivalent to @code{vi-command}; @code{emacs} is
  364. equivalent to @code{emacs-standard}.  The default value is @code{emacs}.
  365. The value of the @code{editing-mode} variable also affects the
  366. default keymap.
  367.  
  368. @item show-all-if-ambiguous
  369. @vindex show-all-if-ambiguous
  370. This alters the default behavior of the completion functions.  If
  371. set to @code{on}, 
  372. words which have more than one possible completion cause the
  373. matches to be listed immediately instead of ringing the bell.
  374. The default value is @code{off}.
  375.  
  376. @item expand-tilde
  377. @vindex expand-tilde
  378. If set to @code{on}, tilde expansion is performed when Readline
  379. attempts word completion.  The default is @code{off}.
  380.  
  381. @end table
  382.  
  383. @item Key Bindings
  384. The syntax for controlling key bindings in the init file is
  385. simple.  First you have to know the name of the command that you
  386. want to change.  The following pages contain tables of the command name,
  387. the default keybinding, and a short description of what the command
  388. does.
  389.  
  390. Once you know the name of the command, simply place the name of the key
  391. you wish to bind the command to, a colon, and then the name of the
  392. command on a line in the init file.  The name of the key
  393. can be expressed in different ways, depending on which is most
  394. comfortable for you.
  395.  
  396. @table @asis
  397. @item @w{@var{keyname}: @var{function-name} or @var{macro}}
  398. @var{keyname} is the name of a key spelled out in English.  For example:
  399. @example
  400. Control-u: universal-argument
  401. Meta-Rubout: backward-kill-word
  402. Control-o: ">&output"
  403. @end example
  404.  
  405. In the above example, @samp{C-u} is bound to the function
  406. @code{universal-argument}, and @samp{C-o} is bound to run the macro
  407. expressed on the right hand side (that is, to insert the text
  408. @samp{>&output} into the line).
  409.  
  410. @item @w{"@var{keyseq}": @var{function-name} or @var{macro}}
  411. @var{keyseq} differs from @var{keyname} above in that strings
  412. denoting an entire key sequence can be specified, by placing
  413. the key sequence in double quotes.  Some GNU Emacs style key
  414. escapes can be used, as in the following example, but the
  415. special character names are not recognized.
  416.  
  417. @example
  418. "\C-u": universal-argument
  419. "\C-x\C-r": re-read-init-file
  420. "\e[11~": "Function Key 1"
  421. @end example
  422.  
  423. In the above example, @samp{C-u} is bound to the function
  424. @code{universal-argument} (just as it was in the first example),
  425. @samp{C-x C-r} is bound to the function @code{re-read-init-file}, and
  426. @samp{ESC [ 1 1 ~} is bound to insert the text @samp{Function Key 1}.
  427. The following escape sequences are available when specifying key
  428. sequences:
  429.  
  430. @table @code
  431. @item @kbd{\C-}
  432. control prefix
  433. @item @kbd{\M-}
  434. meta prefix
  435. @item @kbd{\e}
  436. an escape character
  437. @item @kbd{\\}
  438. backslash
  439. @item @kbd{\"}
  440. @key{"}
  441. @item @kbd{\'}
  442. @key{'}
  443. @end table
  444.  
  445. When entering the text of a macro, single or double quotes should
  446. be used to indicate a macro definition.  Unquoted text
  447. is assumed to be a function name.  Backslash
  448. will quote any character in the macro text, including @key{"}
  449. and @key{'}.
  450. For example, the following binding will make @kbd{C-x \}
  451. insert a single @key{\} into the line:
  452. @example
  453. "\C-x\\": "\\"
  454. @end example
  455.  
  456. @end table
  457. @end table
  458.  
  459. @node Conditional Init Constructs
  460. @subsection Conditional Init Constructs
  461.  
  462. Readline implements a facility similar in spirit to the conditional
  463. compilation features of the C preprocessor which allows key
  464. bindings and variable settings to be performed as the result
  465. of tests.  There are three parser directives used.
  466.  
  467. @ftable @code
  468. @item $if
  469. The @code{$if} construct allows bindings to be made based on the
  470. editing mode, the terminal being used, or the application using
  471. Readline.  The text of the test extends to the end of the line;
  472. no characters are required to isolate it.
  473.  
  474. @table @code
  475. @item mode
  476. The @code{mode=} form of the @code{$if} directive is used to test
  477. whether Readline is in @code{emacs} or @code{vi} mode.
  478. This may be used in conjunction
  479. with the @samp{set keymap} command, for instance, to set bindings in
  480. the @code{emacs-standard} and @code{emacs-ctlx} keymaps only if
  481. Readline is starting out in @code{emacs} mode.
  482.  
  483. @item term
  484. The @code{term=} form may be used to include terminal-specific
  485. key bindings, perhaps to bind the key sequences output by the
  486. terminal's function keys.  The word on the right side of the
  487. @samp{=} is tested against the full name of the terminal and the
  488. portion of the terminal name before the first @samp{-}.  This
  489. allows @var{sun} to match both @var{sun} and @var{sun-cmd},
  490. for instance.
  491.  
  492. @item application
  493. The @var{application} construct is used to include
  494. application-specific settings.  Each program using the Readline
  495. library sets the @var{application name}, and you can test for it. 
  496. This could be used to bind key sequences to functions useful for
  497. a specific program.  For instance, the following command adds a
  498. key sequence that quotes the current or previous word in Bash:
  499. @example
  500. $if bash
  501. # Quote the current or previous word
  502. "\C-xq": "\eb\"\ef\""
  503. $endif
  504. @end example
  505. @end table
  506.  
  507. @item $endif
  508. This command, as you saw in the previous example, terminates an
  509. @code{$if} command.
  510.  
  511. @item $else
  512. Commands in this branch of the @code{$if} directive are executed if
  513. the test fails.
  514. @end ftable
  515.  
  516. @node Bindable Readline Commands
  517. @section Bindable Readline Commands
  518.  
  519. @menu
  520. * Commands For Moving::        Moving about the line.
  521. * Commands For History::    Getting at previous lines.
  522. * Commands For Text::        Commands for changing text.
  523. * Commands For Killing::    Commands for killing and yanking.
  524. * Numeric Arguments::        Specifying numeric arguments, repeat counts.
  525. * Commands For Completion::    Getting Readline to do the typing for you.
  526. * Keyboard Macros::        Saving and re-executing typed characters
  527. * Miscellaneous Commands::    Other miscellaneous commands.
  528. @end menu
  529.  
  530. @node Commands For Moving
  531. @subsection Commands For Moving
  532. @ftable @code
  533. @item beginning-of-line (C-a)
  534. Move to the start of the current line.
  535.  
  536. @item end-of-line (C-e)
  537. Move to the end of the line.
  538.  
  539. @item forward-char (C-f)
  540. Move forward a character.
  541.  
  542. @item backward-char (C-b)
  543. Move back a character.
  544.  
  545. @item forward-word (M-f)
  546. Move forward to the end of the next word.  Words are composed of
  547. letters and digits.
  548.  
  549. @item backward-word (M-b)
  550. Move back to the start of this, or the previous, word.  Words are
  551. composed of letters and digits.
  552.  
  553. @item clear-screen (C-l)
  554. Clear the screen and redraw the current line,
  555. leaving the current line at the top of the screen.
  556.  
  557. @item redraw-current-line ()
  558. Refresh the current line.  By default, this is unbound.
  559.  
  560. @end ftable
  561.  
  562. @node Commands For History
  563. @subsection Commands For Manipulating The History
  564.  
  565. @ftable @code
  566. @item accept-line (Newline, Return)
  567. @ifset BashFeatures
  568. Accept the line regardless of where the cursor is.  If this line is
  569. non-empty, add it to the history list according to the setting of
  570. the @code{HISTCONTROL} variable.  If this line was a history
  571. line, then restore the history line to its original state.
  572. @end ifset
  573. @ifclear BashFeatures
  574. Accept the line regardless of where the cursor is.  If this line is
  575. non-empty, add it to the history list.  If this line was a history
  576. line, then restore the history line to its original state.
  577. @end ifclear
  578.  
  579. @item previous-history (C-p)
  580. Move `up' through the history list.
  581.  
  582. @item next-history (C-n)
  583. Move `down' through the history list.
  584.  
  585. @item beginning-of-history (M-<)
  586. Move to the first line in the history.
  587.  
  588. @item end-of-history (M->)
  589. Move to the end of the input history, i.e., the line you are entering.
  590.  
  591. @item reverse-search-history (C-r)
  592. Search backward starting at the current line and moving `up' through
  593. the history as necessary.  This is an incremental search.
  594.  
  595. @item forward-search-history (C-s)
  596. Search forward starting at the current line and moving `down' through
  597. the the history as necessary.  This is an incremental search.
  598.  
  599. @item non-incremental-reverse-search-history (M-p)
  600. Search backward starting at the current line and moving `up'
  601. through the history as necessary using a non-incremental search
  602. for a string supplied by the user.
  603.  
  604. @item non-incremental-forward-search-history (M-n)
  605. Search forward starting at the current line and moving `down'
  606. through the the history as necessary using a non-incremental search
  607. for a string supplied by the user.
  608.  
  609. @item history-search-forward ()
  610. Search forward through the history for the string of characters
  611. between the start of the current line and the current point.  This
  612. is a non-incremental search.  By default, this command is unbound.
  613.  
  614. @item history-search-backward ()
  615. Search backward through the history for the string of characters
  616. between the start of the current line and the current point.  This
  617. is a non-incremental search.  By default, this command is unbound.
  618.  
  619. @item yank-nth-arg (M-C-y)
  620. Insert the first argument to the previous command (usually
  621. the second word on the previous line).  With an argument @var{n},
  622. insert the @var{n}th word from the previous command (the words
  623. in the previous command begin with word 0).  A negative argument
  624. inserts the @var{n}th word from the end of the previous command.
  625.  
  626. @item yank-last-arg (M-., M-_)
  627. Insert last argument to the previous command (the last word on the
  628. previous line).  With an
  629. argument, behave exactly like @code{yank-nth-arg}.
  630.  
  631. @end ftable
  632.  
  633. @node Commands For Text
  634. @subsection Commands For Changing Text
  635.  
  636. @ftable @code
  637. @item delete-char (C-d)
  638. Delete the character under the cursor.  If the cursor is at the
  639. beginning of the line, there are no characters in the line, and
  640. the last character typed was not C-d, then return EOF.
  641.  
  642. @item backward-delete-char (Rubout)
  643. Delete the character behind the cursor.  A numeric arg says to kill
  644. the characters instead of deleting them.
  645.  
  646. @item quoted-insert (C-q, C-v)
  647. Add the next character that you type to the line verbatim.  This is
  648. how to insert key sequences like @key{C-q}, for example.
  649.  
  650. @item tab-insert (M-TAB)
  651. Insert a tab character.
  652.  
  653. @item self-insert (a, b, A, 1, !, ...)
  654. Insert yourself.
  655.  
  656. @item transpose-chars (C-t)
  657. Drag the character before the cursor forward over
  658. the character at the cursor, moving the
  659. cursor forward as well.  If the insertion point
  660. is at the end of the line, then this
  661. transposes the last two characters of the line.
  662. Negative argumentss don't work.
  663.  
  664. @item transpose-words (M-t)
  665. Drag the word behind the cursor past the word in front of the cursor
  666. moving the cursor over that word as well.
  667.  
  668. @item upcase-word (M-u)
  669. Uppercase the current (or following) word.  With a negative argument,
  670. do the previous word, but do not move the cursor.
  671.  
  672. @item downcase-word (M-l)
  673. Lowercase the current (or following) word.  With a negative argument,
  674. do the previous word, but do not move the cursor.
  675.  
  676. @item capitalize-word (M-c)
  677. Capitalize the current (or following) word.  With a negative argument,
  678. do the previous word, but do not move the cursor.
  679.  
  680. @end ftable
  681.  
  682. @node Commands For Killing
  683. @subsection Killing And Yanking
  684.  
  685. @ftable @code
  686.  
  687. @item kill-line (C-k)
  688. Kill the text from the current cursor position to the end of the line.
  689.  
  690. @item backward-kill-line (C-x Rubout)
  691. Kill backward to the beginning of the line.
  692.  
  693. @item unix-line-discard (C-u)
  694. Kill backward from the cursor to the beginning of the current line.
  695. Save the killed text on the kill-ring.
  696.  
  697. @item kill-whole-line ()
  698. Kill all characters on the current line, no matter where the
  699. cursor is.  By default, this is unbound.
  700.  
  701. @item kill-word (M-d)
  702. Kill from the cursor to the end of the current word, or if between
  703. words, to the end of the next word.  Word boundaries are the same
  704. as @code{forward-word}.
  705.  
  706. @item backward-kill-word (M-DEL)
  707. Kill the word behind the cursor.  Word boundaries are the same
  708. as @code{backward-word}.
  709.  
  710. @item unix-word-rubout (C-w)
  711. Kill the word behind the cursor, using white space as a word
  712. boundary.  The killed text is saved on the kill-ring.
  713.  
  714. @item delete-horizontal-space ()
  715. Delete all spaces and tabs around point.  By default, this is unbound.
  716.  
  717. @item yank (C-y)
  718. Yank the top of the kill ring into the buffer at the current
  719. cursor position.
  720.  
  721. @item yank-pop (M-y)
  722. Rotate the kill-ring, and yank the new top.  You can only do this if
  723. the prior command is yank or yank-pop.
  724. @end ftable
  725.  
  726. @node Numeric Arguments
  727. @subsection Specifying Numeric Arguments
  728. @ftable @code
  729.  
  730. @item digit-argument (M-0, M-1, ... M--)
  731. Add this digit to the argument already accumulating, or start a new
  732. argument.  M-- starts a negative argument.
  733.  
  734. @item universal-argument ()
  735. Each time this is executed, the argument count is multiplied by four.
  736. The argument count is initially one, so executing this function the
  737. first time makes the argument count four.  By default, this is not
  738. bound to a key.
  739. @end ftable
  740.  
  741. @node Commands For Completion
  742. @subsection Letting Readline Type For You
  743.  
  744. @ftable @code
  745. @item complete (TAB)
  746. Attempt to do completion on the text before the cursor.  This is
  747. application-specific.  Generally, if you are typing a filename
  748. argument, you can do filename completion; if you are typing a command,
  749. you can do command completion, if you are typing in a symbol to GDB, you
  750. can do symbol name completion, if you are typing in a variable to Bash,
  751. you can do variable name completion, and so on.
  752. @ifset BashFeatures
  753. See the Bash manual page for a complete list of available completion
  754. functions.
  755. @end ifset
  756.  
  757. @item possible-completions (M-?)
  758. List the possible completions of the text before the cursor.
  759.  
  760. @item insert-completions ()
  761. Insert all completions of the text before point that would have
  762. been generated by @code{possible-completions}.  By default, this
  763. is not bound to a key.
  764.  
  765. @end ftable
  766.  
  767. @node Keyboard Macros
  768. @subsection Keyboard Macros
  769. @ftable @code
  770.  
  771. @item start-kbd-macro (C-x ()
  772. Begin saving the characters typed into the current keyboard macro.
  773.  
  774. @item end-kbd-macro (C-x ))
  775. Stop saving the characters typed into the current keyboard macro
  776. and save the definition.
  777.  
  778. @item call-last-kbd-macro (C-x e)
  779. Re-execute the last keyboard macro defined, by making the characters
  780. in the macro appear as if typed at the keyboard.
  781.  
  782. @end ftable
  783.  
  784. @node Miscellaneous Commands
  785. @subsection Some Miscellaneous Commands
  786. @ftable @code
  787.  
  788. @item re-read-init-file (C-x C-r)
  789. Read in the contents of your init file, and incorporate
  790. any bindings or variable assignments found there.
  791.  
  792. @item abort (C-g)
  793. Abort the current editing command and
  794. ring the terminal's bell (subject to the setting of
  795. @code{bell-style}).
  796.  
  797. @item do-uppercase-version (M-a, M-b, ...)
  798. Run the command that is bound to the corresoponding uppercase
  799. character.
  800.  
  801. @item prefix-meta (ESC)
  802. Make the next character that you type be metafied.  This is for people
  803. without a meta key.  Typing @samp{ESC f} is equivalent to typing
  804. @samp{M-f}.
  805.  
  806. @item undo (C-_, C-x C-u)
  807. Incremental undo, separately remembered for each line.
  808.  
  809. @item revert-line (M-r)
  810. Undo all changes made to this line.  This is like typing the @code{undo}
  811. command enough times to get back to the beginning.
  812.  
  813. @item tilde-expand (M-~)
  814. Perform tilde expansion on the current word.
  815.  
  816. @item dump-functions ()
  817. Print all of the functions and their key bindings to the
  818. readline output stream.  If a numeric argument is supplied,
  819. the output is formatted in such a way that it can be made part
  820. of an @var{inputrc} file.
  821.  
  822. @ifset BashFeatures
  823. @item display-shell-version (C-x C-v)
  824. Display version information about the current instance of Bash.
  825.  
  826. @item shell-expand-line (M-C-e)
  827. Expand the line the way the shell does when it reads it.  This
  828. performs alias and history expansion as well as all of the shell
  829. word expansions.
  830.  
  831. @item history-expand-line (M-^)
  832. Perform history expansion on the current line.
  833.  
  834. @item insert-last-argument (M-., M-_)
  835. A synonym for @code{yank-last-arg}.
  836.  
  837. @item operate-and-get-next (C-o)
  838. Accept the current line for execution and fetch the next line
  839. relative to the current line from the history for editing.  Any
  840. argument is ignored.
  841.  
  842. @item emacs-editing-mode (C-e)
  843. When in @code{vi} editing mode, this causes a switch back to
  844. emacs editing mode, as if the command @code{set -o emacs} had
  845. been executed.
  846.  
  847. @end ifset
  848.  
  849. @end ftable
  850.  
  851. @node Readline vi Mode
  852. @section Readline vi Mode
  853.  
  854. While the Readline library does not have a full set of @code{vi}
  855. editing functions, it does contain enough to allow simple editing
  856. of the line.  The Readline @code{vi} mode behaves as specified in
  857. the Posix 1003.2 standard.
  858.  
  859. @ifset BashFeatures
  860. In order to switch interactively between @code{Emacs} and @code{Vi}
  861. editing modes, use the @code{set -o emacs} and @code{set -o vi}
  862. commands (@pxref{The Set Builtin}).
  863. @end ifset
  864. @ifclear BashFeatures
  865. In order to switch interactively between @code{Emacs} and @code{Vi}
  866. editing modes, use the command M-C-j (toggle-editing-mode).
  867. @end ifclear
  868. The Readline default is @code{emacs} mode.
  869.  
  870. When you enter a line in @code{vi} mode, you are already placed in
  871. `insertion' mode, as if you had typed an @samp{i}.  Pressing @key{ESC}
  872. switches you into `command' mode, where you can edit the text of the
  873. line with the standard @code{vi} movement keys, move to previous
  874. history lines with @samp{k}, and following lines with @samp{j}, and
  875. so forth.
  876.