Next: , Previous: , Up: Convenience Features and Customization of Buffer Handling   [Contents][Index]

21.7.2 Fast minibuffer selection

Icomplete 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 for the minibuffer, type M-x icomplete-mode, or customize the variable icomplete-mode to t (see Easy Customization Interface).

You can also additionally enable Icomplete mode for C-M-i (the command completion-at-point) by customizing the variable icomplete-in-buffer to t. For in-buffer completion, the completion-auto-help variable controls when Icomplete mode’s display of possible completions appears. The default value of t means that the display of possible completions appears when you first type C-M-i.

By default, when you press C-M-i, both Icomplete mode’s in-buffer display of possible completions and the *Completions* buffer appear. If you are using icomplete-in-buffer, then you may wish to suppress this appearance of the *Completions* buffer. To do that, add the following to your initialization file (see The Emacs Initialization File):

(advice-add 'completion-at-point :after #'minibuffer-hide-completions)

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 How Completion Alternatives Are Chosen). To change this, add the following to your initialization file (see The Emacs Initialization 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 Interface).

Icomplete mode and Fido mode display the possible completions on the same line as the prompt by default. To display the completion candidates vertically under the prompt, type M-x icomplete-vertical-mode, or customize the variable icomplete-vertical-mode to t (see Easy Customization Interface).

Next: Customizing Buffer Menus, Previous: Making Buffer Names Unique, Up: Convenience Features and Customization of Buffer Handling   [Contents][Index]