19.7.2 Fast minibuffer selection
Icomplete global minor mode provides a convenient way to quickly select an element among the possible completions in a minibuffer. When enabled, typing in the minibuffer continuously displays a list of possible completions that match the string you have typed.
At any time, you can type C-j
to select the first completion in the list. So the way to select a particular completion is to make it the first in the list. There are two ways to do this. You can type more of the completion name and thus narrow down the list, excluding unwanted completions above the desired one. Alternatively, you can use C-.
and C-,
to rotate the list until the desired buffer is first.
M-TAB
will select the first completion in the list, like C-j
but without exiting the minibuffer, so you can edit it further. This is typically used when entering a file name, where M-TAB
can be used a few times to descend in the hierarchy of directories.
To enable Icomplete mode, type M-x icomplete-mode
, or customize the variable icomplete-mode
to t
(see Easy Customization).
An alternative to Icomplete mode is Fido mode. This is very similar to Icomplete mode, but retains some functionality from a popular extension called Ido mode (in fact the name is derived from “Fake Ido"). Among other things, in Fido mode, C-s
and C-r
are also used to rotate the completions list, C-k
can be used to delete files and kill buffers in-list. Another noteworthy aspect is that flex
is used as the default completion style (see Completion Styles). To change this, add the following to your initialization file (see Init File):
(defun my-icomplete-styles ()
(setq-local completion-styles '(initials flex)))
(add-hook 'icomplete-minibuffer-setup-hook 'my-icomplete-styles)
To enable Fido mode, type M-x fido-mode
, or customize the variable fido-mode
to t
(see Easy Customization).