I installed Counsel/Ivy/Swiper and so far everything works fine. But when I call counsel-M-x via key bind M-x an "^" char is always added. I have no clue why this is happening and how to get rid of it (it does not interfere with the counsel-M-x command, it is just annoying). I'm using emacs on OS X and remapped the Meta key to the Command key (setq mac-command-modifier 'meta), but even with Alt as standard Meta key "^" is automatically inserted when calling counsel-M-x.


I use the basic settings provided here

(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(global-set-key (kbd "M-x") 'counsel-M-x)

2 Answers 2


ivy-initial-inputs-alist is a variable that controls the default minibuffer contents when using ivy (which is used by counsel).

The default "^" string means that if you type something immediately after this string only completion candidates that begin with what you typed are shown.

You can remove this default string in counsel-M-x command with:

(setcdr (assoc 'counsel-M-x ivy-initial-inputs-alist) "")

Or to remove this initial input in all commands:

(setq ivy-initial-inputs-alist nil)
  • 4
    Just to be clear: if you do remove this, it will change the search behavior to match substrings. I think the default of matching only the beginning is useful, and you can just hit space if you do want to search for a ^ substring.
    – glucas
    Feb 15, 2018 at 13:09
  • 3
    @glucas I think your wording is a bit exaggerated - the search behaviour doesn't change (search behaviour is controlled by ivy--regex-function), it's the default initial input that changes. Everyone is free to their preferences there. I, for example, only keep the initial ^ for man/woman.
    – Basil
    Feb 15, 2018 at 15:16
  • 3
    @Basil Fair point, thanks. I mostly wanted to make clear that this is not just a cosmetic change as the OP implies in the question.
    – glucas
    Feb 15, 2018 at 17:49

Setting ivy-initial-inputs-alist to an empty string for counsel-M-x specifically can be done via the M-x customize-option RET ivy-initial-inputs-alist RET interface.

Shown here as a lisp-expression

'((counsel-minor . "^+")
  (counsel-package . "^+")
  (counsel-org-capture . "^")
  (counsel-M-x . "")
  (counsel-describe-symbol . "^")
  (org-refile . "^")
  (org-agenda-refile . "^")
  (org-capture-refile . "^")
  (Man-completion-table . "^")
  (woman . "^"))

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.