Emacs: Remove evil-leader from selected package

Move its config to a separate file.
master
Pierre Neidhardt 2017-07-26 17:46:50 +01:00
parent f852079d82
commit 79f1bb9082
3 changed files with 46 additions and 41 deletions

View File

@ -132,7 +132,7 @@
(with-eval-after-load 'emms (require 'init-emms))
;;; Evil
(nconc package-selected-packages '(evil evil-commentary evil-leader evil-ediff evil-magit evil-mc evil-mc-extras linum-relative evil-mu4e))
(nconc package-selected-packages '(evil evil-commentary evil-ediff evil-magit evil-mc evil-mc-extras linum-relative evil-mu4e))
(when (require 'evil nil t) (require 'init-evil))
;;; Eshell

View File

@ -0,0 +1,39 @@
;;; Evil leader
;; Leader mode and its key must be set before evil-mode.
(evil-leader/set-leader "<SPC>")
(global-evil-leader-mode)
(evil-leader/set-key
"RET" 'eshell-or-new-session
"\\" 'toggle-window-split
;; "a" 'org-agenda
"b" 'buffer-menu
"e" 'find-file
"k" 'kill-this-buffer
"t" 'org-find-first-agenda
"|" 'swap-windows)
(when (fboundp 'magit-status)
;; Since it is an autoload, we cannot use `with-eval-after-load'.
;; Use S-SPC instead of SPC to browse commit details.
(evil-leader/set-key "v" 'magit-status))
(when (fboundp 'emms-smart-browse)
(evil-leader/set-key "A" 'helm-emms)
(evil-leader/set-key "a" 'emms-smart-browse))
(with-eval-after-load 'emms
(evil-leader/set-key
"p" 'emms-pause
"n" 'emms-next))
(with-eval-after-load 'init-helm
(evil-leader/set-key
"b" 'helm-mini
"e" 'helm-find-files
"E" 'helm-find
"g" 'helm-grep-git-or-ag
"G" 'helm-grep-git-all-or-ag
"r" 'helm-resume))
(when (require 'evil-mu4e nil t)
(evil-leader/set-key "m" 'mu4e-headers-unread))
(provide 'init-evil-leader)

View File

@ -21,20 +21,16 @@
(setq linum-relative-current-symbol "")
(linum-relative-toggle))
;; The evil-leader package has that over regular bindings that it centralizes
;; the leader key configuration and automatically makes it available in relevant
;; states. Should we map <leader<leader> to the most used command,
;; e.g. `helm-mini'? Could be misleading.
(require 'evil-leader)
;; Leader mode and its key must be set before evil-mode.
(evil-leader/set-leader "<SPC>")
(global-evil-leader-mode)
(evil-mode 1)
(remove-hook 'evil-insert-state-exit-hook 'expand-abbrev)
;; (setq evil-want-abbrev-expand-on-insert-exit nil)
(setq undo-tree-mode-lighter "")
;; The evil-leader package has that over regular bindings that it centralizes
;; the leader key configuration and automatically makes it available in relevant
;; states. It is not really needed with EXWM however.
(when (require 'evil-leader nil t) (require 'init-evil-leader))
;; Commenting.
;; M-; comments next line in VISUAL. This is because of a different newline
;; definition between Emacs and Vim.
@ -61,35 +57,6 @@ See `eshell' for the numeric prefix ARG."
(require 'org))
(find-file (car org-agenda-files)))
(evil-leader/set-key
"RET" 'eshell-or-new-session
"\\" 'toggle-window-split
;; "a" 'org-agenda
"b" 'buffer-menu
"e" 'find-file
"k" 'kill-this-buffer
"t" 'org-find-first-agenda
"|" 'swap-windows)
(when (fboundp 'magit-status)
;; Since it is an autoload, we cannot use `with-eval-after-load'.
;; Use S-SPC instead of SPC to browse commit details.
(evil-leader/set-key "v" 'magit-status))
(when (fboundp 'emms-smart-browse)
(evil-leader/set-key "A" 'helm-emms)
(evil-leader/set-key "a" 'emms-smart-browse))
(with-eval-after-load 'emms
(evil-leader/set-key
"p" 'emms-pause
"n" 'emms-next))
(with-eval-after-load 'init-helm
(evil-leader/set-key
"b" 'helm-mini
"e" 'helm-find-files
"E" 'helm-find
"g" 'helm-grep-git-or-ag
"G" 'helm-grep-git-all-or-ag
"r" 'helm-resume))
;;; Term mode should be in emacs state. It confuses 'vi' otherwise.
;;; Upstream will not change this:
;;; https://github.com/emacs-evil/evil/issues/854#issuecomment-309085267
@ -190,8 +157,7 @@ See `eshell' for the numeric prefix ARG."
(when (require 'evil-mu4e nil t)
(evil-set-initial-state 'mu4e-compose-mode 'insert)
(defun mu4e-headers-unread () (interactive) (mu4e-headers-search "flag:unread AND NOT flag:trashed"))
(evil-leader/set-key "m" 'mu4e-headers-unread))
(defun mu4e-headers-unread () (interactive) (mu4e-headers-search "flag:unread AND NOT flag:trashed")))
(with-eval-after-load 'init-helm (require 'init-evil-helm))