Evaluating (ivy-mode 0) in a buffer kills ivy across all the other buffers, too. How to stop ivy in a specific buffer only (I don't need it in ERC, where i want TAB to give me a list of all the people in the channel, not just ten of them).

  • Just to be clear - Ivy doesn't truncate the collection of candidates to a size of ten; it displays some arbitrary number of candidates at a time and allows you to navigate through and further narrow the collection.
    – Basil
    Mar 3, 2018 at 14:51

1 Answer 1


How to stop ivy in a specific buffer only

At the time of writing, Ivy is a global minor mode which modifies the variables completing-read-function and completion-in-region-function, and remaps a couple of global buffer switching key bindings.

This means that it is not currently designed to be en/disabled on a per-buffer basis. The closest you can come to achieving this is by reverting the aforementioned variables to their original values buffer-locally. For example:

(defun my-default-completion ()
  "Locally revert completion variables to their default values."
  (setq-local completing-read-function #'completing-read-default)
  (setq-local completion-in-region-function #'completion--in-region))

(add-hook 'some-mode-hook #'my-default-completion)

This will not, of course, affect the globally remapped key bindings.

If you're lucky and know where to look, you can sometimes achieve more granular control of how calls to completing-read are performed under ivy-mode by customising ivy-completing-read-handlers-alist.

I don't think it would be completely unreasonable to file a feature request on the project's issue tracker for a non-global version of ivy-mode.

  • If I was to remap most of Ivy's counsel functionality to certain keys, I wouldn't really need to (ivy-mode 1) at all, would I? What do I need the minor mode for? Mar 3, 2018 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.