4

As an example, when I use M-x save-buffer Emacs says in the minibuffer:

 You can run the command ‘save-buffer’ with C-x C-s

I'm using Swiper/Ivy; I want to know if there is a way to instruct Ivy to append the keybinding of a command while it shows the completion options; something like save-buffer (C-x C-s).

8

The command counsel-M-x does this for you:

Screenshot of <code>counsel-M-x</code> in action

(ivy) Global key bindings recommends you remap M-x (execute-extended-command) to counsel-M-x in order to avail of its increased Ivy-ness, e.g. via

(when (commandp 'counsel-M-x)
  (global-set-key [remap execute-extended-command] #'counsel-M-x))

Alternatively (and more simply), you can just enable counsel-mode and have it automatically remap various built-in commands, including describe-function and describe-variable, to their fancier counsel counterparts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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