Add a defcustom to enable minibuffer bindings

This commit is contained in:
Fredrik Bergroth 2017-12-07 12:20:36 +01:00 committed by James N
parent 515a66b335
commit 21e9a7d7bc
3 changed files with 17 additions and 9 deletions

View File

@ -45,7 +45,7 @@ it does not have a mode."
;; then it may conflict with other packages' if they do the same.
(evil-insert 1))
(defun evil-collection-minibuffer-init ()
(defun evil-collection-minibuffer-setup ()
"Initialize minibuffer for `evil'."
;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Text-from-Minibuffer.html
;; WARNING: With lexical binding, lambdas from `mapc' and `dolist' become

View File

@ -27,17 +27,20 @@
;;; Commentary:
;; A set of keybindings for Evil mode.
;;
;; If you want to use Evil in the minibuffer, you'll have to enable it manually.
;; If you want to use Evil in the minibuffer, you'll have to enable it by
;; setting `evil-collection-setup-minibuffer' to t before loading this package.
;; This is so because many users find it confusing.
;;
;; (require 'evil-minibuffer)
;; (evil-minibuffer-init)
;;; Code:
(defgroup evil-collection nil
"A set of keybindings for Evil mode"
:group 'evil)
(defcustom evil-collection-setup-minibuffer nil
"Whether to setup evil bindings in the minibuffer."
:type 'boolean
:group 'evil-collection)
(defcustom evil-collection-mode-list
`(ag
alchemist
@ -75,6 +78,7 @@
ivy
macrostep
man
,@(when evil-collection-setup-minibuffer '(minibuffer))
;; occur is in replace.el which was built-in before Emacs 26.
(occur ,(if (<= emacs-major-version 25) "replace" 'replace))
outline
@ -99,7 +103,8 @@ Elements are either target mode symbols or lists which `car' is the
mode symbol and `cdr' the packages to register.
By default, `minibuffer' is not included because many users find
this confusing."
this confusing. It will be included if
`evil-collection-setup-minibuffer' is set to t."
:type '(repeat (choice symbol sexp))
:group 'evil-collection)

View File

@ -48,11 +48,14 @@ or mode-by-mode, for instance:
The list of supported modes is simply the list of files.
If you want to enable Evil in the minibuffer, you'll have to turn it on
explicitly. This is so because many users find it confusing.
explicitly by customizing ~evil-collection-setup-minibuffer~ to ~t~. This is so
because many users find it confusing.
: (require 'evil-collection-minibuffer)
: (evil-collection-minibuffer-init)
~use-package~ example:
: (use-package evil-collection
: :custom (evil-collection-setup-minibuffer t)
: :init (evil-collection-init))
** Guidelines