[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 03e7e70 27/90: counsel.el (counsel-M-x): New command
From: |
Oleh Krehel |
Subject: |
[elpa] master 03e7e70 27/90: counsel.el (counsel-M-x): New command |
Date: |
Tue, 30 Jun 2015 07:28:13 +0000 |
branch: master
commit 03e7e700c26de4b92c70cc7ab1dabc6dcb3b0850
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-M-x): New command
* counsel.el (counsel--format-function-M-x): New defun.
Re #136.
---
counsel.el | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/counsel.el b/counsel.el
index 16c6cf9..097dbdc 100644
--- a/counsel.el
+++ b/counsel.el
@@ -474,6 +474,32 @@ When NO-ASYNC is non-nil, do it synchronously."
(ivy--insert-minibuffer
(ivy--format ivy--all-candidates)))))))))
+(defun counsel--format-function-M-x (cands)
+ "Join CANDS, a list of command names, with newlines.
+If a command is bound, add it's binding after it."
+ (with-selected-window (ivy-state-window ivy-last)
+ (mapconcat (lambda (x)
+ (let ((binding (substitute-command-keys (format "\\[%s]" x))))
+ (if (string-match "^M-x" binding)
+ x
+ (format "%s (%s)" x
+ (propertize binding 'face
'font-lock-keyword-face)))))
+ cands
+ "\n")))
+
+(defun counsel-M-x ()
+ "Ivy version of `execute-extended-command'."
+ (interactive)
+ (let ((ivy-format-function #'counsel--format-function-M-x))
+ (ivy-read "M-x " obarray
+ :predicate 'commandp
+ :require-match t
+ :history 'extended-command-history
+ :action
+ (lambda (cmd)
+ (execute-extended-command current-prefix-arg cmd))
+ :sort t)))
+
(provide 'counsel)
;;; counsel.el ends here
- [elpa] master ecb93a6 18/90: Regexp-quote name of candidate buffer to be preselected, (continued)
- [elpa] master ecb93a6 18/90: Regexp-quote name of candidate buffer to be preselected, Oleh Krehel, 2015/06/30
- [elpa] master 40a938b 21/90: ivy.el (ivy-minibuffer-map): Bind ivy-yank-word to "M-j", Oleh Krehel, 2015/06/30
- [elpa] master 00a1b02 22/90: counsel-git-grep should quote strings better, Oleh Krehel, 2015/06/30
- [elpa] master 52a083e 13/90: ivy.el (ivy-yank-word): New command, Oleh Krehel, 2015/06/30
- [elpa] master 9ae55b4 12/90: ivy.el (ivy-recentf): New command, Oleh Krehel, 2015/06/30
- [elpa] master ed60d31 20/90: Make counsel-git-grep fully async, Oleh Krehel, 2015/06/30
- [elpa] master bef708c 23/90: ivy.el (ivy--switch-buffer-action): Add work-around, Oleh Krehel, 2015/06/30
- [elpa] master 77e7c8f 24/90: Account for minibuffer-depth-indication-mode, Oleh Krehel, 2015/06/30
- [elpa] master 607d943 25/90: Add a hack for kill-buffer and invisible buffer, Oleh Krehel, 2015/06/30
- [elpa] master 3699897 26/90: counsel.el (counsel-symbol-at-point): Improve, Oleh Krehel, 2015/06/30
- [elpa] master 03e7e70 27/90: counsel.el (counsel-M-x): New command,
Oleh Krehel <=
- [elpa] master efa751b 28/90: counsel.el (counsel-M-x): Piggyback on smex for sorting, Oleh Krehel, 2015/06/30
- [elpa] master ebead12 29/90: Add fuzzy matching function, Oleh Krehel, 2015/06/30
- [elpa] master 84e20a3 30/90: Fixup ivy-resume for file completion, Oleh Krehel, 2015/06/30
- [elpa] master d24397b 32/90: counsel.el (counsel-M-x-initial-input): New defcustom, Oleh Krehel, 2015/06/30
- [elpa] master e016d48 31/90: Allow "TAB" to complete when input starts with "^", Oleh Krehel, 2015/06/30
- [elpa] master 7f2cc7c 33/90: counsel.el: Add a bunch of autoload cookies, Oleh Krehel, 2015/06/30
- [elpa] master 165c176 34/90: counsel.el (counsel-find-file-ignore-regexp): Default to nil, Oleh Krehel, 2015/06/30
- [elpa] master 72d4c76 35/90: Replace "C-x 6" with "<f2>" in counsel-M-x, Oleh Krehel, 2015/06/30
- [elpa] master 8c3bf21 36/90: ivy-toggle-calling: Toggle calling "RET" action for current candidate, Oleh Krehel, 2015/06/30
- [elpa] master 39eb7ed 38/90: counsel.el (counsel-M-x): Call smex-initialize, Oleh Krehel, 2015/06/30