New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: show key-binding when calling execute-extended-command with ivy enabled #136
Comments
Sure, just need to write a separate function |
Having an ivy-M-x would be great, but in the meantime I'll give your fork of smex a try. (A bit later). It's very nice indeed. I like how one can look-up key bindings, but it would be nice to see them displayed by default. |
* counsel.el (counsel--format-function-M-x): New defun. Re #136.
Have a look. Let me know what's missing. |
Thanks for adding this. Few comments from few minutes of trying it out:
|
It would be awesome to make |
* counsel.el (counsel-M-x): When smex is present, use it for sorting the candidates. Also use `counsel-describe-map', so that "C-." and "C-," work for commands. Re #136
Added smex sorting and extra bindings. I haven't looked to implementing own sorting so far, since it can be expensive to sort. I'll look into fuzzy matching without a space soon. |
ivy.el (ivy--regex-fuzzy): New defun. To enable fuzzy matching, set your `ivy-re-builders-alist' accordingly: (setq ivy-re-builders-alist '((t . ivy--regex-fuzzy))) Re #136
Thanks, this fuzzy matcher isn't as slow as I thought it would be. |
This is great, thanks a lot! |
You're welcome. |
The "recently used commands" cache stays stale until |
It was simply missing an (defun counsel-M-x (&optional initial-input)
"Ivy version of `execute-extended-command'.
Optional INITIAL-INPUT is the initial input in the minibuffer."
(interactive)
(unless initial-input
(setq initial-input (cdr (assoc this-command
ivy-initial-inputs-alist))))
(let ((ivy-format-function #'counsel--format-function-M-x)
(cands obarray)
(pred 'commandp)
(sort t))
(when (or (featurep 'smex)
(package-installed-p 'smex))
(require 'smex)
(unless smex-initialized-p
(smex-initialize))
(smex-detect-new-commands)
(smex-update)
(setq cands smex-ido-cache)
(setq pred nil)
(setq sort nil))
(ivy-read "M-x " cands
:predicate pred
:require-match t
:history 'extended-command-history
:action (lambda (cmd)
(smex-rank (intern cmd)) ; <-- FIX
(execute-extended-command current-prefix-arg cmd))
:sort sort
:keymap counsel-describe-map
:initial-input initial-input))) |
@kaushalmodi, thanks. But I think intern isn't necessary. |
Ivy meets all my helm needs, while feeling faster, with one small exception: when I use
M-x
I don't see the binding of the command suggested. I have found this to be a great way to learn bindings … Would you consider adding this to ivy?The text was updated successfully, but these errors were encountered: