Next: , Previous: , Up: Completion   [Contents][Index]

10.4.2 Completion Commands

Here is a list of the completion commands defined in the minibuffer when completion is allowed.

TAB

Complete the text in the minibuffer as much as possible; if unable to complete, display a list of possible completions.

SPC

Complete up to one word from the minibuffer text before point.

C-x UP

Complete the text in the minibuffer using minibuffer history.

C-x DOWN

Complete the text in the minibuffer using minibuffer defaults.

RET

Submit the text in the minibuffer as the argument, possibly completing first. See Completion Exit.

?

Display a list of completions and a few useful key bindings (minibuffer-completion-help).

M-DOWN
M-UP

Navigate through list of completions.

M-v
M-g M-c
PageUp
prior

While in the minibuffer, select the window showing the completion list.

RET

In the completions buffer, choose the completion at point.

mouse-1
mouse-2

In the completions buffer, choose the completion at mouse click.

TAB
RIGHT
n

In the completions buffer, move to the following completion candidate.

S-TAB
LEFT
p

In the completions buffer, move to the previous completion candidate.

q

Quit the completions window and switch to the minibuffer window.

z

Kill the completions buffer and delete the window showing it.

TAB (minibuffer-complete) is the most fundamental completion command. It searches for all possible completions that match the existing minibuffer text, and attempts to complete as much as it can. See How Completion Alternatives Are Chosen, for how completion alternatives are chosen.

SPC (minibuffer-complete-word) completes like TAB, but only up to the next hyphen or space. If you have ‘auto-f’ in the minibuffer and type SPC, it finds that the completion is ‘auto-fill-mode’, but it only inserts ‘ill-’, giving ‘auto-fill-’. Another SPC at this point completes all the way to ‘auto-fill-mode’. This command is not available for arguments that often include spaces, such as file names.

If TAB or SPC is unable to complete, it displays in another window a list of matching completion alternatives (if there are any) and a few useful commands to select a completion candidate. You can display the same completion list and help with ? (minibuffer-completion-help). The following commands can be used with the completion list:

While in the minibuffer or in the completion list buffer, M-DOWN (minibuffer-next-completion and M-UP (minibuffer-previous-completion) navigate through the completions displayed in the completions buffer. When minibuffer-completion-auto-choose is non-nil (which is the default), using these commands also inserts the current completion candidate into the minibuffer. If minibuffer-completion-auto-choose is nil, you can use the M-RET command (minibuffer-choose-completion) to insert the completion candidates into the minibuffer. By default, that exits the minibuffer, but with a prefix argument, C-u M-RET inserts the currently active candidate without exiting the minibuffer.

Typing M-v, while in the minibuffer, selects the window showing the completion list (switch-to-completions). This paves the way for using the commands below. PageUp, prior and M-g M-c do the same. You can also select the window in other ways (see Multiple Windows).

While in the completion list buffer, RET chooses the completion candidate at point (choose-completion) and mouse-1 and mouse-2 choose the completion at mouse click. With a prefix argument, C-u RET inserts the completion at point into the minibuffer, but doesn’t exit the minibuffer—thus, you can change your mind and choose another candidate.

While in the completion list buffer, you can use TAB, RIGHT, or n to move point to the following completion candidate (next-completion). You can also use S-TAB, LEFT, and p to move point to the previous completion alternative (previous-completion).

You can also complete using the history of minibuffer inputs for the command which prompted you. C-x UP (minibuffer-complete-history) works like TAB, but completes using minibuffer history instead of the usual completion candidates. A similar command C-x DOWN (minibuffer-complete-defaults) completes using the default input items provided by the prompting command.

Finally, q quits the window showing it and selects the window showing the minibuffer (quit-window), and z kills the completion buffer and delete the window showing it (kill-current-buffer).

If the variable minibuffer-visible-completions is customized to a non-nil value, it changes the commands bound to the arrow keys: instead of moving in the minibuffer, they move between completion candidates, like meta-arrow keys do by default. Similarly, RET selects the current candidate, like M-RET does normally. C-g hides the completion window, but leaves the minibuffer active, so you can continue typing at the prompt.

Next: Completion Exit, Previous: Completion Example, Up: Completion   [Contents][Index]