3. Key bindings
While in lightning completion, the behavior of each key is modified.
Here is a description of what each key does; these functions are loosely
based on the behavior of standard completion in Emacs. I have also
included examples; for all of the examples, suppose that you are
completing on file names, and you have files `albatross',
`alpo', `alphabet', and `alphabet-soup'.
There is a customizable variable lc-complete-idle-time-default,
the default value of which is 0.5. In lightning completion mode, after
this number of seconds of idle time, Emacs tries to complete.
-
a-z, A-Z, 0-9, etc.: After the delay, you get an error if there is
no valid completion based on that character. If there are valid
completions, then Emacs inserts the characters in common with all the
valid completions. If there is a unique such completion, then Emacs
inserts that completion, and completion stops. (Example: if you have
`alp' and you hit x, you get an error
(but you're still in lightning completion mode); if you hit h,
then `habet' is inserted, resulting in `alphabet' (and you're
still in lightning completion mode). If you then hit -, then
`-soup' is inserted, and completion stops.)
When there are no valid completions, the value of the customizable
variable lc-clean-up is relevant. If it is nil, then Emacs beeps
and warns you that there are no valid completions. If it is non-nil,
then in addition, Emacs deletes the offending characters. (Example: if
you have `alp' and you hit x, then `x' is inserted. If
lc-clean-up is nil, then Emacs beeps. If lc-clean-up is
non-nil, then Emacs beeps and deletes the `x'. If you have
`al' and you type phx, if lc-clean-up is non-nil, then
the `x' is deleted and `abet' is inserted.)
-
SPC: If you have a valid completion, this key ends lightning
completion, keeping the current completion; otherwise, if there is a
valid completion based on the current string together with " ", then a
space is inserted. Otherwise, SPC acts like the TAB key.
(Example: if you have `alp' and you hit h, resulting in
`alphabet', then hitting SPC would end completion and do
nothing else. If you also have a file `al jolson', then
typing `al' followed by SPC produces `al jolson'.
Typing `alp' followed by SPC is just like typing `alp'
and hitting TAB.)
-
RET: This key exits lightning completion, regardless of whether
you have a valid completion, and inserts a new line or exits the
minibuffer, whichever is appropriate. (Example: if you are using have
`alp' and you hit RET, this ends completion and either
inserts a new line or exits the minibuffer.) (This is actually an
example of the behavior of "Other control characters," described
below.)
-
DEL: This deletes the last thing that was typed along with
anything inserted automatically as a result. (Example: if you had
`alp' and you hit h, resulting in `alphabet', then
hitting DEL would delete `habet'---the characters that were
just inserted.)
-
C-f: Hitting this key repeatedly cycles through the possible
completions, in some order or other. (Example: if you have `a',
then hitting C-f once will give `albatross'; hitting it again
will give `alpo', etc.)
-
C-b: This works like C-f, but it cycles through the choices
in the reverse order.
-
TAB: Hitting this key completes as far as possible. If there are
several choices, then it opens up a new buffer in another window,
called
*Completions*, in which all of the valid completions are
displayed. That buffer is buried once completion ends. (Example, if I
have `alp' and I hit TAB, then a new buffer opens up,
containing `alpo', `alphabet', and `alphabet-soup'. If I
then hit h and then TAB, the *Completions* buffer
then displays `alphabet' and `alphabet-soup'.) You can select
a completion by clicking on it with mouse-2.
-
M-v: Hitting this key opens up a new buffer in another window,
called
*Completions*, just as with the TAB key, but also
moves the point to that window. You can then move from one completion
choice to another with the arrow keys, and you can select a completion
with RET or with mouse-2.
-
C-c: Hitting this key exits lightning completion mode (useful if
you've had enough of this completion nonsense, and you just want to type
in the file name yourself; also useful if you want to type in the name
of a file that doesn't exist).
-
C-q: This key quotes the next character (useful if you have a file
name containing a control character like C-c or TAB, for
instance).
-
C-h: Hitting this key displays a very brief help message in the
minibuffer.
-
Other control characters: Hitting any other control character (or other
non-printing character) has two effects: completion stops, and that
character then has its normal effect. So C-g stops completion and
beeps, C-e stops completion and moves you to the end of the line,
etc.
Many of these keys can be customized (in the customization group
lightning-completion-keys).
This document was generated
on September, 30 2005
using texi2html