evil-collection/evil-collection.el

178 lines
4.4 KiB
EmacsLisp
Raw Normal View History

;;; evil-collection.el --- A set of keybindings for Evil mode -*- lexical-binding: t -*-
2017-11-05 17:05:46 +01:00
;; Copyright (C) 2017 James Nguyen
;; Author: James Nguyen <james@jojojames.com>
;; Pierre Neidhardt <ambrevar@gmail.com>
;; Maintainer: James Nguyen <james@jojojames.com>
;; Pierre Neidhardt <ambrevar@gmail.com>
2017-11-05 17:05:46 +01:00
;; URL: https://github.com/jojojames/evil-collection
;; Version: 0.0.1
;; Package-Requires: ((emacs "25.1") (evil "1.2.13"))
;; Keywords: evil, tools
2017-11-05 17:05:46 +01:00
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; A set of keybindings for Evil mode.
;;
;; 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.
2017-11-05 17:05:46 +01:00
;;; Code:
(require 'evil)
(defvar evil-want-integration)
(if (featurep 'evil-integration)
(if evil-want-integration
2018-01-07 20:04:27 +01:00
(display-warning
'(evil-collection)
2018-01-15 10:52:53 +01:00
"Make sure to set `evil-want-integration' to nil before loading evil \
2018-01-07 20:04:27 +01:00
or evil-collection.")
(display-warning
'(evil-collection)
"`evil-want-integration' was set to nil but not before loading evil."))
(require 'evil-collection-integration))
(defgroup evil-collection nil
"A set of keybindings for Evil mode"
:group 'evil)
(defcustom evil-collection-setup-minibuffer nil
2017-12-07 19:55:13 +01:00
"Whether to setup Evil bindings in the minibuffer."
:type 'boolean
:group 'evil-collection)
(defcustom evil-collection-mode-list
2017-11-10 12:38:08 +01:00
`(ag
2017-11-27 08:47:23 +01:00
alchemist
2017-11-12 02:08:06 +01:00
anaconda-mode
2017-11-08 03:34:48 +01:00
arc-mode
bookmark
2018-01-28 00:47:44 +01:00
(buff-menu "buff-menu")
calendar
cider
2018-01-20 21:47:52 +01:00
cmake-mode
2017-11-12 20:16:09 +01:00
comint
2017-11-11 22:58:26 +01:00
company
compile
custom
2017-11-12 01:39:42 +01:00
cus-theme
2017-11-06 17:51:24 +01:00
debbugs
debug
diff-mode
dired
2017-11-07 07:17:14 +01:00
doc-view
edebug
2017-11-06 17:52:14 +01:00
elfeed
elisp-mode
2017-11-09 05:44:06 +01:00
elisp-refs
2017-11-06 17:52:22 +01:00
emms
epa
eshell
eval-sexp-fu
2018-01-13 20:11:20 +01:00
etags-select
2017-12-13 14:34:51 +01:00
eww
flycheck
2018-01-28 21:13:55 +01:00
free-keys
2017-11-28 08:28:47 +01:00
geiser
ggtags
go-mode
help
2017-11-06 17:52:31 +01:00
helm
ibuffer
image
2017-11-06 17:52:38 +01:00
image+
2017-12-24 19:40:26 +01:00
indium
info
ivy
2018-01-23 07:15:41 +01:00
log-view
2018-01-06 18:48:43 +01:00
lua-mode
2017-12-24 19:30:45 +01:00
kotlin-mode
macrostep
man
,@(when evil-collection-setup-minibuffer '(minibuffer))
neotree
notmuch
2018-01-14 20:30:26 +01:00
nov
2017-11-10 12:38:08 +01:00
;; occur is in replace.el which was built-in before Emacs 26.
(occur ,(if (<= emacs-major-version 25) "replace" 'replace))
outline
p4
(package-menu package)
paren
pass
2017-11-06 17:53:22 +01:00
(pdf pdf-view)
2018-01-20 09:37:48 +01:00
popup
proced
prodigy
profiler
2017-12-13 04:31:20 +01:00
python
2018-01-19 23:41:42 +01:00
quickrun
2017-12-24 20:09:25 +01:00
racer
realgud
2018-01-26 18:38:26 +01:00
reftex
2017-12-24 19:51:55 +01:00
rjsx-mode
2017-12-13 06:45:23 +01:00
robe
2017-12-13 04:45:45 +01:00
ruby-mode
2017-11-28 09:04:18 +01:00
rtags
2018-01-30 02:45:42 +01:00
simple
slime
(term term ansi-term multi-term)
2017-11-11 23:51:25 +01:00
tide
2017-11-06 17:53:33 +01:00
transmission
2017-12-24 19:51:45 +01:00
typescript-mode
2018-01-23 07:15:32 +01:00
vc-annotate
vlf
2018-01-27 22:19:17 +01:00
which-key
woman
2017-11-06 17:53:44 +01:00
xref
(ztree ztree-diff))
"The list of modes which will be evilified by `evil-collection-init'.
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. It will be included if
`evil-collection-setup-minibuffer' is set to t."
:type '(repeat (choice symbol sexp))
:group 'evil-collection)
2017-11-05 17:05:46 +01:00
;;;###autoload
(defun evil-collection-init ()
"Register the Evil bindings for all modes in `evil-collection-mode-list'.
2017-11-05 17:05:46 +01:00
Alternatively, you may register select bindings manually, for
instance:
(with-eval-after-load 'calendar
2017-12-07 02:41:09 +01:00
(require 'evil-collection-calendar)
(evil-collection-calendar-setup))"
2017-11-05 17:05:46 +01:00
(interactive)
(dolist (mode evil-collection-mode-list)
(let ((m mode)
(reqs (list mode)))
(when (listp mode)
(setq m (car mode)
reqs (cdr mode)))
(dolist (req reqs)
(with-eval-after-load req
2017-12-07 02:41:09 +01:00
(require (intern (concat "evil-collection-" (symbol-name m))))
(funcall (intern (concat "evil-collection-" (symbol-name m) "-setup"))))))))
2017-11-05 17:05:46 +01:00
(provide 'evil-collection)
;;; evil-collection.el ends here