annotate readline/doc/readline.info @ 3793:56522edd5c33

[project @ 2001-02-10 05:11:49 by jwe]
author jwe
date Sat, 10 Feb 2001 05:13:25 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3793
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1 This is readline.info, produced by makeinfo version 4.0 from
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2 /usr/homes/chet/src/bash/readline-src/doc/rlman.texinfo.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
4 INFO-DIR-SECTION Libraries
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
5 START-INFO-DIR-ENTRY
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
6 * Readline: (readline). The GNU readline library API
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
7 END-INFO-DIR-ENTRY
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
8
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
9 This document describes the GNU Readline Library, a utility which
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
10 aids in the consistency of user interface across discrete programs that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
11 need to provide a command line interface.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
12
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
13 Copyright (C) 1988-2001 Free Software Foundation, Inc.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
14
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
15 Permission is granted to make and distribute verbatim copies of this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
16 manual provided the copyright notice and this permission notice pare
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
17 preserved on all copies.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
18
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
19 Permission is granted to copy and distribute modified versions of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
20 this manual under the conditions for verbatim copying, provided that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
21 the entire resulting derived work is distributed under the terms of a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
22 permission notice identical to this one.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
23
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
24 Permission is granted to copy and distribute translations of this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
25 manual into another language, under the above conditions for modified
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
26 versions, except that this permission notice may be stated in a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
27 translation approved by the Free Software Foundation.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
28
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
29 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
30 File: readline.info, Node: Top, Next: Command Line Editing, Up: (dir)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
31
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
32 GNU Readline Library
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
33 ********************
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
34
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
35 This document describes the GNU Readline Library, a utility which
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
36 aids in the consistency of user interface across discrete programs that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
37 need to provide a command line interface.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
38
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
39 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
40
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
41 * Command Line Editing:: GNU Readline User's Manual.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
42 * Programming with GNU Readline:: GNU Readline Programmer's Manual.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
43 * Concept Index:: Index of concepts described in this manual.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
44 * Function and Variable Index:: Index of externally visible functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
45 and variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
46
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
47 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
48 File: readline.info, Node: Command Line Editing, Next: Programming with GNU Readline, Prev: Top, Up: Top
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
49
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
50 Command Line Editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
51 ********************
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
52
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
53 This chapter describes the basic features of the GNU command line
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
54 editing interface.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
55
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
56 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
57
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
58 * Introduction and Notation:: Notation used in this text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
59 * Readline Interaction:: The minimum set of commands for editing a line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
60 * Readline Init File:: Customizing Readline from a user's view.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
61 * Bindable Readline Commands:: A description of most of the Readline commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
62 available for binding
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
63 * Readline vi Mode:: A short description of how to make Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
64 behave like the vi editor.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
65
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
66 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
67 File: readline.info, Node: Introduction and Notation, Next: Readline Interaction, Up: Command Line Editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
68
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
69 Introduction to Line Editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
70 ============================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
71
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
72 The following paragraphs describe the notation used to represent
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
73 keystrokes.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
74
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
75 The text `C-k' is read as `Control-K' and describes the character
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
76 produced when the <k> key is pressed while the Control key is depressed.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
77
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
78 The text `M-k' is read as `Meta-K' and describes the character
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
79 produced when the Meta key (if you have one) is depressed, and the <k>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
80 key is pressed. The Meta key is labeled <ALT> on many keyboards. On
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
81 keyboards with two keys labeled <ALT> (usually to either side of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
82 space bar), the <ALT> on the left side is generally set to work as a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
83 Meta key. The <ALT> key on the right may also be configured to work as
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
84 a Meta key or may be configured as some other modifier, such as a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
85 Compose key for typing accented characters.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
86
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
87 If you do not have a Meta or <ALT> key, or another key working as a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
88 Meta key, the identical keystroke can be generated by typing <ESC>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
89 _first_, and then typing <k>. Either process is known as "metafying"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
90 the <k> key.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
91
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
92 The text `M-C-k' is read as `Meta-Control-k' and describes the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
93 character produced by "metafying" `C-k'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
94
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
95 In addition, several keys have their own names. Specifically,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
96 <DEL>, <ESC>, <LFD>, <SPC>, <RET>, and <TAB> all stand for themselves
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
97 when seen in this text, or in an init file (*note Readline Init File::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
98 If your keyboard lacks a <LFD> key, typing <C-j> will produce the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
99 desired character. The <RET> key may be labeled <Return> or <Enter> on
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
100 some keyboards.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
101
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
102 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
103 File: readline.info, Node: Readline Interaction, Next: Readline Init File, Prev: Introduction and Notation, Up: Command Line Editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
104
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
105 Readline Interaction
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
106 ====================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
107
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
108 Often during an interactive session you type in a long line of text,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
109 only to notice that the first word on the line is misspelled. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
110 Readline library gives you a set of commands for manipulating the text
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
111 as you type it in, allowing you to just fix your typo, and not forcing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
112 you to retype the majority of the line. Using these editing commands,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
113 you move the cursor to the place that needs correction, and delete or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
114 insert the text of the corrections. Then, when you are satisfied with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
115 the line, you simply press <RET>. You do not have to be at the end of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
116 the line to press <RET>; the entire line is accepted regardless of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
117 location of the cursor within the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
118
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
119 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
120
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
121 * Readline Bare Essentials:: The least you need to know about Readline.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
122 * Readline Movement Commands:: Moving about the input line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
123 * Readline Killing Commands:: How to delete text, and how to get it back!
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
124 * Readline Arguments:: Giving numeric arguments to commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
125 * Searching:: Searching through previous lines.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
126
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
127 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
128 File: readline.info, Node: Readline Bare Essentials, Next: Readline Movement Commands, Up: Readline Interaction
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
129
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
130 Readline Bare Essentials
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
131 ------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
132
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
133 In order to enter characters into the line, simply type them. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
134 typed character appears where the cursor was, and then the cursor moves
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
135 one space to the right. If you mistype a character, you can use your
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
136 erase character to back up and delete the mistyped character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
137
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
138 Sometimes you may mistype a character, and not notice the error
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
139 until you have typed several other characters. In that case, you can
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
140 type `C-b' to move the cursor to the left, and then correct your
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
141 mistake. Afterwards, you can move the cursor to the right with `C-f'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
142
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
143 When you add text in the middle of a line, you will notice that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
144 characters to the right of the cursor are `pushed over' to make room
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
145 for the text that you have inserted. Likewise, when you delete text
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
146 behind the cursor, characters to the right of the cursor are `pulled
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
147 back' to fill in the blank space created by the removal of the text. A
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
148 list of the bare essentials for editing the text of an input line
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
149 follows.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
150
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
151 `C-b'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
152 Move back one character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
153
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
154 `C-f'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
155 Move forward one character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
156
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
157 <DEL> or <Backspace>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
158 Delete the character to the left of the cursor.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
159
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
160 `C-d'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
161 Delete the character underneath the cursor.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
162
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
163 Printing characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
164 Insert the character into the line at the cursor.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
165
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
166 `C-_' or `C-x C-u'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
167 Undo the last editing command. You can undo all the way back to an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
168 empty line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
169
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
170 (Depending on your configuration, the <Backspace> key be set to delete
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
171 the character to the left of the cursor and the <DEL> key set to delete
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
172 the character underneath the cursor, like `C-d', rather than the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
173 character to the left of the cursor.)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
174
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
175 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
176 File: readline.info, Node: Readline Movement Commands, Next: Readline Killing Commands, Prev: Readline Bare Essentials, Up: Readline Interaction
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
177
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
178 Readline Movement Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
179 --------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
180
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
181 The above table describes the most basic keystrokes that you need in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
182 order to do editing of the input line. For your convenience, many
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
183 other commands have been added in addition to `C-b', `C-f', `C-d', and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
184 <DEL>. Here are some commands for moving more rapidly about the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
185
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
186 `C-a'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
187 Move to the start of the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
188
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
189 `C-e'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
190 Move to the end of the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
191
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
192 `M-f'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
193 Move forward a word, where a word is composed of letters and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
194 digits.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
195
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
196 `M-b'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
197 Move backward a word.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
198
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
199 `C-l'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
200 Clear the screen, reprinting the current line at the top.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
201
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
202 Notice how `C-f' moves forward a character, while `M-f' moves
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
203 forward a word. It is a loose convention that control keystrokes
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
204 operate on characters while meta keystrokes operate on words.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
205
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
206 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
207 File: readline.info, Node: Readline Killing Commands, Next: Readline Arguments, Prev: Readline Movement Commands, Up: Readline Interaction
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
208
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
209 Readline Killing Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
210 -------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
211
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
212 "Killing" text means to delete the text from the line, but to save
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
213 it away for later use, usually by "yanking" (re-inserting) it back into
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
214 the line. (`Cut' and `paste' are more recent jargon for `kill' and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
215 `yank'.)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
216
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
217 If the description for a command says that it `kills' text, then you
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
218 can be sure that you can get the text back in a different (or the same)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
219 place later.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
220
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
221 When you use a kill command, the text is saved in a "kill-ring".
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
222 Any number of consecutive kills save all of the killed text together, so
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
223 that when you yank it back, you get it all. The kill ring is not line
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
224 specific; the text that you killed on a previously typed line is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
225 available to be yanked back later, when you are typing another line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
226
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
227 Here is the list of commands for killing text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
228
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
229 `C-k'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
230 Kill the text from the current cursor position to the end of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
231 line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
232
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
233 `M-d'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
234 Kill from the cursor to the end of the current word, or, if between
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
235 words, to the end of the next word. Word boundaries are the same
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
236 as those used by `M-f'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
237
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
238 `M-<DEL>'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
239 Kill from the cursor the start of the previous word, or, if between
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
240 words, to the start of the previous word. Word boundaries are the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
241 same as those used by `M-b'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
242
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
243 `C-w'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
244 Kill from the cursor to the previous whitespace. This is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
245 different than `M-<DEL>' because the word boundaries differ.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
246
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
247 Here is how to "yank" the text back into the line. Yanking means to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
248 copy the most-recently-killed text from the kill buffer.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
249
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
250 `C-y'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
251 Yank the most recently killed text back into the buffer at the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
252 cursor.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
253
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
254 `M-y'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
255 Rotate the kill-ring, and yank the new top. You can only do this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
256 if the prior command is `C-y' or `M-y'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
257
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
258 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
259 File: readline.info, Node: Readline Arguments, Next: Searching, Prev: Readline Killing Commands, Up: Readline Interaction
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
260
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
261 Readline Arguments
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
262 ------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
263
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
264 You can pass numeric arguments to Readline commands. Sometimes the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
265 argument acts as a repeat count, other times it is the sign of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
266 argument that is significant. If you pass a negative argument to a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
267 command which normally acts in a forward direction, that command will
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
268 act in a backward direction. For example, to kill text back to the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
269 start of the line, you might type `M-- C-k'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
270
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
271 The general way to pass numeric arguments to a command is to type
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
272 meta digits before the command. If the first `digit' typed is a minus
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
273 sign (`-'), then the sign of the argument will be negative. Once you
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
274 have typed one meta digit to get the argument started, you can type the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
275 remainder of the digits, and then the command. For example, to give
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
276 the `C-d' command an argument of 10, you could type `M-1 0 C-d', which
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
277 will delete the next ten characters on the input line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
278
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
279 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
280 File: readline.info, Node: Searching, Prev: Readline Arguments, Up: Readline Interaction
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
281
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
282 Searching for Commands in the History
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
283 -------------------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
284
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
285 Readline provides commands for searching through the command history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
286 for lines containing a specified string. There are two search modes:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
287 "incremental" and "non-incremental".
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
288
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
289 Incremental searches begin before the user has finished typing the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
290 search string. As each character of the search string is typed,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
291 Readline displays the next entry from the history matching the string
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
292 typed so far. An incremental search requires only as many characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
293 as needed to find the desired history entry. To search backward in the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
294 history for a particular string, type `C-r'. Typing `C-s' searches
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
295 forward through the history. The characters present in the value of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
296 the `isearch-terminators' variable are used to terminate an incremental
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
297 search. If that variable has not been assigned a value, the <ESC> and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
298 `C-J' characters will terminate an incremental search. `C-g' will
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
299 abort an incremental search and restore the original line. When the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
300 search is terminated, the history entry containing the search string
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
301 becomes the current line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
302
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
303 To find other matching entries in the history list, type `C-r' or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
304 `C-s' as appropriate. This will search backward or forward in the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
305 history for the next entry matching the search string typed so far.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
306 Any other key sequence bound to a Readline command will terminate the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
307 search and execute that command. For instance, a <RET> will terminate
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
308 the search and accept the line, thereby executing the command from the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
309 history list. A movement command will terminate the search, make the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
310 last line found the current line, and begin editing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
311
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
312 Non-incremental searches read the entire search string before
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
313 starting to search for matching history lines. The search string may be
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
314 typed by the user or be part of the contents of the current line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
315
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
316 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
317 File: readline.info, Node: Readline Init File, Next: Bindable Readline Commands, Prev: Readline Interaction, Up: Command Line Editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
318
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
319 Readline Init File
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
320 ==================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
321
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
322 Although the Readline library comes with a set of Emacs-like
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
323 keybindings installed by default, it is possible to use a different set
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
324 of keybindings. Any user can customize programs that use Readline by
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
325 putting commands in an "inputrc" file, conventionally in his home
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
326 directory. The name of this file is taken from the value of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
327 environment variable `INPUTRC'. If that variable is unset, the default
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
328 is `~/.inputrc'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
329
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
330 When a program which uses the Readline library starts up, the init
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
331 file is read, and the key bindings are set.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
332
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
333 In addition, the `C-x C-r' command re-reads this init file, thus
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
334 incorporating any changes that you might have made to it.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
335
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
336 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
337
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
338 * Readline Init File Syntax:: Syntax for the commands in the inputrc file.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
339
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
340 * Conditional Init Constructs:: Conditional key bindings in the inputrc file.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
341
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
342 * Sample Init File:: An example inputrc file.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
343
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
344 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
345 File: readline.info, Node: Readline Init File Syntax, Next: Conditional Init Constructs, Up: Readline Init File
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
346
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
347 Readline Init File Syntax
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
348 -------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
349
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
350 There are only a few basic constructs allowed in the Readline init
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
351 file. Blank lines are ignored. Lines beginning with a `#' are
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
352 comments. Lines beginning with a `$' indicate conditional constructs
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
353 (*note Conditional Init Constructs::). Other lines denote variable
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
354 settings and key bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
355
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
356 Variable Settings
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
357 You can modify the run-time behavior of Readline by altering the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
358 values of variables in Readline using the `set' command within the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
359 init file. Here is how to change from the default Emacs-like key
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
360 binding to use `vi' line editing commands:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
361
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
362 set editing-mode vi
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
363
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
364 A great deal of run-time behavior is changeable with the following
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
365 variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
366
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
367 `bell-style'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
368 Controls what happens when Readline wants to ring the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
369 terminal bell. If set to `none', Readline never rings the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
370 bell. If set to `visible', Readline uses a visible bell if
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
371 one is available. If set to `audible' (the default),
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
372 Readline attempts to ring the terminal's bell.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
373
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
374 `comment-begin'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
375 The string to insert at the beginning of the line when the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
376 `insert-comment' command is executed. The default value is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
377 `"#"'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
378
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
379 `completion-ignore-case'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
380 If set to `on', Readline performs filename matching and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
381 completion in a case-insensitive fashion. The default value
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
382 is `off'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
383
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
384 `completion-query-items'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
385 The number of possible completions that determines when the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
386 user is asked whether he wants to see the list of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
387 possibilities. If the number of possible completions is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
388 greater than this value, Readline will ask the user whether
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
389 or not he wishes to view them; otherwise, they are simply
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
390 listed. This variable must be set to an integer value
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
391 greater than or equal to 0. The default limit is `100'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
392
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
393 `convert-meta'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
394 If set to `on', Readline will convert characters with the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
395 eighth bit set to an ASCII key sequence by stripping the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
396 eighth bit and prefixing an <ESC> character, converting them
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
397 to a meta-prefixed key sequence. The default value is `on'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
398
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
399 `disable-completion'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
400 If set to `On', Readline will inhibit word completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
401 Completion characters will be inserted into the line as if
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
402 they had been mapped to `self-insert'. The default is `off'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
403
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
404 `editing-mode'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
405 The `editing-mode' variable controls which default set of key
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
406 bindings is used. By default, Readline starts up in Emacs
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
407 editing mode, where the keystrokes are most similar to Emacs.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
408 This variable can be set to either `emacs' or `vi'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
409
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
410 `enable-keypad'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
411 When set to `on', Readline will try to enable the application
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
412 keypad when it is called. Some systems need this to enable
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
413 the arrow keys. The default is `off'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
414
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
415 `expand-tilde'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
416 If set to `on', tilde expansion is performed when Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
417 attempts word completion. The default is `off'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
418
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
419 `horizontal-scroll-mode'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
420 This variable can be set to either `on' or `off'. Setting it
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
421 to `on' means that the text of the lines being edited will
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
422 scroll horizontally on a single screen line when they are
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
423 longer than the width of the screen, instead of wrapping onto
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
424 a new screen line. By default, this variable is set to `off'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
425
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
426 `input-meta'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
427 If set to `on', Readline will enable eight-bit input (it will
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
428 not clear the eighth bit in the characters it reads),
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
429 regardless of what the terminal claims it can support. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
430 default value is `off'. The name `meta-flag' is a synonym
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
431 for this variable.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
432
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
433 `isearch-terminators'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
434 The string of characters that should terminate an incremental
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
435 search without subsequently executing the character as a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
436 command (*note Searching::). If this variable has not been
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
437 given a value, the characters <ESC> and `C-J' will terminate
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
438 an incremental search.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
439
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
440 `keymap'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
441 Sets Readline's idea of the current keymap for key binding
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
442 commands. Acceptable `keymap' names are `emacs',
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
443 `emacs-standard', `emacs-meta', `emacs-ctlx', `vi', `vi-move',
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
444 `vi-command', and `vi-insert'. `vi' is equivalent to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
445 `vi-command'; `emacs' is equivalent to `emacs-standard'. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
446 default value is `emacs'. The value of the `editing-mode'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
447 variable also affects the default keymap.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
448
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
449 `mark-directories'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
450 If set to `on', completed directory names have a slash
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
451 appended. The default is `on'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
452
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
453 `mark-modified-lines'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
454 This variable, when set to `on', causes Readline to display an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
455 asterisk (`*') at the start of history lines which have been
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
456 modified. This variable is `off' by default.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
457
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
458 `output-meta'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
459 If set to `on', Readline will display characters with the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
460 eighth bit set directly rather than as a meta-prefixed escape
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
461 sequence. The default is `off'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
462
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
463 `print-completions-horizontally'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
464 If set to `on', Readline will display completions with matches
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
465 sorted horizontally in alphabetical order, rather than down
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
466 the screen. The default is `off'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
467
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
468 `show-all-if-ambiguous'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
469 This alters the default behavior of the completion functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
470 If set to `on', words which have more than one possible
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
471 completion cause the matches to be listed immediately instead
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
472 of ringing the bell. The default value is `off'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
473
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
474 `visible-stats'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
475 If set to `on', a character denoting a file's type is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
476 appended to the filename when listing possible completions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
477 The default is `off'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
478
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
479 Key Bindings
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
480 The syntax for controlling key bindings in the init file is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
481 simple. First you need to find the name of the command that you
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
482 want to change. The following sections contain tables of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
483 command name, the default keybinding, if any, and a short
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
484 description of what the command does.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
485
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
486 Once you know the name of the command, simply place on a line in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
487 the init file the name of the key you wish to bind the command to,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
488 a colon, and then the name of the command. The name of the key
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
489 can be expressed in different ways, depending on what you find most
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
490 comfortable.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
491
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
492 KEYNAME: FUNCTION-NAME or MACRO
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
493 KEYNAME is the name of a key spelled out in English. For
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
494 example:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
495 Control-u: universal-argument
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
496 Meta-Rubout: backward-kill-word
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
497 Control-o: "> output"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
498
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
499 In the above example, `C-u' is bound to the function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
500 `universal-argument', `M-DEL' is bound to the function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
501 `backward-kill-word', and `C-o' is bound to run the macro
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
502 expressed on the right hand side (that is, to insert the text
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
503 `> output' into the line).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
504
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
505 A number of symbolic character names are recognized while
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
506 processing this key binding syntax: DEL, ESC, ESCAPE, LFD,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
507 NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
508
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
509 "KEYSEQ": FUNCTION-NAME or MACRO
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
510 KEYSEQ differs from KEYNAME above in that strings denoting an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
511 entire key sequence can be specified, by placing the key
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
512 sequence in double quotes. Some GNU Emacs style key escapes
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
513 can be used, as in the following example, but the special
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
514 character names are not recognized.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
515
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
516 "\C-u": universal-argument
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
517 "\C-x\C-r": re-read-init-file
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
518 "\e[11~": "Function Key 1"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
519
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
520 In the above example, `C-u' is again bound to the function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
521 `universal-argument' (just as it was in the first example),
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
522 `C-x C-r' is bound to the function `re-read-init-file', and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
523 `<ESC> <[> <1> <1> <~>' is bound to insert the text `Function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
524 Key 1'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
525
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
526 The following GNU Emacs style escape sequences are available when
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
527 specifying key sequences:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
528
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
529 `\C-'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
530 control prefix
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
531
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
532 `\M-'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
533 meta prefix
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
534
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
535 `\e'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
536 an escape character
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
537
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
538 `\\'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
539 backslash
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
540
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
541 `\"'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
542 <">, a double quotation mark
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
543
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
544 `\''
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
545 <'>, a single quote or apostrophe
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
546
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
547 In addition to the GNU Emacs style escape sequences, a second set
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
548 of backslash escapes is available:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
549
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
550 `\a'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
551 alert (bell)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
552
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
553 `\b'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
554 backspace
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
555
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
556 `\d'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
557 delete
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
558
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
559 `\f'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
560 form feed
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
561
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
562 `\n'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
563 newline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
564
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
565 `\r'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
566 carriage return
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
567
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
568 `\t'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
569 horizontal tab
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
570
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
571 `\v'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
572 vertical tab
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
573
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
574 `\NNN'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
575 the character whose ASCII code is the octal value NNN (one to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
576 three digits)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
577
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
578 `\xNNN'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
579 the character whose ASCII code is the hexadecimal value NNN
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
580 (one to three digits)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
581
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
582 When entering the text of a macro, single or double quotes must be
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
583 used to indicate a macro definition. Unquoted text is assumed to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
584 be a function name. In the macro body, the backslash escapes
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
585 described above are expanded. Backslash will quote any other
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
586 character in the macro text, including `"' and `''. For example,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
587 the following binding will make `C-x \' insert a single `\' into
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
588 the line:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
589 "\C-x\\": "\\"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
590
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
591 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
592 File: readline.info, Node: Conditional Init Constructs, Next: Sample Init File, Prev: Readline Init File Syntax, Up: Readline Init File
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
593
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
594 Conditional Init Constructs
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
595 ---------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
596
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
597 Readline implements a facility similar in spirit to the conditional
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
598 compilation features of the C preprocessor which allows key bindings
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
599 and variable settings to be performed as the result of tests. There
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
600 are four parser directives used.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
601
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
602 `$if'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
603 The `$if' construct allows bindings to be made based on the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
604 editing mode, the terminal being used, or the application using
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
605 Readline. The text of the test extends to the end of the line; no
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
606 characters are required to isolate it.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
607
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
608 `mode'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
609 The `mode=' form of the `$if' directive is used to test
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
610 whether Readline is in `emacs' or `vi' mode. This may be
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
611 used in conjunction with the `set keymap' command, for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
612 instance, to set bindings in the `emacs-standard' and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
613 `emacs-ctlx' keymaps only if Readline is starting out in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
614 `emacs' mode.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
615
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
616 `term'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
617 The `term=' form may be used to include terminal-specific key
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
618 bindings, perhaps to bind the key sequences output by the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
619 terminal's function keys. The word on the right side of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
620 `=' is tested against both the full name of the terminal and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
621 the portion of the terminal name before the first `-'. This
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
622 allows `sun' to match both `sun' and `sun-cmd', for instance.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
623
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
624 `application'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
625 The APPLICATION construct is used to include
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
626 application-specific settings. Each program using the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
627 Readline library sets the APPLICATION NAME, and you can test
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
628 for it. This could be used to bind key sequences to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
629 functions useful for a specific program. For instance, the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
630 following command adds a key sequence that quotes the current
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
631 or previous word in Bash:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
632 $if Bash
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
633 # Quote the current or previous word
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
634 "\C-xq": "\eb\"\ef\""
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
635 $endif
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
636
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
637 `$endif'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
638 This command, as seen in the previous example, terminates an `$if'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
639 command.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
640
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
641 `$else'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
642 Commands in this branch of the `$if' directive are executed if the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
643 test fails.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
644
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
645 `$include'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
646 This directive takes a single filename as an argument and reads
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
647 commands and bindings from that file.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
648 $include /etc/inputrc
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
649
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
650 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
651 File: readline.info, Node: Sample Init File, Prev: Conditional Init Constructs, Up: Readline Init File
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
652
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
653 Sample Init File
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
654 ----------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
655
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
656 Here is an example of an INPUTRC file. This illustrates key
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
657 binding, variable assignment, and conditional syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
658
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
659
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
660 # This file controls the behaviour of line input editing for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
661 # programs that use the Gnu Readline library. Existing programs
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
662 # include FTP, Bash, and Gdb.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
663 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
664 # You can re-read the inputrc file with C-x C-r.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
665 # Lines beginning with '#' are comments.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
666 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
667 # First, include any systemwide bindings and variable assignments from
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
668 # /etc/Inputrc
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
669 $include /etc/Inputrc
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
670
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
671 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
672 # Set various bindings for emacs mode.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
673
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
674 set editing-mode emacs
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
675
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
676 $if mode=emacs
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
677
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
678 Meta-Control-h: backward-kill-word Text after the function name is ignored
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
679
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
680 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
681 # Arrow keys in keypad mode
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
682 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
683 #"\M-OD": backward-char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
684 #"\M-OC": forward-char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
685 #"\M-OA": previous-history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
686 #"\M-OB": next-history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
687 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
688 # Arrow keys in ANSI mode
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
689 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
690 "\M-[D": backward-char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
691 "\M-[C": forward-char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
692 "\M-[A": previous-history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
693 "\M-[B": next-history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
694 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
695 # Arrow keys in 8 bit keypad mode
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
696 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
697 #"\M-\C-OD": backward-char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
698 #"\M-\C-OC": forward-char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
699 #"\M-\C-OA": previous-history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
700 #"\M-\C-OB": next-history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
701 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
702 # Arrow keys in 8 bit ANSI mode
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
703 #
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
704 #"\M-\C-[D": backward-char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
705 #"\M-\C-[C": forward-char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
706 #"\M-\C-[A": previous-history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
707 #"\M-\C-[B": next-history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
708
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
709 C-q: quoted-insert
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
710
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
711 $endif
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
712
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
713 # An old-style binding. This happens to be the default.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
714 TAB: complete
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
715
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
716 # Macros that are convenient for shell interaction
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
717 $if Bash
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
718 # edit the path
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
719 "\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
720 # prepare to type a quoted word -- insert open and close double quotes
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
721 # and move to just after the open quote
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
722 "\C-x\"": "\"\"\C-b"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
723 # insert a backslash (testing backslash escapes in sequences and macros)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
724 "\C-x\\": "\\"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
725 # Quote the current or previous word
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
726 "\C-xq": "\eb\"\ef\""
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
727 # Add a binding to refresh the line, which is unbound
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
728 "\C-xr": redraw-current-line
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
729 # Edit variable on current line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
730 "\M-\C-v": "\C-a\C-k$\C-y\M-\C-e\C-a\C-y="
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
731 $endif
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
732
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
733 # use a visible bell if one is available
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
734 set bell-style visible
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
735
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
736 # don't strip characters to 7 bits when reading
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
737 set input-meta on
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
738
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
739 # allow iso-latin1 characters to be inserted rather than converted to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
740 # prefix-meta sequences
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
741 set convert-meta off
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
742
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
743 # display characters with the eighth bit set directly rather than
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
744 # as meta-prefixed characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
745 set output-meta on
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
746
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
747 # if there are more than 150 possible completions for a word, ask the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
748 # user if he wants to see all of them
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
749 set completion-query-items 150
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
750
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
751 # For FTP
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
752 $if Ftp
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
753 "\C-xg": "get \M-?"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
754 "\C-xt": "put \M-?"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
755 "\M-.": yank-last-arg
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
756 $endif
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
757
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
758 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
759 File: readline.info, Node: Bindable Readline Commands, Next: Readline vi Mode, Prev: Readline Init File, Up: Command Line Editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
760
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
761 Bindable Readline Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
762 ==========================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
763
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
764 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
765
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
766 * Commands For Moving:: Moving about the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
767 * Commands For History:: Getting at previous lines.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
768 * Commands For Text:: Commands for changing text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
769 * Commands For Killing:: Commands for killing and yanking.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
770 * Numeric Arguments:: Specifying numeric arguments, repeat counts.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
771 * Commands For Completion:: Getting Readline to do the typing for you.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
772 * Keyboard Macros:: Saving and re-executing typed characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
773 * Miscellaneous Commands:: Other miscellaneous commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
774
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
775 This section describes Readline commands that may be bound to key
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
776 sequences.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
777
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
778 Command names without an accompanying key sequence are unbound by
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
779 default. In the following descriptions, "point" refers to the current
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
780 cursor position, and "mark" refers to a cursor position saved by the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
781 `set-mark' command. The text between the point and mark is referred to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
782 as the "region".
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
783
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
784 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
785 File: readline.info, Node: Commands For Moving, Next: Commands For History, Up: Bindable Readline Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
786
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
787 Commands For Moving
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
788 -------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
789
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
790 `beginning-of-line (C-a)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
791 Move to the start of the current line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
792
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
793 `end-of-line (C-e)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
794 Move to the end of the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
795
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
796 `forward-char (C-f)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
797 Move forward a character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
798
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
799 `backward-char (C-b)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
800 Move back a character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
801
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
802 `forward-word (M-f)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
803 Move forward to the end of the next word. Words are composed of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
804 letters and digits.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
805
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
806 `backward-word (M-b)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
807 Move back to the start of the current or previous word. Words are
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
808 composed of letters and digits.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
809
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
810 `clear-screen (C-l)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
811 Clear the screen and redraw the current line, leaving the current
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
812 line at the top of the screen.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
813
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
814 `redraw-current-line ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
815 Refresh the current line. By default, this is unbound.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
816
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
817 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
818 File: readline.info, Node: Commands For History, Next: Commands For Text, Prev: Commands For Moving, Up: Bindable Readline Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
819
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
820 Commands For Manipulating The History
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
821 -------------------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
822
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
823 `accept-line (Newline or Return)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
824 Accept the line regardless of where the cursor is. If this line is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
825 non-empty, it may be added to the history list for future recall
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
826 with `add_history()'. If this line is a modified history line,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
827 then restore the history line to its original state.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
828
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
829 `previous-history (C-p)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
830 Move `up' through the history list.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
831
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
832 `next-history (C-n)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
833 Move `down' through the history list.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
834
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
835 `beginning-of-history (M-<)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
836 Move to the first line in the history.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
837
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
838 `end-of-history (M->)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
839 Move to the end of the input history, i.e., the line currently
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
840 being entered.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
841
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
842 `reverse-search-history (C-r)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
843 Search backward starting at the current line and moving `up'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
844 through the history as necessary. This is an incremental search.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
845
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
846 `forward-search-history (C-s)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
847 Search forward starting at the current line and moving `down'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
848 through the the history as necessary. This is an incremental
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
849 search.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
850
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
851 `non-incremental-reverse-search-history (M-p)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
852 Search backward starting at the current line and moving `up'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
853 through the history as necessary using a non-incremental search
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
854 for a string supplied by the user.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
855
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
856 `non-incremental-forward-search-history (M-n)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
857 Search forward starting at the current line and moving `down'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
858 through the the history as necessary using a non-incremental search
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
859 for a string supplied by the user.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
860
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
861 `history-search-forward ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
862 Search forward through the history for the string of characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
863 between the start of the current line and the point. This is a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
864 non-incremental search. By default, this command is unbound.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
865
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
866 `history-search-backward ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
867 Search backward through the history for the string of characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
868 between the start of the current line and the point. This is a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
869 non-incremental search. By default, this command is unbound.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
870
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
871 `yank-nth-arg (M-C-y)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
872 Insert the first argument to the previous command (usually the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
873 second word on the previous line). With an argument N, insert the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
874 Nth word from the previous command (the words in the previous
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
875 command begin with word 0). A negative argument inserts the Nth
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
876 word from the end of the previous command.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
877
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
878 `yank-last-arg (M-. or M-_)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
879 Insert last argument to the previous command (the last word of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
880 previous history entry). With an argument, behave exactly like
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
881 `yank-nth-arg'. Successive calls to `yank-last-arg' move back
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
882 through the history list, inserting the last argument of each line
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
883 in turn.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
884
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
885 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
886 File: readline.info, Node: Commands For Text, Next: Commands For Killing, Prev: Commands For History, Up: Bindable Readline Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
887
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
888 Commands For Changing Text
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
889 --------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
890
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
891 `delete-char (C-d)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
892 Delete the character under the cursor. If the cursor is at the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
893 beginning of the line, there are no characters in the line, and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
894 the last character typed was not bound to `delete-char', then
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
895 return EOF.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
896
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
897 `backward-delete-char (Rubout)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
898 Delete the character behind the cursor. A numeric argument means
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
899 to kill the characters instead of deleting them.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
900
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
901 `forward-backward-delete-char ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
902 Delete the character under the cursor, unless the cursor is at the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
903 end of the line, in which case the character behind the cursor is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
904 deleted. By default, this is not bound to a key.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
905
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
906 `quoted-insert (C-q or C-v)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
907 Add the next character typed to the line verbatim. This is how to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
908 insert key sequences like `C-q', for example.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
909
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
910 `tab-insert (M-<TAB>)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
911 Insert a tab character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
912
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
913 `self-insert (a, b, A, 1, !, ...)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
914 Insert yourself.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
915
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
916 `transpose-chars (C-t)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
917 Drag the character before the cursor forward over the character at
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
918 the cursor, moving the cursor forward as well. If the insertion
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
919 point is at the end of the line, then this transposes the last two
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
920 characters of the line. Negative arguments have no effect.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
921
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
922 `transpose-words (M-t)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
923 Drag the word before point past the word after point, moving point
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
924 past that word as well.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
925
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
926 `upcase-word (M-u)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
927 Uppercase the current (or following) word. With a negative
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
928 argument, uppercase the previous word, but do not move the cursor.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
929
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
930 `downcase-word (M-l)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
931 Lowercase the current (or following) word. With a negative
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
932 argument, lowercase the previous word, but do not move the cursor.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
933
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
934 `capitalize-word (M-c)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
935 Capitalize the current (or following) word. With a negative
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
936 argument, capitalize the previous word, but do not move the cursor.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
937
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
938 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
939 File: readline.info, Node: Commands For Killing, Next: Numeric Arguments, Prev: Commands For Text, Up: Bindable Readline Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
940
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
941 Killing And Yanking
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
942 -------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
943
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
944 `kill-line (C-k)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
945 Kill the text from point to the end of the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
946
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
947 `backward-kill-line (C-x Rubout)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
948 Kill backward to the beginning of the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
949
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
950 `unix-line-discard (C-u)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
951 Kill backward from the cursor to the beginning of the current line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
952
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
953 `kill-whole-line ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
954 Kill all characters on the current line, no matter point is. By
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
955 default, this is unbound.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
956
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
957 `kill-word (M-d)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
958 Kill from point to the end of the current word, or if between
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
959 words, to the end of the next word. Word boundaries are the same
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
960 as `forward-word'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
961
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
962 `backward-kill-word (M-<DEL>)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
963 Kill the word behind point. Word boundaries are the same as
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
964 `backward-word'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
965
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
966 `unix-word-rubout (C-w)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
967 Kill the word behind point, using white space as a word boundary.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
968 The killed text is saved on the kill-ring.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
969
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
970 `delete-horizontal-space ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
971 Delete all spaces and tabs around point. By default, this is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
972 unbound.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
973
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
974 `kill-region ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
975 Kill the text in the current region. By default, this command is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
976 unbound.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
977
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
978 `copy-region-as-kill ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
979 Copy the text in the region to the kill buffer, so it can be yanked
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
980 right away. By default, this command is unbound.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
981
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
982 `copy-backward-word ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
983 Copy the word before point to the kill buffer. The word
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
984 boundaries are the same as `backward-word'. By default, this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
985 command is unbound.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
986
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
987 `copy-forward-word ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
988 Copy the word following point to the kill buffer. The word
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
989 boundaries are the same as `forward-word'. By default, this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
990 command is unbound.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
991
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
992 `yank (C-y)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
993 Yank the top of the kill ring into the buffer at the current
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
994 cursor position.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
995
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
996 `yank-pop (M-y)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
997 Rotate the kill-ring, and yank the new top. You can only do this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
998 if the prior command is `yank' or `yank-pop'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
999
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1000 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1001 File: readline.info, Node: Numeric Arguments, Next: Commands For Completion, Prev: Commands For Killing, Up: Bindable Readline Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1002
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1003 Specifying Numeric Arguments
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1004 ----------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1005
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1006 `digit-argument (M-0, M-1, ... M--)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1007 Add this digit to the argument already accumulating, or start a new
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1008 argument. `M--' starts a negative argument.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1009
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1010 `universal-argument ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1011 This is another way to specify an argument. If this command is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1012 followed by one or more digits, optionally with a leading minus
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1013 sign, those digits define the argument. If the command is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1014 followed by digits, executing `universal-argument' again ends the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1015 numeric argument, but is otherwise ignored. As a special case, if
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1016 this command is immediately followed by a character that is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1017 neither a digit or minus sign, the argument count for the next
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1018 command is multiplied by four. The argument count is initially
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1019 one, so executing this function the first time makes the argument
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1020 count four, a second time makes the argument count sixteen, and so
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1021 on. By default, this is not bound to a key.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1022
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1023 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1024 File: readline.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1025
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1026 Letting Readline Type For You
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1027 -----------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1028
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1029 `complete (<TAB>)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1030 Attempt to perform completion on the text before point. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1031 actual completion performed is application-specific. The default
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1032 is filename completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1033
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1034 `possible-completions (M-?)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1035 List the possible completions of the text before the cursor.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1036
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1037 `insert-completions (M-*)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1038 Insert all completions of the text before point that would have
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1039 been generated by `possible-completions'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1040
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1041 `menu-complete ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1042 Similar to `complete', but replaces the word to be completed with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1043 a single match from the list of possible completions. Repeated
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1044 execution of `menu-complete' steps through the list of possible
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1045 completions, inserting each match in turn. At the end of the list
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1046 of completions, the bell is rung and the original text is restored.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1047 An argument of N moves N positions forward in the list of matches;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1048 a negative argument may be used to move backward through the list.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1049 This command is intended to be bound to <TAB>, but is unbound by
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1050 default.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1051
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1052 `delete-char-or-list ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1053 Deletes the character under the cursor if not at the beginning or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1054 end of the line (like `delete-char'). If at the end of the line,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1055 behaves identically to `possible-completions'. This command is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1056 unbound by default.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1057
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1058 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1059 File: readline.info, Node: Keyboard Macros, Next: Miscellaneous Commands, Prev: Commands For Completion, Up: Bindable Readline Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1060
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1061 Keyboard Macros
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1062 ---------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1063
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1064 `start-kbd-macro (C-x ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1065 Begin saving the characters typed into the current keyboard macro.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1066
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1067 `end-kbd-macro (C-x ))'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1068 Stop saving the characters typed into the current keyboard macro
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1069 and save the definition.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1070
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1071 `call-last-kbd-macro (C-x e)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1072 Re-execute the last keyboard macro defined, by making the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1073 characters in the macro appear as if typed at the keyboard.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1074
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1075 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1076 File: readline.info, Node: Miscellaneous Commands, Prev: Keyboard Macros, Up: Bindable Readline Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1077
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1078 Some Miscellaneous Commands
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1079 ---------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1080
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1081 `re-read-init-file (C-x C-r)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1082 Read in the contents of the INPUTRC file, and incorporate any
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1083 bindings or variable assignments found there.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1084
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1085 `abort (C-g)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1086 Abort the current editing command and ring the terminal's bell
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1087 (subject to the setting of `bell-style').
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1088
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1089 `do-uppercase-version (M-a, M-b, M-X, ...)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1090 If the metafied character X is lowercase, run the command that is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1091 bound to the corresponding uppercase character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1092
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1093 `prefix-meta (<ESC>)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1094 Make the next character typed be metafied. This is for keyboards
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1095 without a meta key. Typing `<ESC> f' is equivalent to typing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1096 `M-f'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1097
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1098 `undo (C-_ or C-x C-u)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1099 Incremental undo, separately remembered for each line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1100
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1101 `revert-line (M-r)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1102 Undo all changes made to this line. This is like executing the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1103 `undo' command enough times to get back to the beginning.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1104
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1105 `tilde-expand (M-~)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1106 Perform tilde expansion on the current word.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1107
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1108 `set-mark (C-@)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1109 Set the mark to the current point. If a numeric argument is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1110 supplied, the mark is set to that position.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1111
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1112 `exchange-point-and-mark (C-x C-x)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1113 Swap the point with the mark. The current cursor position is set
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1114 to the saved position, and the old cursor position is saved as the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1115 mark.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1116
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1117 `character-search (C-])'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1118 A character is read and point is moved to the next occurrence of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1119 that character. A negative count searches for previous
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1120 occurrences.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1121
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1122 `character-search-backward (M-C-])'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1123 A character is read and point is moved to the previous occurrence
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1124 of that character. A negative count searches for subsequent
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1125 occurrences.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1126
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1127 `insert-comment (M-#)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1128 The value of the `comment-begin' variable is inserted at the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1129 beginning of the current line, and the line is accepted as if a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1130 newline had been typed.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1131
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1132 `dump-functions ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1133 Print all of the functions and their key bindings to the Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1134 output stream. If a numeric argument is supplied, the output is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1135 formatted in such a way that it can be made part of an INPUTRC
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1136 file. This command is unbound by default.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1137
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1138 `dump-variables ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1139 Print all of the settable variables and their values to the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1140 Readline output stream. If a numeric argument is supplied, the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1141 output is formatted in such a way that it can be made part of an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1142 INPUTRC file. This command is unbound by default.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1143
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1144 `dump-macros ()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1145 Print all of the Readline key sequences bound to macros and the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1146 strings they output. If a numeric argument is supplied, the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1147 output is formatted in such a way that it can be made part of an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1148 INPUTRC file. This command is unbound by default.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1149
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1150 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1151 File: readline.info, Node: Readline vi Mode, Prev: Bindable Readline Commands, Up: Command Line Editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1152
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1153 Readline vi Mode
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1154 ================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1155
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1156 While the Readline library does not have a full set of `vi' editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1157 functions, it does contain enough to allow simple editing of the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1158 The Readline `vi' mode behaves as specified in the POSIX 1003.2
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1159 standard.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1160
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1161 In order to switch interactively between `emacs' and `vi' editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1162 modes, use the command `M-C-j' (toggle-editing-mode). The Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1163 default is `emacs' mode.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1164
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1165 When you enter a line in `vi' mode, you are already placed in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1166 `insertion' mode, as if you had typed an `i'. Pressing <ESC> switches
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1167 you into `command' mode, where you can edit the text of the line with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1168 the standard `vi' movement keys, move to previous history lines with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1169 `k' and subsequent lines with `j', and so forth.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1170
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1171 This document describes the GNU Readline Library, a utility for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1172 aiding in the consitency of user interface across discrete programs
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1173 that need to provide a command line interface.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1174
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1175 Copyright (C) 1988-2001 Free Software Foundation, Inc.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1176
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1177 Permission is granted to make and distribute verbatim copies of this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1178 manual provided the copyright notice and this permission notice pare
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1179 preserved on all copies.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1180
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1181 Permission is granted to copy and distribute modified versions of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1182 this manual under the conditions for verbatim copying, provided that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1183 the entire resulting derived work is distributed under the terms of a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1184 permission notice identical to this one.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1185
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1186 Permission is granted to copy and distribute translations of this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1187 manual into another language, under the above conditions for modified
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1188 versions, except that this permission notice may be stated in a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1189 translation approved by the Foundation.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1190
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1191 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1192 File: readline.info, Node: Programming with GNU Readline, Next: Concept Index, Prev: Command Line Editing, Up: Top
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1193
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1194 Programming with GNU Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1195 *****************************
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1196
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1197 This chapter describes the interface between the GNU Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1198 Library and other programs. If you are a programmer, and you wish to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1199 include the features found in GNU Readline such as completion, line
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1200 editing, and interactive history manipulation in your own programs,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1201 this section is for you.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1202
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1203 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1204
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1205 * Basic Behavior:: Using the default behavior of Readline.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1206 * Custom Functions:: Adding your own functions to Readline.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1207 * Readline Variables:: Variables accessible to custom
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1208 functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1209 * Readline Convenience Functions:: Functions which Readline supplies to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1210 aid in writing your own custom
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1211 functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1212 * Readline Signal Handling:: How Readline behaves when it receives signals.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1213 * Custom Completers:: Supplanting or supplementing Readline's
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1214 completion functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1215
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1216 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1217 File: readline.info, Node: Basic Behavior, Next: Custom Functions, Up: Programming with GNU Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1218
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1219 Basic Behavior
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1220 ==============
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1221
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1222 Many programs provide a command line interface, such as `mail',
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1223 `ftp', and `sh'. For such programs, the default behaviour of Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1224 is sufficient. This section describes how to use Readline in the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1225 simplest way possible, perhaps to replace calls in your code to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1226 `gets()' or `fgets()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1227
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1228 `char *readline (const char *PROMPT);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1229
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1230 The function `readline()' prints a prompt PROMPT and then reads and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1231 returns a single line of text from the user. If PROMPT is `NULL' or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1232 the empty string, no prompt is displayed. The line `readline' returns
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1233 is allocated with `malloc()'; the caller should `free()' the line when
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1234 it has finished with it. The declaration for `readline' in ANSI C is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1235
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1236 So, one might say
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1237 `char *line = readline ("Enter a line: ");'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1238
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1239 in order to read a line of text from the user. The line returned has
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1240 the final newline removed, so only the text remains.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1241
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1242 If `readline' encounters an `EOF' while reading the line, and the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1243 line is empty at that point, then `(char *)NULL' is returned.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1244 Otherwise, the line is ended just as if a newline had been typed.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1245
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1246 If you want the user to be able to get at the line later, (with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1247 <C-p> for example), you must call `add_history()' to save the line away
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1248 in a "history" list of such lines.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1249
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1250 `add_history (line)';
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1251
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1252 For full details on the GNU History Library, see the associated manual.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1253
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1254 It is preferable to avoid saving empty lines on the history list,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1255 since users rarely have a burning need to reuse a blank line. Here is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1256 a function which usefully replaces the standard `gets()' library
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1257 function, and has the advantage of no static buffer to overflow:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1258
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1259 /* A static variable for holding the line. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1260 static char *line_read = (char *)NULL;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1261
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1262 /* Read a string, and return a pointer to it. Returns NULL on EOF. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1263 char *
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1264 rl_gets ()
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1265 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1266 /* If the buffer has already been allocated, return the memory
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1267 to the free pool. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1268 if (line_read)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1269 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1270 free (line_read);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1271 line_read = (char *)NULL;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1272 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1273
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1274 /* Get a line from the user. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1275 line_read = readline ("");
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1276
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1277 /* If the line has any text in it, save it on the history. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1278 if (line_read && *line_read)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1279 add_history (line_read);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1280
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1281 return (line_read);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1282 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1283
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1284 This function gives the user the default behaviour of <TAB>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1285 completion: completion on file names. If you do not want Readline to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1286 complete on filenames, you can change the binding of the <TAB> key with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1287 `rl_bind_key()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1288
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1289 `int rl_bind_key (int KEY, rl_command_func_t *FUNCTION);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1290
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1291 `rl_bind_key()' takes two arguments: KEY is the character that you
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1292 want to bind, and FUNCTION is the address of the function to call when
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1293 KEY is pressed. Binding <TAB> to `rl_insert()' makes <TAB> insert
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1294 itself. `rl_bind_key()' returns non-zero if KEY is not a valid ASCII
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1295 character code (between 0 and 255).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1296
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1297 Thus, to disable the default <TAB> behavior, the following suffices:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1298 `rl_bind_key ('\t', rl_insert);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1299
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1300 This code should be executed once at the start of your program; you
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1301 might write a function called `initialize_readline()' which performs
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1302 this and other desired initializations, such as installing custom
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1303 completers (*note Custom Completers::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1304
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1305 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1306 File: readline.info, Node: Custom Functions, Next: Readline Variables, Prev: Basic Behavior, Up: Programming with GNU Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1307
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1308 Custom Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1309 ================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1310
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1311 Readline provides many functions for manipulating the text of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1312 line, but it isn't possible to anticipate the needs of all programs.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1313 This section describes the various functions and variables defined
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1314 within the Readline library which allow a user program to add
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1315 customized functionality to Readline.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1316
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1317 Before declaring any functions that customize Readline's behavior, or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1318 using any functionality Readline provides in other code, an application
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1319 writer should include the file `<readline/readline.h>' in any file that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1320 uses Readline's features. Since some of the definitions in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1321 `readline.h' use the `stdio' library, the file `<stdio.h>' should be
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1322 included before `readline.h'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1323
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1324 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1325
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1326 * Readline Typedefs:: C declarations to make code readable.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1327 * Function Writing:: Variables and calling conventions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1328
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1329 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1330 File: readline.info, Node: Readline Typedefs, Next: Function Writing, Up: Custom Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1331
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1332 Readline Typedefs
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1333 -----------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1334
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1335 For readabilty, we declare a number of new object types, all pointers
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1336 to functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1337
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1338 The reason for declaring these new types is to make it easier to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1339 write code describing pointers to C functions with appropriately
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1340 prototyped arguments and return values.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1341
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1342 For instance, say we want to declare a variable FUNC as a pointer to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1343 a function which takes two `int' arguments and returns an `int' (this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1344 is the type of all of the Readline bindable functions). Instead of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1345 classic C declaration
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1346
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1347 `int (*func)();'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1348
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1349 or the ANSI-C style declaration
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1350
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1351 `int (*func)(int, int);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1352
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1353 we may write
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1354
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1355 `rl_command_func_t *func;'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1356
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1357 The full list of function pointer types available is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1358
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1359 `typedef int rl_command_func_t (int, int);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1360
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1361 `typedef char *rl_compentry_func_t (const char *, int);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1362
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1363 `typedef char **rl_completion_func_t (const char *, int, int);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1364
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1365 `typedef char *rl_quote_func_t (char *, int, char *);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1366
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1367 `typedef char *rl_dequote_func_t (char *, int);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1368
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1369 `typedef int rl_compignore_func_t (char **);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1370
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1371 `typedef void rl_compdisp_func_t (char **, int, int);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1372
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1373 `typedef int rl_hook_func_t (void);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1374
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1375 `typedef int rl_getc_func_t (FILE *);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1376
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1377 `typedef int rl_linebuf_func_t (char *, int);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1378
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1379 `typedef int rl_intfunc_t (int);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1380
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1381 `#define rl_ivoidfunc_t rl_hook_func_t'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1382
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1383 `typedef int rl_icpfunc_t (char *);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1384
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1385 `typedef int rl_icppfunc_t (char **);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1386
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1387 `typedef void rl_voidfunc_t (void);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1388
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1389 `typedef void rl_vintfunc_t (int);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1390
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1391 `typedef void rl_vcpfunc_t (char *);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1392
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1393 `typedef void rl_vcppfunc_t (char **);'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1394 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1395 File: readline.info, Node: Function Writing, Prev: Readline Typedefs, Up: Custom Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1396
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1397 Writing a New Function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1398 ----------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1399
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1400 In order to write new functions for Readline, you need to know the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1401 calling conventions for keyboard-invoked functions, and the names of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1402 variables that describe the current state of the line read so far.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1403
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1404 The calling sequence for a command `foo' looks like
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1405
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1406 `foo (int count, int key)'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1407
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1408 where COUNT is the numeric argument (or 1 if defaulted) and KEY is the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1409 key that invoked this function.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1410
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1411 It is completely up to the function as to what should be done with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1412 the numeric argument. Some functions use it as a repeat count, some as
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1413 a flag, and others to choose alternate behavior (refreshing the current
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1414 line as opposed to refreshing the screen, for example). Some choose to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1415 ignore it. In general, if a function uses the numeric argument as a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1416 repeat count, it should be able to do something useful with both
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1417 negative and positive arguments. At the very least, it should be aware
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1418 that it can be passed a negative argument.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1419
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1420 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1421 File: readline.info, Node: Readline Variables, Next: Readline Convenience Functions, Prev: Custom Functions, Up: Programming with GNU Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1422
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1423 Readline Variables
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1424 ==================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1425
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1426 These variables are available to function writers.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1427
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1428 - Variable: char * rl_line_buffer
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1429 This is the line gathered so far. You are welcome to modify the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1430 contents of the line, but see *Note Allowing Undoing::. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1431 function `rl_extend_line_buffer' is available to increase the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1432 memory allocated to `rl_line_buffer'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1433
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1434 - Variable: int rl_point
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1435 The offset of the current cursor position in `rl_line_buffer' (the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1436 _point_).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1437
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1438 - Variable: int rl_end
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1439 The number of characters present in `rl_line_buffer'. When
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1440 `rl_point' is at the end of the line, `rl_point' and `rl_end' are
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1441 equal.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1442
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1443 - Variable: int rl_mark
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1444 The MARK (saved position) in the current line. If set, the mark
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1445 and point define a _region_.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1446
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1447 - Variable: int rl_done
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1448 Setting this to a non-zero value causes Readline to return the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1449 current line immediately.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1450
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1451 - Variable: int rl_num_chars_to_read
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1452 Setting this to a positive value before calling `readline()' causes
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1453 Readline to return after accepting that many characters, rather
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1454 than reading up to a character bound to `accept-line'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1455
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1456 - Variable: int rl_pending_input
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1457 Setting this to a value makes it the next keystroke read. This is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1458 a way to stuff a single character into the input stream.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1459
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1460 - Variable: int rl_dispatching
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1461 Set to a non-zero value if a function is being called from a key
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1462 binding; zero otherwise. Application functions can test this to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1463 discover whether they were called directly or by Readline's
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1464 dispatching mechanism.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1465
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1466 - Variable: int rl_erase_empty_line
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1467 Setting this to a non-zero value causes Readline to completely
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1468 erase the current line, including any prompt, any time a newline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1469 is typed as the only character on an otherwise-empty line. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1470 cursor is moved to the beginning of the newly-blank line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1471
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1472 - Variable: char * rl_prompt
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1473 The prompt Readline uses. This is set from the argument to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1474 `readline()', and should not be assigned to directly.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1475
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1476 - Variable: int rl_already_prompted
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1477 If an application wishes to display the prompt itself, rather than
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1478 have Readline do it the first time `readline()' is called, it
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1479 should set this variable to a non-zero value after displaying the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1480 prompt. The prompt must also be passed as the argument to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1481 `readline()' so the redisplay functions can update the display
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1482 properly. The calling application is responsible for managing the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1483 value; Readline never sets it.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1484
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1485 - Variable: const char * rl_library_version
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1486 The version number of this revision of the library.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1487
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1488 - Variable: int rl_gnu_readline_p
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1489 Always set to 1, denoting that this is GNU readline rather than
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1490 some emulation.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1491
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1492 - Variable: const char * rl_terminal_name
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1493 The terminal type, used for initialization. If not set by the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1494 application, Readline sets this to the value of the `TERM'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1495 environment variable the first time it is called.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1496
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1497 - Variable: const char * rl_readline_name
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1498 This variable is set to a unique name by each application using
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1499 Readline. The value allows conditional parsing of the inputrc file
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1500 (*note Conditional Init Constructs::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1501
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1502 - Variable: FILE * rl_instream
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1503 The stdio stream from which Readline reads input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1504
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1505 - Variable: FILE * rl_outstream
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1506 The stdio stream to which Readline performs output.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1507
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1508 - Variable: rl_command_func_t * rl_last_func
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1509 The address of the last command function Readline executed. May
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1510 be used to test whether or not a function is being executed twice
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1511 in succession, for example.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1512
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1513 - Variable: rl_hook_func_t * rl_startup_hook
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1514 If non-zero, this is the address of a function to call just before
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1515 `readline' prints the first prompt.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1516
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1517 - Variable: rl_hook_func_t * rl_pre_input_hook
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1518 If non-zero, this is the address of a function to call after the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1519 first prompt has been printed and just before `readline' starts
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1520 reading input characters.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1521
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1522 - Variable: rl_hook_func_t * rl_event_hook
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1523 If non-zero, this is the address of a function to call periodically
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1524 when readline is waiting for terminal input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1525
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1526 - Variable: rl_getc_func_t * rl_getc_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1527 If non-zero, `readline' will call indirectly through this pointer
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1528 to get a character from the input stream. By default, it is set to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1529 `rl_getc', the default `readline' character input function (*note
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1530 Character Input::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1531
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1532 - Variable: rl_voidfunc_t * rl_redisplay_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1533 If non-zero, `readline' will call indirectly through this pointer
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1534 to update the display with the current contents of the editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1535 buffer. By default, it is set to `rl_redisplay', the default
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1536 `readline' redisplay function (*note Redisplay::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1537
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1538 - Variable: rl_vintfunc_t * rl_prep_term_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1539 If non-zero, `readline' will call indirectly through this pointer
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1540 to initialize the terminal. The function takes a single argument,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1541 an `int' flag that says whether or not to use eight-bit characters.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1542 By default, this is set to `rl_prep_terminal' (*note Terminal
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1543 Management::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1544
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1545 - Variable: rl_voidfunc_t * rl_deprep_term_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1546 If non-zero, `readline' will call indirectly through this pointer
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1547 to reset the terminal. This function should undo the effects of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1548 `rl_prep_term_function'. By default, this is set to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1549 `rl_deprep_terminal' (*note Terminal Management::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1550
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1551 - Variable: Keymap rl_executing_keymap
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1552 This variable is set to the keymap (*note Keymaps::) in which the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1553 currently executing readline function was found.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1554
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1555 - Variable: Keymap rl_binding_keymap
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1556 This variable is set to the keymap (*note Keymaps::) in which the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1557 last key binding occurred.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1558
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1559 - Variable: char * rl_executing_macro
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1560 This variable is set to the text of any currently-executing macro.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1561
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1562 - Variable: int rl_readline_state
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1563 A variable with bit values that encapsulate the current Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1564 state. A bit is set with the `RL_SETSTATE' macro, and unset with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1565 the `RL_UNSETSTATE' macro. Use the `RL_ISSTATE' macro to test
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1566 whether a particular state bit is set. Current state bits include:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1567
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1568 `RL_STATE_NONE'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1569 Readline has not yet been called, nor has it begun to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1570 intialize.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1571
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1572 `RL_STATE_INITIALIZING'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1573 Readline is initializing its internal data structures.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1574
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1575 `RL_STATE_INITIALIZED'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1576 Readline has completed its initialization.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1577
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1578 `RL_STATE_TERMPREPPED'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1579 Readline has modified the terminal modes to do its own input
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1580 and redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1581
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1582 `RL_STATE_READCMD'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1583 Readline is reading a command from the keyboard.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1584
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1585 `RL_STATE_METANEXT'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1586 Readline is reading more input after reading the meta-prefix
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1587 character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1588
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1589 `RL_STATE_DISPATCHING'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1590 Readline is dispatching to a command.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1591
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1592 `RL_STATE_MOREINPUT'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1593 Readline is reading more input while executing an editing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1594 command.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1595
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1596 `RL_STATE_ISEARCH'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1597 Readline is performing an incremental history search.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1598
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1599 `RL_STATE_NSEARCH'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1600 Readline is performing a non-incremental history search.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1601
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1602 `RL_STATE_SEARCH'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1603 Readline is searching backward or forward through the history
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1604 for a string.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1605
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1606 `RL_STATE_NUMERICARG'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1607 Readline is reading a numeric argument.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1608
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1609 `RL_STATE_MACROINPUT'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1610 Readline is currently getting its input from a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1611 previously-defined keyboard macro.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1612
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1613 `RL_STATE_MACRODEF'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1614 Readline is currently reading characters defining a keyboard
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1615 macro.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1616
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1617 `RL_STATE_OVERWRITE'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1618 Readline is in overwrite mode.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1619
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1620 `RL_STATE_COMPLETING'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1621 Readline is performing word completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1622
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1623 `RL_STATE_SIGHANDLER'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1624 Readline is currently executing the readline signal handler.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1625
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1626 `RL_STATE_UNDOING'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1627 Readline is performing an undo.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1628
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1629 `RL_STATE_DONE'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1630 Readline has read a key sequence bound to `accept-line' and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1631 is about to return the line to the caller.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1632
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1633
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1634 - Variable: int rl_explicit_arg
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1635 Set to a non-zero value if an explicit numeric argument was
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1636 specified by the user. Only valid in a bindable command function.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1637
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1638 - Variable: int rl_numeric_arg
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1639 Set to the value of any numeric argument explicitly specified by
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1640 the user before executing the current Readline function. Only
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1641 valid in a bindable command function.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1642
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1643 - Variable: int rl_editing_mode
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1644 Set to a value denoting Readline's current editing mode. A value
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1645 of EMACS_MODE means Readline is currently in emacs mode; VI_MODE
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1646 means that vi mode is active.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1647
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1648 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1649 File: readline.info, Node: Readline Convenience Functions, Next: Readline Signal Handling, Prev: Readline Variables, Up: Programming with GNU Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1650
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1651 Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1652 ==============================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1653
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1654 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1655
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1656 * Function Naming:: How to give a function you write a name.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1657 * Keymaps:: Making keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1658 * Binding Keys:: Changing Keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1659 * Associating Function Names and Bindings:: Translate function names to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1660 key sequences.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1661 * Allowing Undoing:: How to make your functions undoable.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1662 * Redisplay:: Functions to control line display.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1663 * Modifying Text:: Functions to modify `rl_line_buffer'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1664 * Character Input:: Functions to read keyboard input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1665 * Terminal Management:: Functions to manage terminal settings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1666 * Utility Functions:: Generally useful functions and hooks.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1667 * Alternate Interface:: Using Readline in a `callback' fashion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1668
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1669 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1670 File: readline.info, Node: Function Naming, Next: Keymaps, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1671
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1672 Naming a Function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1673 -----------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1674
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1675 The user can dynamically change the bindings of keys while using
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1676 Readline. This is done by representing the function with a descriptive
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1677 name. The user is able to type the descriptive name when referring to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1678 the function. Thus, in an init file, one might find
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1679
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1680 Meta-Rubout: backward-kill-word
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1681
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1682 This binds the keystroke <Meta-Rubout> to the function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1683 _descriptively_ named `backward-kill-word'. You, as the programmer,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1684 should bind the functions you write to descriptive names as well.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1685 Readline provides a function for doing that:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1686
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1687 - Function: int rl_add_defun (const char *name, rl_command_func_t
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1688 *function, int key)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1689 Add NAME to the list of named functions. Make FUNCTION be the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1690 function that gets called. If KEY is not -1, then bind it to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1691 FUNCTION using `rl_bind_key()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1692
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1693 Using this function alone is sufficient for most applications. It is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1694 the recommended way to add a few functions to the default functions that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1695 Readline has built in. If you need to do something other than adding a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1696 function to Readline, you may need to use the underlying functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1697 described below.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1698
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1699 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1700 File: readline.info, Node: Keymaps, Next: Binding Keys, Prev: Function Naming, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1701
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1702 Selecting a Keymap
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1703 ------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1704
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1705 Key bindings take place on a "keymap". The keymap is the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1706 association between the keys that the user types and the functions that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1707 get run. You can make your own keymaps, copy existing keymaps, and tell
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1708 Readline which keymap to use.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1709
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1710 - Function: Keymap rl_make_bare_keymap (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1711 Returns a new, empty keymap. The space for the keymap is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1712 allocated with `malloc()'; the caller should free it by calling
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1713 `rl_discard_keymap()' when done.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1714
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1715 - Function: Keymap rl_copy_keymap (Keymap map)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1716 Return a new keymap which is a copy of MAP.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1717
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1718 - Function: Keymap rl_make_keymap (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1719 Return a new keymap with the printing characters bound to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1720 rl_insert, the lowercase Meta characters bound to run their
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1721 equivalents, and the Meta digits bound to produce numeric
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1722 arguments.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1723
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1724 - Function: void rl_discard_keymap (Keymap keymap)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1725 Free the storage associated with KEYMAP.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1726
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1727 Readline has several internal keymaps. These functions allow you to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1728 change which keymap is active.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1729
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1730 - Function: Keymap rl_get_keymap (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1731 Returns the currently active keymap.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1732
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1733 - Function: void rl_set_keymap (Keymap keymap)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1734 Makes KEYMAP the currently active keymap.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1735
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1736 - Function: Keymap rl_get_keymap_by_name (const char *name)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1737 Return the keymap matching NAME. NAME is one which would be
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1738 supplied in a `set keymap' inputrc line (*note Readline Init
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1739 File::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1740
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1741 - Function: char * rl_get_keymap_name (Keymap keymap)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1742 Return the name matching KEYMAP. NAME is one which would be
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1743 supplied in a `set keymap' inputrc line (*note Readline Init
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1744 File::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1745
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1746 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1747 File: readline.info, Node: Binding Keys, Next: Associating Function Names and Bindings, Prev: Keymaps, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1748
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1749 Binding Keys
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1750 ------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1751
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1752 Key sequences are associate with functions through the keymap.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1753 Readline has several internal keymaps: `emacs_standard_keymap',
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1754 `emacs_meta_keymap', `emacs_ctlx_keymap', `vi_movement_keymap', and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1755 `vi_insertion_keymap'. `emacs_standard_keymap' is the default, and the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1756 examples in this manual assume that.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1757
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1758 Since `readline()' installs a set of default key bindings the first
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1759 time it is called, there is always the danger that a custom binding
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1760 installed before the first call to `readline()' will be overridden. An
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1761 alternate mechanism is to install custom key bindings in an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1762 initialization function assigned to the `rl_startup_hook' variable
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1763 (*note Readline Variables::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1764
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1765 These functions manage key bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1766
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1767 - Function: int rl_bind_key (int key, rl_command_func_t *function)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1768 Binds KEY to FUNCTION in the currently active keymap. Returns
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1769 non-zero in the case of an invalid KEY.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1770
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1771 - Function: int rl_bind_key_in_map (int key, rl_command_func_t
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1772 *function, Keymap map)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1773 Bind KEY to FUNCTION in MAP. Returns non-zero in the case of an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1774 invalid KEY.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1775
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1776 - Function: int rl_unbind_key (int key)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1777 Bind KEY to the null function in the currently active keymap.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1778 Returns non-zero in case of error.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1779
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1780 - Function: int rl_unbind_key_in_map (int key, Keymap map)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1781 Bind KEY to the null function in MAP. Returns non-zero in case of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1782 error.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1783
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1784 - Function: int rl_unbind_function_in_map (rl_command_func_t
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1785 *function, Keymap map)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1786 Unbind all keys that execute FUNCTION in MAP.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1787
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1788 - Function: int rl_unbind_command_in_map (const char *command, Keymap
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1789 map)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1790 Unbind all keys that are bound to COMMAND in MAP.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1791
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1792 - Function: int rl_set_key (const char *keyseq, rl_command_func_t
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1793 *function, Keymap map)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1794 Bind the key sequence represented by the string KEYSEQ to the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1795 function FUNCTION. This makes new keymaps as necessary. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1796 initial keymap in which to do bindings is MAP.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1797
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1798 - Function: int rl_generic_bind (int type, const char *keyseq, char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1799 *data, Keymap map)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1800 Bind the key sequence represented by the string KEYSEQ to the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1801 arbitrary pointer DATA. TYPE says what kind of data is pointed to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1802 by DATA; this can be a function (`ISFUNC'), a macro (`ISMACR'), or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1803 a keymap (`ISKMAP'). This makes new keymaps as necessary. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1804 initial keymap in which to do bindings is MAP.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1805
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1806 - Function: int rl_parse_and_bind (char *line)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1807 Parse LINE as if it had been read from the `inputrc' file and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1808 perform any key bindings and variable assignments found (*note
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1809 Readline Init File::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1810
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1811 - Function: int rl_read_init_file (const char *filename)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1812 Read keybindings and variable assignments from FILENAME (*note
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1813 Readline Init File::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1814
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1815 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1816 File: readline.info, Node: Associating Function Names and Bindings, Next: Allowing Undoing, Prev: Binding Keys, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1817
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1818 Associating Function Names and Bindings
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1819 ---------------------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1820
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1821 These functions allow you to find out what keys invoke named
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1822 functions and the functions invoked by a particular key sequence. You
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1823 may also associate a new function name with an arbitrary function.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1824
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1825 - Function: rl_command_func_t * rl_named_function (const char *name)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1826 Return the function with name NAME.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1827
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1828 - Function: rl_command_func_t * rl_function_of_keyseq (const char
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1829 *keyseq, Keymap map, int *type)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1830 Return the function invoked by KEYSEQ in keymap MAP. If MAP is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1831 `NULL', the current keymap is used. If TYPE is not `NULL', the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1832 type of the object is returned in the `int' variable it points to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1833 (one of `ISFUNC', `ISKMAP', or `ISMACR').
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1834
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1835 - Function: char ** rl_invoking_keyseqs (rl_command_func_t *function)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1836 Return an array of strings representing the key sequences used to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1837 invoke FUNCTION in the current keymap.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1838
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1839 - Function: char ** rl_invoking_keyseqs_in_map (rl_command_func_t
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1840 *function, Keymap map)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1841 Return an array of strings representing the key sequences used to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1842 invoke FUNCTION in the keymap MAP.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1843
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1844 - Function: void rl_function_dumper (int readable)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1845 Print the readline function names and the key sequences currently
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1846 bound to them to `rl_outstream'. If READABLE is non-zero, the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1847 list is formatted in such a way that it can be made part of an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1848 `inputrc' file and re-read.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1849
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1850 - Function: void rl_list_funmap_names (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1851 Print the names of all bindable Readline functions to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1852 `rl_outstream'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1853
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1854 - Function: const char ** rl_funmap_names (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1855 Return a NULL terminated array of known function names. The array
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1856 is sorted. The array itself is allocated, but not the strings
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1857 inside. You should `free()' the array when you are done, but not
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1858 the pointers.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1859
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1860 - Function: int rl_add_funmap_entry (const char *name,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1861 rl_command_func_t *function)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1862 Add NAME to the list of bindable Readline command names, and make
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1863 FUNCTION the function to be called when NAME is invoked.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1864
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1865 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1866 File: readline.info, Node: Allowing Undoing, Next: Redisplay, Prev: Associating Function Names and Bindings, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1867
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1868 Allowing Undoing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1869 ----------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1870
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1871 Supporting the undo command is a painless thing, and makes your
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1872 functions much more useful. It is certainly easy to try something if
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1873 you know you can undo it.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1874
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1875 If your function simply inserts text once, or deletes text once, and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1876 uses `rl_insert_text()' or `rl_delete_text()' to do it, then undoing is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1877 already done for you automatically.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1878
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1879 If you do multiple insertions or multiple deletions, or any
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1880 combination of these operations, you should group them together into
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1881 one operation. This is done with `rl_begin_undo_group()' and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1882 `rl_end_undo_group()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1883
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1884 The types of events that can be undone are:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1885
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1886 enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1887
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1888 Notice that `UNDO_DELETE' means to insert some text, and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1889 `UNDO_INSERT' means to delete some text. That is, the undo code tells
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1890 what to undo, not how to undo it. `UNDO_BEGIN' and `UNDO_END' are tags
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1891 added by `rl_begin_undo_group()' and `rl_end_undo_group()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1892
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1893 - Function: int rl_begin_undo_group (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1894 Begins saving undo information in a group construct. The undo
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1895 information usually comes from calls to `rl_insert_text()' and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1896 `rl_delete_text()', but could be the result of calls to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1897 `rl_add_undo()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1898
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1899 - Function: int rl_end_undo_group (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1900 Closes the current undo group started with `rl_begin_undo_group
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1901 ()'. There should be one call to `rl_end_undo_group()' for each
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1902 call to `rl_begin_undo_group()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1903
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1904 - Function: void rl_add_undo (enum undo_code what, int start, int end,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1905 char *text)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1906 Remember how to undo an event (according to WHAT). The affected
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1907 text runs from START to END, and encompasses TEXT.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1908
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1909 - Function: void rl_free_undo_list (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1910 Free the existing undo list.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1911
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1912 - Function: int rl_do_undo (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1913 Undo the first thing on the undo list. Returns `0' if there was
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1914 nothing to undo, non-zero if something was undone.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1915
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1916 Finally, if you neither insert nor delete text, but directly modify
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1917 the existing text (e.g., change its case), call `rl_modifying()' once,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1918 just before you modify the text. You must supply the indices of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1919 text range that you are going to modify.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1920
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1921 - Function: int rl_modifying (int start, int end)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1922 Tell Readline to save the text between START and END as a single
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1923 undo unit. It is assumed that you will subsequently modify that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1924 text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1925
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1926 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1927 File: readline.info, Node: Redisplay, Next: Modifying Text, Prev: Allowing Undoing, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1928
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1929 Redisplay
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1930 ---------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1931
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1932 - Function: void rl_redisplay (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1933 Change what's displayed on the screen to reflect the current
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1934 contents of `rl_line_buffer'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1935
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1936 - Function: int rl_forced_update_display (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1937 Force the line to be updated and redisplayed, whether or not
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1938 Readline thinks the screen display is correct.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1939
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1940 - Function: int rl_on_new_line (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1941 Tell the update functions that we have moved onto a new (empty)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1942 line, usually after ouputting a newline.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1943
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1944 - Function: int rl_on_new_line_with_prompt (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1945 Tell the update functions that we have moved onto a new line, with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1946 RL_PROMPT already displayed. This could be used by applications
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1947 that want to output the prompt string themselves, but still need
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1948 Readline to know the prompt string length for redisplay. It
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1949 should be used after setting RL_ALREADY_PROMPTED.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1950
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1951 - Function: int rl_reset_line_state (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1952 Reset the display state to a clean state and redisplay the current
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1953 line starting on a new line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1954
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1955 - Function: int rl_crlf (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1956 Move the cursor to the start of the next screen line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1957
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1958 - Function: int rl_message (const char *, ...)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1959 The arguments are a format string as would be supplied to `printf',
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1960 possibly containing conversion specifications such as `%d', and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1961 any additional arguments necessary to satisfy the conversion
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1962 specifications. The resulting string is displayed in the "echo
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1963 area". The echo area is also used to display numeric arguments
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1964 and search strings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1965
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1966 - Function: int rl_clear_message (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1967 Clear the message in the echo area.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1968
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1969 - Function: void rl_save_prompt (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1970 Save the local Readline prompt display state in preparation for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1971 displaying a new message in the message area with `rl_message()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1972
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1973 - Function: void rl_restore_prompt (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1974 Restore the local Readline prompt display state saved by the most
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1975 recent call to `rl_save_prompt'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1976
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1977 - Function: int rl_expand_prompt (char *prompt)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1978 Expand any special character sequences in PROMPT and set up the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1979 local Readline prompt redisplay variables. This function is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1980 called by `readline()'. It may also be called to expand the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1981 primary prompt if the `rl_on_new_line_with_prompt()' function or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1982 `rl_already_prompted' variable is used. It returns the number of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1983 visible characters on the last line of the (possibly multi-line)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1984 prompt.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1985
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1986 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1987 File: readline.info, Node: Modifying Text, Next: Character Input, Prev: Redisplay, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1988
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1989 Modifying Text
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1990 --------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1991
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1992 - Function: int rl_insert_text (const char *text)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1993 Insert TEXT into the line at the current cursor position.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1994
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1995 - Function: int rl_delete_text (int start, int end)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1996 Delete the text between START and END in the current line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1997
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1998 - Function: char * rl_copy_text (int start, int end)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
1999 Return a copy of the text between START and END in the current
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2000 line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2001
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2002 - Function: int rl_kill_text (int start, int end)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2003 Copy the text between START and END in the current line to the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2004 kill ring, appending or prepending to the last kill if the last
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2005 command was a kill command. The text is deleted. If START is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2006 less than END, the text is appended, otherwise prepended. If the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2007 last command was not a kill, a new kill ring slot is used.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2008
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2009 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2010 File: readline.info, Node: Character Input, Next: Terminal Management, Prev: Modifying Text, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2011
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2012 Character Input
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2013 ---------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2014
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2015 - Function: int rl_read_key (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2016 Return the next character available from Readline's current input
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2017 stream. This handles input inserted into the input stream via
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2018 RL_PENDING_INPUT (*note Readline Variables::) and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2019 `rl_stuff_char()', macros, and characters read from the keyboard.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2020
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2021 - Function: int rl_getc (FILE *stream)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2022 Return the next character available from STREAM, which is assumed
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2023 to be the keyboard.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2024
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2025 - Function: int rl_stuff_char (int c)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2026 Insert C into the Readline input stream. It will be "read" before
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2027 Readline attempts to read characters from the terminal with
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2028 `rl_read_key()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2029
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2030 - Function: int rl_execute_next (int c)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2031 Make C be the next command to be executed when `rl_read_key()' is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2032 called. This sets RL_PENDING_INPUT.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2033
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2034 - Function: int rl_clear_pending_input (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2035 Unet RL_PENDING_INPUT, effectively negating the effect of any
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2036 previous call to `rl_execute_next()'. This works only if the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2037 pending input has not already been read with `rl_read_key()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2038
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2039 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2040 File: readline.info, Node: Terminal Management, Next: Utility Functions, Prev: Character Input, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2041
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2042 Terminal Management
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2043 -------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2044
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2045 - Function: int rl_prep_terminal (int meta_flag)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2046 Modify the terminal settings for Readline's use, so `readline()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2047 can read a single character at a time from the keyboard. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2048 META_FLAG argument should be non-zero if Readline should read
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2049 eight-bit input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2050
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2051 - Function: in rl_deprep_terminal (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2052 Undo the effects of `rl_prep_terminal()', leaving the terminal in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2053 the state in which it was before the most recent call to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2054 `rl_prep_terminal()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2055
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2056 - Function: void rl_tty_set_default_bindings (Keymap kmap)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2057 Read the operating system's terminal editing characters (as would
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2058 be displayed by `stty' to their readline equivalents. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2059 bindings are performed in KMAP.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2060
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2061 - Function: int rl_reset_terminal (const char *terminal_name)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2062 Reinitialize Readline's idea of the terminal settings using
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2063 TERMINAL_NAME as the terminal type (e.g., `vt100'). If
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2064 TERMINAL_NAME is NULL, the value of the `TERM' environment
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2065 variable is used.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2066
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2067 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2068 File: readline.info, Node: Utility Functions, Next: Alternate Interface, Prev: Terminal Management, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2069
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2070 Utility Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2071 -----------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2072
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2073 - Function: int rl_extend_line_buffer (int len)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2074 Ensure that `rl_line_buffer' has enough space to hold LEN
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2075 characters, possibly reallocating it if necessary.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2076
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2077 - Function: int rl_initialize (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2078 Initialize or re-initialize Readline's internal state. It's not
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2079 strictly necessary to call this; `readline()' calls it before
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2080 reading any input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2081
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2082 - Function: int rl_ding (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2083 Ring the terminal bell, obeying the setting of `bell-style'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2084
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2085 - Function: int rl_alphabetic (int c)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2086 Return 1 if C is an alphabetic character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2087
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2088 - Function: void rl_display_match_list (char **matches, int len, int
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2089 max)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2090 A convenience function for displaying a list of strings in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2091 columnar format on Readline's output stream. `matches' is the list
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2092 of strings, in argv format, such as a list of completion matches.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2093 `len' is the number of strings in `matches', and `max' is the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2094 length of the longest string in `matches'. This function uses the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2095 setting of `print-completions-horizontally' to select how the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2096 matches are displayed (*note Readline Init File Syntax::).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2097
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2098 The following are implemented as macros, defined in `chardefs.h'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2099 Applications should refrain from using them.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2100
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2101 - Function: int _rl_uppercase_p (int c)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2102 Return 1 if C is an uppercase alphabetic character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2103
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2104 - Function: int _rl_lowercase_p (int c)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2105 Return 1 if C is a lowercase alphabetic character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2106
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2107 - Function: int _rl_digit_p (int c)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2108 Return 1 if C is a numeric character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2109
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2110 - Function: int _rl_to_upper (int c)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2111 If C is a lowercase alphabetic character, return the corresponding
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2112 uppercase character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2113
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2114 - Function: int _rl_to_lower (int c)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2115 If C is an uppercase alphabetic character, return the corresponding
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2116 lowercase character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2117
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2118 - Function: int _rl_digit_value (int c)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2119 If C is a number, return the value it represents.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2120
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2121 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2122 File: readline.info, Node: Alternate Interface, Prev: Utility Functions, Up: Readline Convenience Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2123
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2124 Alternate Interface
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2125 -------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2126
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2127 An alternate interface is available to plain `readline()'. Some
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2128 applications need to interleave keyboard I/O with file, device, or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2129 window system I/O, typically by using a main loop to `select()' on
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2130 various file descriptors. To accomodate this need, readline can also
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2131 be invoked as a `callback' function from an event loop. There are
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2132 functions available to make this easy.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2133
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2134 - Function: void rl_callback_handler_install (const char *prompt,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2135 rl_vcpfunc_t *lhandler)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2136 Set up the terminal for readline I/O and display the initial
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2137 expanded value of PROMPT. Save the value of LHANDLER to use as a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2138 function to call when a complete line of input has been entered.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2139 The function takes the text of the line as an argument.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2140
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2141 - Function: void rl_callback_read_char (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2142 Whenever an application determines that keyboard input is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2143 available, it should call `rl_callback_read_char()', which will
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2144 read the next character from the current input source. If that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2145 character completes the line, `rl_callback_read_char' will invoke
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2146 the LHANDLER function saved by `rl_callback_handler_install' to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2147 process the line. `EOF' is indicated by calling LHANDLER with a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2148 `NULL' line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2149
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2150 - Function: void rl_callback_handler_remove (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2151 Restore the terminal to its initial state and remove the line
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2152 handler. This may be called from within a callback as well as
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2153 independently.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2154
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2155 An Example
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2156 ----------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2157
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2158 Here is a function which changes lowercase characters to their
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2159 uppercase equivalents, and uppercase characters to lowercase. If this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2160 function was bound to `M-c', then typing `M-c' would change the case of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2161 the character under point. Typing `M-1 0 M-c' would change the case of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2162 the following 10 characters, leaving the cursor on the last character
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2163 changed.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2164
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2165 /* Invert the case of the COUNT following characters. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2166 int
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2167 invert_case_line (count, key)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2168 int count, key;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2169 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2170 register int start, end, i;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2171
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2172 start = rl_point;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2173
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2174 if (rl_point >= rl_end)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2175 return (0);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2176
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2177 if (count < 0)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2178 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2179 direction = -1;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2180 count = -count;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2181 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2182 else
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2183 direction = 1;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2184
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2185 /* Find the end of the range to modify. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2186 end = start + (count * direction);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2187
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2188 /* Force it to be within range. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2189 if (end > rl_end)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2190 end = rl_end;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2191 else if (end < 0)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2192 end = 0;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2193
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2194 if (start == end)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2195 return (0);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2196
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2197 if (start > end)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2198 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2199 int temp = start;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2200 start = end;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2201 end = temp;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2202 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2203
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2204 /* Tell readline that we are modifying the line, so it will save
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2205 the undo information. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2206 rl_modifying (start, end);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2207
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2208 for (i = start; i != end; i++)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2209 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2210 if (_rl_uppercase_p (rl_line_buffer[i]))
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2211 rl_line_buffer[i] = _rl_to_lower (rl_line_buffer[i]);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2212 else if (_rl_lowercase_p (rl_line_buffer[i]))
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2213 rl_line_buffer[i] = _rl_to_upper (rl_line_buffer[i]);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2214 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2215 /* Move point to on top of the last character changed. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2216 rl_point = (direction == 1) ? end - 1 : start;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2217 return (0);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2218 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2219
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2220 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2221 File: readline.info, Node: Readline Signal Handling, Next: Custom Completers, Prev: Readline Convenience Functions, Up: Programming with GNU Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2222
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2223 Readline Signal Handling
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2224 ========================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2225
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2226 Signals are asynchronous events sent to a process by the Unix kernel,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2227 sometimes on behalf of another process. They are intended to indicate
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2228 exceptional events, like a user pressing the interrupt key on his
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2229 terminal, or a network connection being broken. There is a class of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2230 signals that can be sent to the process currently reading input from
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2231 the keyboard. Since Readline changes the terminal attributes when it
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2232 is called, it needs to perform special processing when a signal is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2233 received to restore the terminal to a sane state, or provide application
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2234 writers with functions to do so manually.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2235
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2236 Readline contains an internal signal handler that is installed for a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2237 number of signals (`SIGINT', `SIGQUIT', `SIGTERM', `SIGALRM',
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2238 `SIGTSTP', `SIGTTIN', and `SIGTTOU'). When one of these signals is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2239 received, the signal handler will reset the terminal attributes to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2240 those that were in effect before `readline()' was called, reset the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2241 signal handling to what it was before `readline()' was called, and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2242 resend the signal to the calling application. If and when the calling
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2243 application's signal handler returns, Readline will reinitialize the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2244 terminal and continue to accept input. When a `SIGINT' is received,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2245 the Readline signal handler performs some additional work, which will
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2246 cause any partially-entered line to be aborted (see the description of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2247 `rl_free_line_state()' below).
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2248
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2249 There is an additional Readline signal handler, for `SIGWINCH', which
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2250 the kernel sends to a process whenever the terminal's size changes (for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2251 example, if a user resizes an `xterm'). The Readline `SIGWINCH'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2252 handler updates Readline's internal screen size information, and then
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2253 calls any `SIGWINCH' signal handler the calling application has
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2254 installed. Readline calls the application's `SIGWINCH' signal handler
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2255 without resetting the terminal to its original state. If the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2256 application's signal handler does more than update its idea of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2257 terminal size and return (for example, a `longjmp' back to a main
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2258 processing loop), it _must_ call `rl_cleanup_after_signal()' (described
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2259 below), to restore the terminal state.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2260
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2261 Readline provides two variables that allow application writers to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2262 control whether or not it will catch certain signals and act on them
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2263 when they are received. It is important that applications change the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2264 values of these variables only when calling `readline()', not in a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2265 signal handler, so Readline's internal signal state is not corrupted.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2266
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2267 - Variable: int rl_catch_signals
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2268 If this variable is non-zero, Readline will install signal
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2269 handlers for `SIGINT', `SIGQUIT', `SIGTERM', `SIGALRM', `SIGTSTP',
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2270 `SIGTTIN', and `SIGTTOU'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2271
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2272 The default value of `rl_catch_signals' is 1.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2273
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2274 - Variable: int rl_catch_sigwinch
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2275 If this variable is non-zero, Readline will install a signal
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2276 handler for `SIGWINCH'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2277
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2278 The default value of `rl_catch_sigwinch' is 1.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2279
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2280 If an application does not wish to have Readline catch any signals,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2281 or to handle signals other than those Readline catches (`SIGHUP', for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2282 example), Readline provides convenience functions to do the necessary
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2283 terminal and internal state cleanup upon receipt of a signal.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2284
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2285 - Function: void rl_cleanup_after_signal (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2286 This function will reset the state of the terminal to what it was
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2287 before `readline()' was called, and remove the Readline signal
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2288 handlers for all signals, depending on the values of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2289 `rl_catch_signals' and `rl_catch_sigwinch'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2290
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2291 - Function: void rl_free_line_state (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2292 This will free any partial state associated with the current input
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2293 line (undo information, any partial history entry, any
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2294 partially-entered keyboard macro, and any partially-entered
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2295 numeric argument). This should be called before
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2296 `rl_cleanup_after_signal()'. The Readline signal handler for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2297 `SIGINT' calls this to abort the current input line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2298
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2299 - Function: void rl_reset_after_signal (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2300 This will reinitialize the terminal and reinstall any Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2301 signal handlers, depending on the values of `rl_catch_signals' and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2302 `rl_catch_sigwinch'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2303
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2304 If an application does not wish Readline to catch `SIGWINCH', it may
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2305 call `rl_resize_terminal()' or `rl_set_screen_size()' to force Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2306 to update its idea of the terminal size when a `SIGWINCH' is received.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2307
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2308 - Function: void rl_resize_terminal (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2309 Update Readline's internal screen size by reading values from the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2310 kernel.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2311
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2312 - Function: void rl_set_screen_size (int rows, int cols)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2313 Set Readline's idea of the terminal size to ROWS rows and COLS
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2314 columns.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2315
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2316 The following functions install and remove Readline's signal
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2317 handlers.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2318
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2319 - Function: int rl_set_signals (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2320 Install Readline's signal handler for `SIGINT', `SIGQUIT',
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2321 `SIGTERM', `SIGALRM', `SIGTSTP', `SIGTTIN', `SIGTTOU', and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2322 `SIGWINCH', depending on the values of `rl_catch_signals' and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2323 `rl_catch_sigwinch'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2324
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2325 - Function: int rl_clear_signals (void)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2326 Remove all of the Readline signal handlers installed by
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2327 `rl_set_signals()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2328
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2329 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2330 File: readline.info, Node: Custom Completers, Prev: Readline Signal Handling, Up: Programming with GNU Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2331
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2332 Custom Completers
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2333 =================
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2334
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2335 Typically, a program that reads commands from the user has a way of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2336 disambiguating commands and data. If your program is one of these, then
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2337 it can provide completion for commands, data, or both. The following
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2338 sections describe how your program and Readline cooperate to provide
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2339 this service.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2340
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2341 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2342
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2343 * How Completing Works:: The logic used to do completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2344 * Completion Functions:: Functions provided by Readline.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2345 * Completion Variables:: Variables which control completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2346 * A Short Completion Example:: An example of writing completer subroutines.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2347
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2348 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2349 File: readline.info, Node: How Completing Works, Next: Completion Functions, Up: Custom Completers
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2350
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2351 How Completing Works
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2352 --------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2353
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2354 In order to complete some text, the full list of possible completions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2355 must be available. That is, it is not possible to accurately expand a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2356 partial word without knowing all of the possible words which make sense
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2357 in that context. The Readline library provides the user interface to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2358 completion, and two of the most common completion functions: filename
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2359 and username. For completing other types of text, you must write your
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2360 own completion function. This section describes exactly what such
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2361 functions must do, and provides an example.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2362
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2363 There are three major functions used to perform completion:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2364
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2365 1. The user-interface function `rl_complete()'. This function is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2366 called with the same arguments as other bindable Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2367 functions: COUNT and INVOKING_KEY. It isolates the word to be
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2368 completed and calls `rl_completion_matches()' to generate a list
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2369 of possible completions. It then either lists the possible
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2370 completions, inserts the possible completions, or actually
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2371 performs the completion, depending on which behavior is desired.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2372
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2373 2. The internal function `rl_completion_matches()' uses an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2374 application-supplied "generator" function to generate the list of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2375 possible matches, and then returns the array of these matches.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2376 The caller should place the address of its generator function in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2377 `rl_completion_entry_function'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2378
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2379 3. The generator function is called repeatedly from
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2380 `rl_completion_matches()', returning a string each time. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2381 arguments to the generator function are TEXT and STATE. TEXT is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2382 the partial word to be completed. STATE is zero the first time
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2383 the function is called, allowing the generator to perform any
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2384 necessary initialization, and a positive non-zero integer for each
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2385 subsequent call. The generator function returns `(char *)NULL' to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2386 inform `rl_completion_matches()' that there are no more
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2387 possibilities left. Usually the generator function computes the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2388 list of possible completions when STATE is zero, and returns them
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2389 one at a time on subsequent calls. Each string the generator
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2390 function returns as a match must be allocated with `malloc()';
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2391 Readline frees the strings when it has finished with them.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2392
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2393
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2394 - Function: int rl_complete (int ignore, int invoking_key)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2395 Complete the word at or before point. You have supplied the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2396 function that does the initial simple matching selection algorithm
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2397 (see `rl_completion_matches()'). The default is to do filename
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2398 completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2399
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2400 - Variable: rl_compentry_func_t * rl_completion_entry_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2401 This is a pointer to the generator function for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2402 `rl_completion_matches()'. If the value of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2403 `rl_completion_entry_function' is `NULL' then the default filename
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2404 generator function, `rl_filename_completion_function()', is used.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2405
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2406 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2407 File: readline.info, Node: Completion Functions, Next: Completion Variables, Prev: How Completing Works, Up: Custom Completers
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2408
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2409 Completion Functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2410 --------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2411
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2412 Here is the complete list of callable completion functions present in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2413 Readline.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2414
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2415 - Function: int rl_complete_internal (int what_to_do)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2416 Complete the word at or before point. WHAT_TO_DO says what to do
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2417 with the completion. A value of `?' means list the possible
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2418 completions. `TAB' means do standard completion. `*' means
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2419 insert all of the possible completions. `!' means to display all
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2420 of the possible completions, if there is more than one, as well as
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2421 performing partial completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2422
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2423 - Function: int rl_complete (int ignore, int invoking_key)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2424 Complete the word at or before point. You have supplied the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2425 function that does the initial simple matching selection algorithm
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2426 (see `rl_completion_matches()' and `rl_completion_entry_function').
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2427 The default is to do filename completion. This calls
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2428 `rl_complete_internal()' with an argument depending on
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2429 INVOKING_KEY.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2430
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2431 - Function: int rl_possible_completions (int count, int invoking_key)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2432 List the possible completions. See description of `rl_complete
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2433 ()'. This calls `rl_complete_internal()' with an argument of `?'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2434
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2435 - Function: int rl_insert_completions (int count, int invoking_key)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2436 Insert the list of possible completions into the line, deleting the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2437 partially-completed word. See description of `rl_complete()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2438 This calls `rl_complete_internal()' with an argument of `*'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2439
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2440 - Function: char ** rl_completion_matches (const char *text,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2441 rl_compentry_func_t *entry_func)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2442 Returns an array of `(char *)' which is a list of completions for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2443 TEXT. If there are no completions, returns `NULL'. The first
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2444 entry in the returned array is the substitution for TEXT. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2445 remaining entries are the possible completions. The array is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2446 terminated with a `NULL' pointer.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2447
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2448 ENTRY_FUNC is a function of two args, and returns a `(char *)'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2449 The first argument is TEXT. The second is a state argument; it is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2450 zero on the first call, and non-zero on subsequent calls.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2451 ENTRY_FUNC returns a `NULL' pointer to the caller when there are
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2452 no more matches.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2453
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2454 - Function: char * rl_filename_completion_function (const char *text,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2455 int state)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2456 A generator function for filename completion in the general case.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2457 Note that completion in Bash is a little different because of all
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2458 the pathnames that must be followed when looking up completions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2459 for a command. The Bash source is a useful reference for writing
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2460 custom completion functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2461
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2462 - Function: char * rl_username_completion_function (const char *text,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2463 int state)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2464 A completion generator for usernames. TEXT contains a partial
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2465 username preceded by a random character (usually `~'). As with all
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2466 completion generators, STATE is zero on the first call and non-zero
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2467 for subsequent calls.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2468
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2469 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2470 File: readline.info, Node: Completion Variables, Next: A Short Completion Example, Prev: Completion Functions, Up: Custom Completers
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2471
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2472 Completion Variables
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2473 --------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2474
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2475 - Variable: rl_compentry_func_t * rl_completion_entry_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2476 A pointer to the generator function for `rl_completion_matches()'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2477 `NULL' means to use `rl_filename_completion_function()', the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2478 default filename completer.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2479
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2480 - Variable: rl_completion_func_t * rl_attempted_completion_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2481 A pointer to an alternative function to create matches. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2482 function is called with TEXT, START, and END. START and END are
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2483 indices in `rl_line_buffer' defining the boundaries of TEXT, which
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2484 is a character string. If this function exists and returns
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2485 `NULL', or if this variable is set to `NULL', then `rl_complete()'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2486 will call the value of `rl_completion_entry_function' to generate
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2487 matches, otherwise the array of strings returned will be used. If
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2488 this function sets the `rl_attempted_completion_over' variable to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2489 a non-zero value, Readline will not perform its default completion
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2490 if this function returns no matches.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2491
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2492 - Variable: rl_quote_func_t * rl_filename_quoting_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2493 A pointer to a function that will quote a filename in an
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2494 application-specific fashion. This is called if filename
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2495 completion is being attempted and one of the characters in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2496 `rl_filename_quote_characters' appears in a completed filename.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2497 The function is called with TEXT, MATCH_TYPE, and QUOTE_POINTER.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2498 The TEXT is the filename to be quoted. The MATCH_TYPE is either
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2499 `SINGLE_MATCH', if there is only one completion match, or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2500 `MULT_MATCH'. Some functions use this to decide whether or not to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2501 insert a closing quote character. The QUOTE_POINTER is a pointer
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2502 to any opening quote character the user typed. Some functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2503 choose to reset this character.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2504
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2505 - Variable: rl_dequote_func_t * rl_filename_dequoting_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2506 A pointer to a function that will remove application-specific
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2507 quoting characters from a filename before completion is attempted,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2508 so those characters do not interfere with matching the text
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2509 against names in the filesystem. It is called with TEXT, the text
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2510 of the word to be dequoted, and QUOTE_CHAR, which is the quoting
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2511 character that delimits the filename (usually `'' or `"'). If
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2512 QUOTE_CHAR is zero, the filename was not in an embedded string.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2513
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2514 - Variable: rl_linebuf_func_t * rl_char_is_quoted_p
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2515 A pointer to a function to call that determines whether or not a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2516 specific character in the line buffer is quoted, according to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2517 whatever quoting mechanism the program calling readline uses. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2518 function is called with two arguments: TEXT, the text of the line,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2519 and INDEX, the index of the character in the line. It is used to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2520 decide whether a character found in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2521 `rl_completer_word_break_characters' should be used to break words
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2522 for the completer.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2523
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2524 - Variable: int rl_completion_query_items
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2525 Up to this many items will be displayed in response to a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2526 possible-completions call. After that, we ask the user if she is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2527 sure she wants to see them all. The default value is 100.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2528
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2529 - Variable: const char * rl_basic_word_break_characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2530 The basic list of characters that signal a break between words for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2531 the completer routine. The default value of this variable is the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2532 characters which break words for completion in Bash, i.e., `"
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2533 \t\n\"\\'`@$><=;|&{("'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2534
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2535 - Variable: const char * rl_basic_quote_characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2536 List of quote characters which can cause a word break.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2537
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2538 - Variable: const char * rl_completer_word_break_characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2539 The list of characters that signal a break between words for
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2540 `rl_complete_internal()'. The default list is the value of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2541 `rl_basic_word_break_characters'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2542
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2543 - Variable: const char * rl_completer_quote_characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2544 List of characters which can be used to quote a substring of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2545 line. Completion occurs on the entire substring, and within the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2546 substring `rl_completer_word_break_characters' are treated as any
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2547 other character, unless they also appear within this list.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2548
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2549 - Variable: const char * rl_filename_quote_characters
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2550 A list of characters that cause a filename to be quoted by the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2551 completer when they appear in a completed filename. The default
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2552 is the null string.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2553
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2554 - Variable: const char * rl_special_prefixes
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2555 The list of characters that are word break characters, but should
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2556 be left in TEXT when it is passed to the completion function.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2557 Programs can use this to help determine what kind of completing to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2558 do. For instance, Bash sets this variable to "$@" so that it can
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2559 complete shell variables and hostnames.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2560
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2561 - Variable: int rl_completion_append_character
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2562 When a single completion alternative matches at the end of the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2563 command line, this character is appended to the inserted
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2564 completion text. The default is a space character (` '). Setting
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2565 this to the null character (`\0') prevents anything being appended
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2566 automatically. This can be changed in custom completion functions
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2567 to provide the "most sensible word separator character" according
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2568 to an application-specific command line syntax specification.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2569
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2570 - Variable: int rl_ignore_completion_duplicates
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2571 If non-zero, then disallow duplicates in the matches. Default is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2572 1.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2573
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2574 - Variable: int rl_filename_completion_desired
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2575 Non-zero means that the results of the matches are to be treated as
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2576 filenames. This is _always_ zero on entry, and can only be changed
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2577 within a completion entry generator function. If it is set to a
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2578 non-zero value, directory names have a slash appended and Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2579 attempts to quote completed filenames if they contain any
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2580 characters in `rl_filename_quote_characters' and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2581 `rl_filename_quoting_desired' is set to a non-zero value.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2582
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2583 - Variable: int rl_filename_quoting_desired
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2584 Non-zero means that the results of the matches are to be quoted
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2585 using double quotes (or an application-specific quoting mechanism)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2586 if the completed filename contains any characters in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2587 `rl_filename_quote_chars'. This is _always_ non-zero on entry,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2588 and can only be changed within a completion entry generator
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2589 function. The quoting is effected via a call to the function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2590 pointed to by `rl_filename_quoting_function'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2591
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2592 - Variable: int rl_attempted_completion_over
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2593 If an application-specific completion function assigned to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2594 `rl_attempted_completion_function' sets this variable to a non-zero
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2595 value, Readline will not perform its default filename completion
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2596 if the application's completion function returns no matches. It
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2597 should be set only by an application's completion function.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2598
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2599 - Variable: int rl_completion_type
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2600 Set to a character describing the type of completion Readline is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2601 currently attempting; see the description of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2602 `rl_complete_internal()' (*note Completion Functions::) for the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2603 list of characters.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2604
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2605 - Variable: int rl_inhibit_completion
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2606 If this variable is non-zero, completion is inhibited. The
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2607 completion character will be inserted as any other bound to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2608 `self-insert'.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2609
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2610 - Variable: rl_compignore_func_t * rl_ignore_some_completions_function
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2611 This function, if defined, is called by the completer when real
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2612 filename completion is done, after all the matching names have
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2613 been generated. It is passed a `NULL' terminated array of matches.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2614 The first element (`matches[0]') is the maximal substring common
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2615 to all matches. This function can re-arrange the list of matches
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2616 as required, but each element deleted from the array must be freed.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2617
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2618 - Variable: rl_icppfunc_t * rl_directory_completion_hook
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2619 This function, if defined, is allowed to modify the directory
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2620 portion of filenames Readline completes. It is called with the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2621 address of a string (the current directory name) as an argument,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2622 and may modify that string. If the string is replaced with a new
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2623 string, the old value should be freed. Any modified directory
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2624 name should have a trailing slash. The modified value will be
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2625 displayed as part of the completion, replacing the directory
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2626 portion of the pathname the user typed. It returns an integer
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2627 that should be non-zero if the function modifies its directory
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2628 argument. It could be used to expand symbolic links or shell
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2629 variables in pathnames.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2630
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2631 - Variable: rl_compdisp_func_t * rl_completion_display_matches_hook
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2632 If non-zero, then this is the address of a function to call when
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2633 completing a word would normally display the list of possible
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2634 matches. This function is called in lieu of Readline displaying
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2635 the list. It takes three arguments: (`char **'MATCHES, `int'
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2636 NUM_MATCHES, `int' MAX_LENGTH) where MATCHES is the array of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2637 matching strings, NUM_MATCHES is the number of strings in that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2638 array, and MAX_LENGTH is the length of the longest string in that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2639 array. Readline provides a convenience function,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2640 `rl_display_match_list', that takes care of doing the display to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2641 Readline's output stream. That function may be called from this
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2642 hook.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2643
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2644 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2645 File: readline.info, Node: A Short Completion Example, Prev: Completion Variables, Up: Custom Completers
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2646
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2647 A Short Completion Example
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2648 --------------------------
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2649
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2650 Here is a small application demonstrating the use of the GNU Readline
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2651 library. It is called `fileman', and the source code resides in
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2652 `examples/fileman.c'. This sample application provides completion of
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2653 command names, line editing features, and access to the history list.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2654
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2655 /* fileman.c -- A tiny application which demonstrates how to use the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2656 GNU Readline library. This application interactively allows users
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2657 to manipulate files and their modes. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2658
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2659 #include <stdio.h>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2660 #include <sys/types.h>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2661 #include <sys/file.h>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2662 #include <sys/stat.h>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2663 #include <sys/errno.h>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2664
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2665 #include <readline/readline.h>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2666 #include <readline/history.h>
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2667
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2668 extern char *xmalloc ();
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2669
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2670 /* The names of functions that actually do the manipulation. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2671 int com_list __P((char *));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2672 int com_view __P((char *));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2673 int com_rename __P((char *));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2674 int com_stat __P((char *));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2675 int com_pwd __P((char *));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2676 int com_delete __P((char *));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2677 int com_help __P((char *));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2678 int com_cd __P((char *));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2679 int com_quit __P((char *));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2680
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2681 /* A structure which contains information on the commands this program
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2682 can understand. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2683
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2684 typedef struct {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2685 char *name; /* User printable name of the function. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2686 rl_icpfunc_t *func; /* Function to call to do the job. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2687 char *doc; /* Documentation for this function. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2688 } COMMAND;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2689
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2690 COMMAND commands[] = {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2691 { "cd", com_cd, "Change to directory DIR" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2692 { "delete", com_delete, "Delete FILE" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2693 { "help", com_help, "Display this text" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2694 { "?", com_help, "Synonym for `help'" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2695 { "list", com_list, "List files in DIR" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2696 { "ls", com_list, "Synonym for `list'" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2697 { "pwd", com_pwd, "Print the current working directory" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2698 { "quit", com_quit, "Quit using Fileman" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2699 { "rename", com_rename, "Rename FILE to NEWNAME" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2700 { "stat", com_stat, "Print out statistics on FILE" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2701 { "view", com_view, "View the contents of FILE" },
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2702 { (char *)NULL, (rl_icpfunc_t *)NULL, (char *)NULL }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2703 };
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2704
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2705 /* Forward declarations. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2706 char *stripwhite ();
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2707 COMMAND *find_command ();
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2708
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2709 /* The name of this program, as taken from argv[0]. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2710 char *progname;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2711
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2712 /* When non-zero, this means the user is done using this program. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2713 int done;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2714
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2715 char *
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2716 dupstr (s)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2717 int s;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2718 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2719 char *r;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2720
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2721 r = xmalloc (strlen (s) + 1);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2722 strcpy (r, s);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2723 return (r);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2724 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2725
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2726 main (argc, argv)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2727 int argc;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2728 char **argv;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2729 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2730 char *line, *s;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2731
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2732 progname = argv[0];
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2733
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2734 initialize_readline (); /* Bind our completer. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2735
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2736 /* Loop reading and executing lines until the user quits. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2737 for ( ; done == 0; )
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2738 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2739 line = readline ("FileMan: ");
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2740
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2741 if (!line)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2742 break;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2743
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2744 /* Remove leading and trailing whitespace from the line.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2745 Then, if there is anything left, add it to the history list
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2746 and execute it. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2747 s = stripwhite (line);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2748
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2749 if (*s)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2750 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2751 add_history (s);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2752 execute_line (s);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2753 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2754
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2755 free (line);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2756 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2757 exit (0);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2758 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2759
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2760 /* Execute a command line. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2761 int
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2762 execute_line (line)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2763 char *line;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2764 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2765 register int i;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2766 COMMAND *command;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2767 char *word;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2768
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2769 /* Isolate the command word. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2770 i = 0;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2771 while (line[i] && whitespace (line[i]))
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2772 i++;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2773 word = line + i;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2774
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2775 while (line[i] && !whitespace (line[i]))
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2776 i++;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2777
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2778 if (line[i])
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2779 line[i++] = '\0';
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2780
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2781 command = find_command (word);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2782
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2783 if (!command)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2784 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2785 fprintf (stderr, "%s: No such command for FileMan.\n", word);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2786 return (-1);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2787 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2788
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2789 /* Get argument to command, if any. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2790 while (whitespace (line[i]))
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2791 i++;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2792
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2793 word = line + i;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2794
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2795 /* Call the function. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2796 return ((*(command->func)) (word));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2797 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2798
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2799 /* Look up NAME as the name of a command, and return a pointer to that
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2800 command. Return a NULL pointer if NAME isn't a command name. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2801 COMMAND *
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2802 find_command (name)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2803 char *name;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2804 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2805 register int i;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2806
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2807 for (i = 0; commands[i].name; i++)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2808 if (strcmp (name, commands[i].name) == 0)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2809 return (&commands[i]);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2810
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2811 return ((COMMAND *)NULL);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2812 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2813
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2814 /* Strip whitespace from the start and end of STRING. Return a pointer
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2815 into STRING. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2816 char *
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2817 stripwhite (string)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2818 char *string;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2819 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2820 register char *s, *t;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2821
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2822 for (s = string; whitespace (*s); s++)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2823 ;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2824
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2825 if (*s == 0)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2826 return (s);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2827
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2828 t = s + strlen (s) - 1;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2829 while (t > s && whitespace (*t))
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2830 t--;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2831 *++t = '\0';
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2832
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2833 return s;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2834 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2835
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2836 /* **************************************************************** */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2837 /* */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2838 /* Interface to Readline Completion */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2839 /* */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2840 /* **************************************************************** */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2841
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2842 char *command_generator __P((const char *, int));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2843 char **fileman_completion __P((const char *, int, int));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2844
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2845 /* Tell the GNU Readline library how to complete. We want to try to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2846 complete on command names if this is the first word in the line, or
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2847 on filenames if not. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2848 initialize_readline ()
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2849 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2850 /* Allow conditional parsing of the ~/.inputrc file. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2851 rl_readline_name = "FileMan";
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2852
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2853 /* Tell the completer that we want a crack first. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2854 rl_attempted_completion_function = fileman_completion;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2855 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2856
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2857 /* Attempt to complete on the contents of TEXT. START and END
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2858 bound the region of rl_line_buffer that contains the word to
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2859 complete. TEXT is the word to complete. We can use the entire
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2860 contents of rl_line_buffer in case we want to do some simple
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2861 parsing. Returnthe array of matches, or NULL if there aren't any. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2862 char **
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2863 fileman_completion (text, start, end)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2864 const char *text;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2865 int start, end;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2866 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2867 char **matches;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2868
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2869 matches = (char **)NULL;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2870
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2871 /* If this word is at the start of the line, then it is a command
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2872 to complete. Otherwise it is the name of a file in the current
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2873 directory. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2874 if (start == 0)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2875 matches = rl_completion_matches (text, command_generator);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2876
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2877 return (matches);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2878 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2879
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2880 /* Generator function for command completion. STATE lets us
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2881 know whether to start from scratch; without any state
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2882 (i.e. STATE == 0), then we start at the top of the list. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2883 char *
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2884 command_generator (text, state)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2885 const char *text;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2886 int state;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2887 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2888 static int list_index, len;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2889 char *name;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2890
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2891 /* If this is a new word to complete, initialize now. This
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2892 includes saving the length of TEXT for efficiency, and
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2893 initializing the index variable to 0. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2894 if (!state)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2895 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2896 list_index = 0;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2897 len = strlen (text);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2898 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2899
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2900 /* Return the next name which partially matches from the
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2901 command list. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2902 while (name = commands[list_index].name)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2903 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2904 list_index++;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2905
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2906 if (strncmp (name, text, len) == 0)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2907 return (dupstr(name));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2908 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2909
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2910 /* If no names matched, then return NULL. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2911 return ((char *)NULL);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2912 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2913
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2914 /* **************************************************************** */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2915 /* */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2916 /* FileMan Commands */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2917 /* */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2918 /* **************************************************************** */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2919
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2920 /* String to pass to system (). This is for the LIST, VIEW and RENAME
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2921 commands. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2922 static char syscom[1024];
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2923
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2924 /* List the file(s) named in arg. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2925 com_list (arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2926 char *arg;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2927 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2928 if (!arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2929 arg = "";
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2930
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2931 sprintf (syscom, "ls -FClg %s", arg);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2932 return (system (syscom));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2933 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2934
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2935 com_view (arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2936 char *arg;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2937 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2938 if (!valid_argument ("view", arg))
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2939 return 1;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2940
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2941 sprintf (syscom, "more %s", arg);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2942 return (system (syscom));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2943 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2944
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2945 com_rename (arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2946 char *arg;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2947 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2948 too_dangerous ("rename");
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2949 return (1);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2950 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2951
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2952 com_stat (arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2953 char *arg;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2954 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2955 struct stat finfo;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2956
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2957 if (!valid_argument ("stat", arg))
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2958 return (1);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2959
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2960 if (stat (arg, &finfo) == -1)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2961 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2962 perror (arg);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2963 return (1);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2964 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2965
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2966 printf ("Statistics for `%s':\n", arg);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2967
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2968 printf ("%s has %d link%s, and is %d byte%s in length.\n", arg,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2969 finfo.st_nlink,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2970 (finfo.st_nlink == 1) ? "" : "s",
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2971 finfo.st_size,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2972 (finfo.st_size == 1) ? "" : "s");
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2973 printf ("Inode Last Change at: %s", ctime (&finfo.st_ctime));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2974 printf (" Last access at: %s", ctime (&finfo.st_atime));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2975 printf (" Last modified at: %s", ctime (&finfo.st_mtime));
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2976 return (0);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2977 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2978
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2979 com_delete (arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2980 char *arg;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2981 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2982 too_dangerous ("delete");
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2983 return (1);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2984 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2985
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2986 /* Print out help for ARG, or for all of the commands if ARG is
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2987 not present. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2988 com_help (arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2989 char *arg;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2990 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2991 register int i;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2992 int printed = 0;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2993
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2994 for (i = 0; commands[i].name; i++)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2995 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2996 if (!*arg || (strcmp (arg, commands[i].name) == 0))
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2997 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2998 printf ("%s\t\t%s.\n", commands[i].name, commands[i].doc);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
2999 printed++;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3000 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3001 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3002
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3003 if (!printed)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3004 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3005 printf ("No commands match `%s'. Possibilties are:\n", arg);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3006
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3007 for (i = 0; commands[i].name; i++)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3008 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3009 /* Print in six columns. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3010 if (printed == 6)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3011 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3012 printed = 0;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3013 printf ("\n");
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3014 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3015
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3016 printf ("%s\t", commands[i].name);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3017 printed++;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3018 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3019
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3020 if (printed)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3021 printf ("\n");
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3022 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3023 return (0);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3024 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3025
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3026 /* Change to the directory ARG. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3027 com_cd (arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3028 char *arg;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3029 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3030 if (chdir (arg) == -1)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3031 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3032 perror (arg);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3033 return 1;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3034 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3035
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3036 com_pwd ("");
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3037 return (0);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3038 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3039
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3040 /* Print out the current working directory. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3041 com_pwd (ignore)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3042 char *ignore;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3043 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3044 char dir[1024], *s;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3045
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3046 s = getcwd (dir, sizeof(dir) - 1);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3047 if (s == 0)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3048 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3049 printf ("Error getting pwd: %s\n", dir);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3050 return 1;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3051 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3052
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3053 printf ("Current directory is %s\n", dir);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3054 return 0;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3055 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3056
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3057 /* The user wishes to quit using this program. Just set DONE
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3058 non-zero. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3059 com_quit (arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3060 char *arg;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3061 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3062 done = 1;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3063 return (0);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3064 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3065
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3066 /* Function which tells you that you can't do this. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3067 too_dangerous (caller)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3068 char *caller;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3069 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3070 fprintf (stderr,
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3071 "%s: Too dangerous for me to distribute. Write it yourself.\n",
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3072 caller);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3073 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3074
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3075 /* Return non-zero if ARG is a valid argument for CALLER, else print
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3076 an error message and return zero. */
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3077 int
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3078 valid_argument (caller, arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3079 char *caller, *arg;
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3080 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3081 if (!arg || !*arg)
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3082 {
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3083 fprintf (stderr, "%s: Argument required.\n", caller);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3084 return (0);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3085 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3086
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3087 return (1);
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3088 }
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3089
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3090 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3091 File: readline.info, Node: Concept Index, Next: Function and Variable Index, Prev: Programming with GNU Readline, Up: Top
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3092
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3093 Concept Index
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3094 *************
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3095
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3096 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3097
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3098 * command editing: Readline Bare Essentials.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3099 * editing command lines: Readline Bare Essentials.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3100 * initialization file, readline: Readline Init File.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3101 * interaction, readline: Readline Interaction.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3102 * kill ring: Readline Killing Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3103 * killing text: Readline Killing Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3104 * notation, readline: Readline Bare Essentials.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3105 * readline, function: Basic Behavior.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3106 * yanking text: Readline Killing Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3107
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3108 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3109 File: readline.info, Node: Function and Variable Index, Prev: Concept Index, Up: Top
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3110
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3111 Function and Variable Index
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3112 ***************************
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3113
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3114 * Menu:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3115
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3116 * _rl_digit_p: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3117 * _rl_digit_value: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3118 * _rl_lowercase_p: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3119 * _rl_to_lower: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3120 * _rl_to_upper: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3121 * _rl_uppercase_p: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3122 * abort (C-g): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3123 * accept-line (Newline or Return): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3124 * backward-char (C-b): Commands For Moving.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3125 * backward-delete-char (Rubout): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3126 * backward-kill-line (C-x Rubout): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3127 * backward-kill-word (M-<DEL>): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3128 * backward-word (M-b): Commands For Moving.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3129 * beginning-of-history (M-<): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3130 * beginning-of-line (C-a): Commands For Moving.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3131 * bell-style: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3132 * call-last-kbd-macro (C-x e): Keyboard Macros.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3133 * capitalize-word (M-c): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3134 * character-search (C-]): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3135 * character-search-backward (M-C-]): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3136 * clear-screen (C-l): Commands For Moving.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3137 * comment-begin: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3138 * complete (<TAB>): Commands For Completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3139 * completion-query-items: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3140 * convert-meta: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3141 * copy-backward-word (): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3142 * copy-forward-word (): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3143 * copy-region-as-kill (): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3144 * delete-char (C-d): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3145 * delete-char-or-list (): Commands For Completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3146 * delete-horizontal-space (): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3147 * digit-argument (M-0, M-1, ... M--): Numeric Arguments.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3148 * disable-completion: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3149 * do-uppercase-version (M-a, M-b, M-X, ...): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3150 * downcase-word (M-l): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3151 * dump-functions (): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3152 * dump-macros (): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3153 * dump-variables (): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3154 * editing-mode: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3155 * enable-keypad: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3156 * end-kbd-macro (C-x )): Keyboard Macros.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3157 * end-of-history (M->): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3158 * end-of-line (C-e): Commands For Moving.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3159 * exchange-point-and-mark (C-x C-x): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3160 * expand-tilde: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3161 * forward-backward-delete-char (): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3162 * forward-char (C-f): Commands For Moving.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3163 * forward-search-history (C-s): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3164 * forward-word (M-f): Commands For Moving.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3165 * history-search-backward (): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3166 * history-search-forward (): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3167 * horizontal-scroll-mode: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3168 * input-meta: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3169 * insert-comment (M-#): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3170 * insert-completions (M-*): Commands For Completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3171 * isearch-terminators: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3172 * keymap: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3173 * kill-line (C-k): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3174 * kill-region (): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3175 * kill-whole-line (): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3176 * kill-word (M-d): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3177 * mark-modified-lines: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3178 * menu-complete (): Commands For Completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3179 * meta-flag: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3180 * next-history (C-n): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3181 * non-incremental-forward-search-history (M-n): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3182 * non-incremental-reverse-search-history (M-p): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3183 * output-meta: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3184 * possible-completions (M-?): Commands For Completion.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3185 * prefix-meta (<ESC>): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3186 * previous-history (C-p): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3187 * quoted-insert (C-q or C-v): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3188 * re-read-init-file (C-x C-r): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3189 * readline: Basic Behavior.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3190 * redraw-current-line (): Commands For Moving.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3191 * reverse-search-history (C-r): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3192 * revert-line (M-r): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3193 * rl_add_defun: Function Naming.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3194 * rl_add_funmap_entry: Associating Function Names and Bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3195 * rl_add_undo: Allowing Undoing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3196 * rl_alphabetic: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3197 * rl_already_prompted: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3198 * rl_attempted_completion_function: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3199 * rl_attempted_completion_over: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3200 * rl_basic_quote_characters: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3201 * rl_basic_word_break_characters: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3202 * rl_begin_undo_group: Allowing Undoing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3203 * rl_bind_key: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3204 * rl_bind_key_in_map: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3205 * rl_binding_keymap: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3206 * rl_callback_handler_install: Alternate Interface.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3207 * rl_callback_handler_remove: Alternate Interface.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3208 * rl_callback_read_char: Alternate Interface.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3209 * rl_catch_signals: Readline Signal Handling.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3210 * rl_catch_sigwinch: Readline Signal Handling.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3211 * rl_char_is_quoted_p: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3212 * rl_cleanup_after_signal: Readline Signal Handling.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3213 * rl_clear_message: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3214 * rl_clear_pending_input: Character Input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3215 * rl_clear_signals: Readline Signal Handling.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3216 * rl_complete <1>: How Completing Works.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3217 * rl_complete: Completion Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3218 * rl_complete_internal: Completion Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3219 * rl_completer_quote_characters: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3220 * rl_completer_word_break_characters: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3221 * rl_completion_append_character: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3222 * rl_completion_display_matches_hook: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3223 * rl_completion_entry_function <1>: How Completing Works.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3224 * rl_completion_entry_function: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3225 * rl_completion_matches: Completion Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3226 * rl_completion_query_items: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3227 * rl_completion_type: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3228 * rl_copy_keymap: Keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3229 * rl_copy_text: Modifying Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3230 * rl_crlf: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3231 * rl_delete_text: Modifying Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3232 * rl_deprep_term_function: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3233 * rl_deprep_terminal: Terminal Management.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3234 * rl_ding: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3235 * rl_directory_completion_hook: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3236 * rl_discard_keymap: Keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3237 * rl_dispatching: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3238 * rl_display_match_list: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3239 * rl_do_undo: Allowing Undoing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3240 * rl_done: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3241 * rl_editing_mode: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3242 * rl_end: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3243 * rl_end_undo_group: Allowing Undoing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3244 * rl_erase_empty_line: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3245 * rl_event_hook: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3246 * rl_execute_next: Character Input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3247 * rl_executing_keymap: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3248 * rl_executing_macro: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3249 * rl_expand_prompt: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3250 * rl_explicit_arg: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3251 * rl_extend_line_buffer: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3252 * rl_filename_completion_desired: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3253 * rl_filename_completion_function: Completion Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3254 * rl_filename_dequoting_function: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3255 * rl_filename_quote_characters: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3256 * rl_filename_quoting_desired: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3257 * rl_filename_quoting_function: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3258 * rl_forced_update_display: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3259 * rl_free_line_state: Readline Signal Handling.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3260 * rl_free_undo_list: Allowing Undoing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3261 * rl_function_dumper: Associating Function Names and Bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3262 * rl_function_of_keyseq: Associating Function Names and Bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3263 * rl_funmap_names: Associating Function Names and Bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3264 * rl_generic_bind: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3265 * rl_get_keymap: Keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3266 * rl_get_keymap_by_name: Keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3267 * rl_get_keymap_name: Keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3268 * rl_getc: Character Input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3269 * rl_getc_function: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3270 * rl_gnu_readline_p: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3271 * rl_ignore_completion_duplicates: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3272 * rl_ignore_some_completions_function: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3273 * rl_inhibit_completion: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3274 * rl_initialize: Utility Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3275 * rl_insert_completions: Completion Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3276 * rl_insert_text: Modifying Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3277 * rl_instream: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3278 * rl_invoking_keyseqs: Associating Function Names and Bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3279 * rl_invoking_keyseqs_in_map: Associating Function Names and Bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3280 * rl_kill_text: Modifying Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3281 * rl_last_func: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3282 * rl_library_version: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3283 * rl_line_buffer: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3284 * rl_list_funmap_names: Associating Function Names and Bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3285 * rl_make_bare_keymap: Keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3286 * rl_make_keymap: Keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3287 * rl_mark: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3288 * rl_message: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3289 * rl_modifying: Allowing Undoing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3290 * rl_named_function: Associating Function Names and Bindings.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3291 * rl_num_chars_to_read: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3292 * rl_numeric_arg: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3293 * rl_on_new_line: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3294 * rl_on_new_line_with_prompt: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3295 * rl_outstream: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3296 * rl_parse_and_bind: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3297 * rl_pending_input: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3298 * rl_point: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3299 * rl_possible_completions: Completion Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3300 * rl_pre_input_hook: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3301 * rl_prep_term_function: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3302 * rl_prep_terminal: Terminal Management.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3303 * rl_prompt: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3304 * rl_read_init_file: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3305 * rl_read_key: Character Input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3306 * rl_readline_name: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3307 * rl_readline_state: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3308 * rl_redisplay: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3309 * rl_redisplay_function: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3310 * rl_reset_after_signal: Readline Signal Handling.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3311 * rl_reset_line_state: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3312 * rl_reset_terminal: Terminal Management.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3313 * rl_resize_terminal: Readline Signal Handling.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3314 * rl_restore_prompt: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3315 * rl_save_prompt: Redisplay.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3316 * rl_set_key: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3317 * rl_set_keymap: Keymaps.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3318 * rl_set_screen_size: Readline Signal Handling.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3319 * rl_set_signals: Readline Signal Handling.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3320 * rl_special_prefixes: Completion Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3321 * rl_startup_hook: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3322 * rl_stuff_char: Character Input.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3323 * rl_terminal_name: Readline Variables.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3324 * rl_tty_set_default_bindings: Terminal Management.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3325 * rl_unbind_command_in_map: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3326 * rl_unbind_function_in_map: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3327 * rl_unbind_key: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3328 * rl_unbind_key_in_map: Binding Keys.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3329 * rl_username_completion_function: Completion Functions.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3330 * self-insert (a, b, A, 1, !, ...): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3331 * set-mark (C-@): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3332 * show-all-if-ambiguous: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3333 * start-kbd-macro (C-x (): Keyboard Macros.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3334 * transpose-chars (C-t): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3335 * transpose-words (M-t): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3336 * undo (C-_ or C-x C-u): Miscellaneous Commands.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3337 * universal-argument (): Numeric Arguments.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3338 * unix-line-discard (C-u): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3339 * unix-word-rubout (C-w): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3340 * upcase-word (M-u): Commands For Text.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3341 * visible-stats: Readline Init File Syntax.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3342 * yank (C-y): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3343 * yank-last-arg (M-. or M-_): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3344 * yank-nth-arg (M-C-y): Commands For History.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3345 * yank-pop (M-y): Commands For Killing.
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3346
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3347
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3348 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3349 Tag Table:
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3350 Node: Top1164
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3351 Node: Command Line Editing1763
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3352 Node: Introduction and Notation2414
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3353 Node: Readline Interaction4032
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3354 Node: Readline Bare Essentials5219
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3355 Node: Readline Movement Commands7000
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3356 Node: Readline Killing Commands7957
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3357 Node: Readline Arguments9867
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3358 Node: Searching10903
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3359 Node: Readline Init File12859
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3360 Node: Readline Init File Syntax13920
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3361 Node: Conditional Init Constructs23536
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3362 Node: Sample Init File25975
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3363 Node: Bindable Readline Commands29145
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3364 Node: Commands For Moving30195
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3365 Node: Commands For History31044
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3366 Node: Commands For Text33826
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3367 Node: Commands For Killing35831
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3368 Node: Numeric Arguments37804
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3369 Node: Commands For Completion38932
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3370 Node: Keyboard Macros40421
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3371 Node: Miscellaneous Commands40980
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3372 Node: Readline vi Mode43796
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3373 Node: Programming with GNU Readline45549
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3374 Node: Basic Behavior46517
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3375 Node: Custom Functions49930
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3376 Node: Readline Typedefs50908
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3377 Node: Function Writing52537
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3378 Node: Readline Variables53621
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3379 Node: Readline Convenience Functions62417
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3380 Node: Function Naming63272
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3381 Node: Keymaps64524
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3382 Node: Binding Keys66280
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3383 Node: Associating Function Names and Bindings69206
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3384 Node: Allowing Undoing71451
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3385 Node: Redisplay73986
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3386 Node: Modifying Text76536
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3387 Node: Character Input77451
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3388 Node: Terminal Management78661
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3389 Node: Utility Functions79830
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3390 Node: Alternate Interface81893
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3391 Node: Readline Signal Handling85289
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3392 Node: Custom Completers90545
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3393 Node: How Completing Works91260
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3394 Node: Completion Functions94258
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3395 Node: Completion Variables97317
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3396 Node: A Short Completion Example106674
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3397 Node: Concept Index119199
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3398 Node: Function and Variable Index119953
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3399 
56522edd5c33 [project @ 2001-02-10 05:11:49 by jwe]
jwe
parents:
diff changeset
3400 End Tag Table