[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
There are only a few basic constructs allowed in the Readline init file. Blank lines are ignored. Lines beginning with a `#' are comments. Lines beginning with a `$' indicate conditional constructs (see section 1.3.2 Conditional Init Constructs). Other lines denote variable settings and key bindings.
set
command within the init file.
The syntax is simple:
set variable value |
Here, for example, is how to
change from the default Emacs-like key binding to use
vi
line editing commands:
set editing-mode vi |
Variable names and values, where appropriate, are recognized without regard to case.
A great deal of run-time behavior is changeable with the following variables.
bell-style
comment-begin
insert-comment
command is executed. The default value
is "#"
.
completion-ignore-case
completion-query-items
100
.
convert-meta
disable-completion
self-insert
. The default is `off'.
editing-mode
editing-mode
variable controls which default set of
key bindings is used. By default, Readline starts up in Emacs editing
mode, where the keystrokes are most similar to Emacs. This variable can be
set to either `emacs' or `vi'.
enable-keypad
expand-tilde
horizontal-scroll-mode
input-meta
meta-flag
is a
synonym for this variable.
isearch-terminators
keymap
keymap
names are
emacs
,
emacs-standard
,
emacs-meta
,
emacs-ctlx
,
vi
,
vi-move
,
vi-command
, and
vi-insert
.
vi
is equivalent to vi-command
; emacs
is
equivalent to emacs-standard
. The default value is emacs
.
The value of the editing-mode
variable also affects the
default keymap.
mark-directories
mark-modified-lines
output-meta
print-completions-horizontally
show-all-if-ambiguous
visible-stats
Once you know the name of the command, simply place on a line in the init file the name of the key you wish to bind the command to, a colon, and then the name of the command. The name of the key can be expressed in different ways, depending on what you find most comfortable.
In addition to command names, readline allows keys to be bound to a string that is inserted when the key is pressed (a macro).
Control-u: universal-argument Meta-Rubout: backward-kill-word Control-o: "> output" |
In the above example, C-u is bound to the function
universal-argument
,
M-DEL is bound to the function backward-kill-word
, and
C-o is bound to run the macro
expressed on the right hand side (that is, to insert the text
`> output' into the line).
A number of symbolic character names are recognized while processing this key binding syntax: DEL, ESC, ESCAPE, LFD, NEWLINE, RET, RETURN, RUBOUT, SPACE, SPC, and TAB.
"\C-u": universal-argument "\C-x\C-r": re-read-init-file "\e[11~": "Function Key 1" |
In the above example, C-u is again bound to the function
universal-argument
(just as it was in the first example),
`C-x C-r' is bound to the function re-read-init-file
,
and `ESC [ 1 1 ~' is bound to insert
the text `Function Key 1'.
The following GNU Emacs style escape sequences are available when specifying key sequences:
\C-
\M-
\e
\\
\"
\'
In addition to the GNU Emacs style escape sequences, a second set of backslash escapes is available:
\a
\b
\d
\f
\n
\r
\t
\v
\nnn
\xnnn
When entering the text of a macro, single or double quotes must be used to indicate a macro definition. Unquoted text is assumed to be a function name. In the macro body, the backslash escapes described above are expanded. Backslash will quote any other character in the macro text, including `"' and `''. For example, the following binding will make `C-x \' insert a single `\' into the line:
"\C-x\\": "\\" |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |