I'm coming from Helm to Ivy just to try it out, and one thing I miss greatly from Helm is how the default candidate when hitting M-x is whatever the last command was.

Is there some way to sort Ivy's results by most-recently used?

  • Not exactly what you want but might help: Ivy re-uses the following packages if they are installed: avy, amx or smex, flx, and wgrep. So if you install smex you will have your last used commands at the top.
    – Hubisan
    Commented Dec 3, 2019 at 13:55
  • I would additionally suggest ivy-prescient(github.com/raxod502/prescient.el). Commented Dec 4, 2019 at 20:37
  • @Aquaactress That worked. Thank you! If you turn it into an answer I'll accept it. Commented Dec 5, 2019 at 20:11
  • Update 2022-11-21: the best answer is to use Daniel Mendler's Vertico package with Consult, Marginalia, and Orderless :) Commented Nov 22, 2022 at 6:21

1 Answer 1


I would suggest using ivy-prescient. It is a package that provides sorting and filtering for ivy.

After installing it, you enable it with ivy-prescient-mode.

For more details on it's usage see its usage README section.

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.