* ivy.el (ivy-initial-inputs-alist): New defvar. Customize this to get
an initial input in any command.
(ivy-read): Unless INTIAL-INPUT is given, look it up in
`ivy-initial-inputs-alist' based on `this-command'.
* counsel.el (counsel-M-x-initial-input): Remove defcustom. It's
superseded by `ivy-initial-inputs-alist'.
(counsel-M-x): Update.
Fixes #140
cands
"\n")))
-(defcustom counsel-M-x-initial-input "^"
- "Initial input for `counsel-M-x'."
- :group 'ivy)
-
;;;###autoload
(defun counsel-M-x (&optional initial-input)
"Ivy version of `execute-extended-command'.
Optional INITIAL-INPUT is the initial input in the minibuffer."
(interactive)
- (setq initial-input (or initial-input counsel-M-x-initial-input))
+ (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)
regexps that should match and that should not match as you
like.")
+(defvar ivy-initial-inputs-alist
+ '((org-refile . "^")
+ (counsel-M-x . "^"))
+ "Command to initial input table.")
+
(defcustom ivy-sort-max-size 30000
"Sorting won't be done for collections larger than this."
:type 'integer)
DYNAMIC-COLLECTION is a function to call to update the list of
candidates with each input."
+ (unless initial-input
+ (setq initial-input (cdr (assoc this-command
+ ivy-initial-inputs-alist))))
(setq ivy-last
(make-ivy-state
:prompt prompt