I want to keep the alist ivy-initial-inputs-alist nil after ivy and counsel are loaded. Therefore, I have the following configuration:

(use-package ivy
  :ensure t

  ;; some keybindings

  (setq ivy-initial-inputs-alist nil))

However, this doesn't work after counsel is loaded. When I check the alist value, I get this:

((counsel-minor . "^+")
 (counsel-package . "^+")
 (counsel-org-capture . "^")
 (counsel-M-x . "^")
 (counsel-describe-function . "^")
 (counsel-describe-variable . "^"))
Original value was 
((org-refile . "^")
 (org-agenda-refile . "^")
 (org-capture-refile . "^")
 (Man-completion-table . "^")
 (woman . "^"))

meaning that the alist was set to nil, but counsel set it again later.

The only line that has something to do with ivy-initial-inputs-alist in counsel.el is:

(cl-pushnew '(counsel-package . "^+") ivy-initial-inputs-alist :key #'car)

How can I make the setq persistent?

  • Unfortunately counsel.el currently calls the function ivy-configure defined in ivy.el in order to modify ivy-initial-inputs-alist, e.g. (ivy-configure 'counsel-org-capture :initial-input "^"). I say unfortunately because it's not very nice when simply loading a package can result in changes to user option values.
    – Basil
    Jan 21 '20 at 9:40

You can set it after counsel is loaded with:

(with-eval-after-load 'counsel
  (setq ivy-initial-inputs-alist nil))

See (elisp) Hooks for Loading.

You can achieve the same thing with use-package as follows:

(use-package counsel
  :defer t
  (setq ivy-initial-inputs-alist nil))

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.