readline.3 51 KB

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