4 EDITLINE(3) EDITLINE(3)
9 editline - command-line editing library with history
13 r
\bre
\bea
\bad
\bdl
\bli
\bin
\bne
\be(
\b(p
\bpr
\bro
\bom
\bmp
\bpt
\bt)
\b)
14 c
\bch
\bha
\bar
\br *
\b*p
\bpr
\bro
\bom
\bmp
\bpt
\bt;
\b;
17 a
\bad
\bdd
\bd_
\b_h
\bhi
\bis
\bst
\bto
\bor
\bry
\by(
\b(l
\bli
\bin
\bne
\be)
\b)
18 c
\bch
\bha
\bar
\br *
\b*l
\bli
\bin
\bne
\be;
\b;
21 _
\bE_
\bd_
\bi_
\bt_
\bl_
\bi_
\bn_
\be is a library that provides an line-editing interface with text
22 recall. It is intended to be compatible with the _
\br_
\be_
\ba_
\bd_
\bl_
\bi_
\bn_
\be library provided
23 by the Free Software Foundation, but much smaller. The bulk of this manual
24 page describes the user interface.
26 The _
\br_
\be_
\ba_
\bd_
\bl_
\bi_
\bn_
\be routine returns a line of text with the trailing newline
27 removed. The data is returned in a buffer allocated with _
\bm_
\ba_
\bl_
\bl_
\bo_
\bc(3), so the
28 space should be released with _
\bf_
\br_
\be_
\be(3) when the calling program is done with
29 it. Before accepting input from the user, the specified _
\bp_
\br_
\bo_
\bm_
\bp_
\bt is dis-
30 played on the terminal.
32 The _
\ba_
\bd_
\bd_
\b__
\bh_
\bi_
\bs_
\bt_
\bo_
\br_
\by routine makes a copy of the specified _
\bl_
\bi_
\bn_
\be and adds it to
33 the internal history list.
37 A program that uses this library provides a simple emacs-like editing
38 interface to its users. A line may be edited before it is sent to the
39 calling program by typing either control characters or escape sequences. A
40 control character, shown as a caret followed by a letter, is typed by hold-
41 ing down the ``control'' key while the letter is typed. For example,
42 ``^A'' is a control-A. An escape sequence is entered by typing the
43 ``escape'' key followed by one or more characters. The escape key is
44 abbreviated as ``ESC.'' Note that unlike control keys, case matters in
45 escape sequences; ``ESC F'' is not the same as ``ESC f''.
47 An editing command may be typed anywhere on the line, not just at the
48 beginning. In addition, a return may also be typed anywhere on the line,
51 Most editing commands may be given a repeat count, _
\bn, where _
\bn is a number.
52 To enter a repeat count, type the escape key, the number, and then the com-
53 mand to execute. For example, ``ESC 4 ^f'' moves forward four characters.
54 If a command may be given a repeat count then the text ``[n]'' is given at
55 the end of its description.
57 The following control characters are accepted:
58 ^A Move to the beginning of the line
59 ^B Move left (backwards) [n]
60 ^D Delete character [n]
61 ^E Move to end of line
62 ^F Move right (forwards) [n]
64 ^H Delete character before cursor (backspace key) [n]
65 ^I Complete filename (tab key); see below
66 ^J Done with line (return key)
67 ^K Kill to end of line (or column [n])
69 ^M Done with line (alternate return key)
70 ^N Get next line from history [n]
71 ^P Get previous line from history [n]
72 ^R Search backward (forward if [n]) through history for text;
73 must start line if text begins with an uparrow
74 ^T Transpose characters
75 ^V Insert next character, even if it is an edit command
77 ^X^X Exchange current location and mark
78 ^Y Yank back last killed text
79 ^[ Start an escape sequence (escape key)
80 ^]c Move forward to next character ``c''
81 ^? Delete character before cursor (delete key) [n]
83 The following escape sequences are provided.
84 ESC ^H Delete previous word (backspace key) [n]
85 ESC DEL Delete previous word (delete key) [n]
86 ESC SP Set the mark (space key); see ^X^X and ^Y above
87 ESC . Get the last (or [n]'th) word from previous line
88 ESC ? Show possible completions; see below
89 ESC < Move to start of history
90 ESC > Move to end of history
91 ESC b Move backward a word [n]
92 ESC d Delete word under cursor [n]
93 ESC f Move forward a word [n]
94 ESC l Make word lowercase [n]
95 ESC u Make word uppercase [n]
96 ESC y Yank back last killed text
97 ESC v Show library version
98 ESC w Make area up to mark yankable
99 ESC nn Set repeat count to the number nn
100 ESC C Read from environment variable ``_C_'', where C is
103 The _
\be_
\bd_
\bi_
\bt_
\bl_
\bi_
\bn_
\be library has a small macro facility. If you type the escape
104 key followed by an uppercase letter, _
\bC, then the contents of the environ-
105 ment variable _
\b__
\bC_
\b_ are read in as if you had typed them at the keyboard.
106 For example, if the variable _
\b__
\bL_
\b_ contains the following:
107 ^A^Kecho '^V^[[H^V^[[2J'^M
108 Then typing ``ESC L'' will move to the beginning of the line, kill the
109 entire line, enter the echo command needed to clear the terminal (if your
110 terminal is like a VT-100), and send the line back to the shell.
112 The _
\be_
\bd_
\bi_
\bt_
\bl_
\bi_
\bn_
\be library also does filename completion. Suppose the root
113 directory has the following files in it:
116 If you type ``rm /v'' and then the tab key. _
\bE_
\bd_
\bi_
\bt_
\bl_
\bi_
\bn_
\be will then finish off
117 as much of the name as possible by adding ``munix''. Because the name is
118 not unique, it will then beep. If you type the escape key and a question
119 mark, it will display the two choices. If you then type a period and a
120 tab, the library will finish off the filename for you:
121 rm /v[TAB]_
\bm_
\bu_
\bn_
\bi_
\bx.TAB_
\bo_
\bl_
\bd
122 The tab key is shown by ``[TAB]'' and the automatically-entered text is
128 Cannot handle lines more than 80 columns.
134 Simmule R. Turner <uunet.uu.net!capitol!sysgo!simmy> and Rich $alz
135 <rsalz@osf.org>. Original manual page by DaviD W. Sanderson