Using ido for Emacs completion

Update

At some point, ido-hacks became no longer required, and ido-ubiquitous was folded into another package - ido-completing-read+. I’ve also somewhat modified my config since I wrote this post. Here’s the ido config I’m using today:

(use-package ido :quelpa
  :config
  (setq ido-everywhere t
    ido-virtual-buffers t
    ido-use-faces t
    ido-default-buffer-method 'selected-window
    ido-auto-merge-work-directories-length -1)
  (ido-mode))
(use-package flx-ido :quelpa :requires ido :config (flx-ido-mode))
(use-package ido-vertical-mode :quelpa :requires ido :config (ido-vertical-mode))
(use-package ido-completing-read+ :quelpa :requires ido
  :config
  (setq ido-ubiquitous-max-items 50000
    ido-cr+-max-items 50000)
  (ido-ubiquitous-mode +1))

If you’re wondering what the :quelpa keyword means or what it does, see my other post “Bootstrapping an Emacs config with quelpa-use-package”.

Original post


I’m a heavy user of ido – it handles all of my completion, whether execute-extended-command, find-file, or whatever else. However, ido’s default configuration leaves much to be desired:

  • The way it displays results by default is quite difficult to read, as you can’t quickly skip your eyes to the next item when they’re all listed in a single wrapped line.
  • The default completion is prefix-only
  • It’s not obvious how to make ido actually complete everything

Fortunately this is all quite fixable with a few packages and a little configuration:

  • ido-everywhere, when set to t, puts ido in more places than the default.
  • ido-virtual-buffers doesn’t fix anything per se, but it does add recentf files to find-file completion, which is really handy.
  • ido-vertical-mode makes ido display each result on its own line, with a configurable amount of lines to display at a time (though I just use the default).
  • flx-ido fixes the completion by using the flx completion engine.
  • ido-hacks and ido-ubiquitous together make ido complete everything I’ve wanted so far.

My full ido configuration is as follows:

(use-package ido :quelpa :config
  (setq ido-auto-merge-delay-time 99999999)
  (setq ido-everywhere t)
  (setq ido-virtual-buffers t)
  (ido-mode))
(use-package flx-ido :quelpa :requires ido :config (flx-ido-mode))
(use-package ido-vertical-mode :quelpa :requires ido :config (ido-vertical-mode))
(use-package ido-hacks :quelpa (:stable nil) :requires ido :config (ido-hacks-mode))
(use-package ido-ubiquitous :quelpa :requires ido :config (ido-ubiquitous-mode))

Enjoy!

If you’d like to leave a comment, please email benaiah@mischenko.com