Drop support for evil-leader

Preferring to use the `general` package for defining leader-prefixed keybindings
than `evil-leader`.

This TODO has existed for quite awhile, so I'm pleased to finish it!

During the cleanup, I deleted some keybindings that I no longer used.
This commit is contained in:
William Carroll 2020-01-20 12:11:46 +00:00
parent 40742c612a
commit b4a6551dd5
9 changed files with 89 additions and 85 deletions

View file

@ -6,9 +6,18 @@
;;; Code: ;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'macros) (require 'macros)
(require 'alist) (require 'alist)
(require 'list) (require 'list)
(require 'general)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar chrome/install-kbds? t (defvar chrome/install-kbds? t
"If t, install keybinding.") "If t, install keybinding.")
@ -69,10 +78,5 @@ Will open without toolbars if APP-MODE? is t."
:action (lambda (entry) :action (lambda (entry)
(chrome/open-url (cdr entry))))) (chrome/open-url (cdr entry)))))
(when chrome/install-kbds?
(evil-leader/set-key
"cb" #'chrome/browse
"cs" #'chrome/open-splash-pages))
(provide 'chrome) (provide 'chrome)
;;; chrome.el ends here ;;; chrome.el ends here

View file

@ -15,6 +15,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'cycle) (require 'cycle)
(require 'general)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants ;; Constants
@ -84,9 +85,10 @@ Cycle prev otherwise."
(colorscheme/cycle :forward? nil)) (colorscheme/cycle :forward? nil))
;; Keybindings ;; Keybindings
;; TODO: Prefer minor mode definition with a custom keymap.
(when colorscheme/install-kbds? (when colorscheme/install-kbds?
(evil-leader/set-key (general-define-key
:prefix "<SPC>"
:states '(normal)
"Ft" #'colorscheme/next "Ft" #'colorscheme/next
"Pt" #'colorscheme/prev)) "Pt" #'colorscheme/prev))

View file

@ -18,6 +18,7 @@
(require 'cycle) (require 'cycle)
(require 'device) (require 'device)
(require 'maybe) (require 'maybe)
(require 'general)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants ;; Constants
@ -138,7 +139,9 @@ The size of the font is determined by `fonts/size'."
(when fonts/keybindings? (when fonts/keybindings?
(progn (progn
(evil-leader/set-key (general-define-key
:prefix "<SPC>"
:states '(normal)
"Ff" #'fonts/next "Ff" #'fonts/next
"Pf" #'fonts/prev) "Pf" #'fonts/prev)
(general-define-key "s-9" #'fonts/ivy-select) (general-define-key "s-9" #'fonts/ivy-select)

View file

@ -11,6 +11,10 @@
;;; Code: ;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants ;; Constants
(defconst wpc/js-hooks (defconst wpc/js-hooks
'(js-mode-hook web-mode-hook typescript-mode-hook js2-mode-hook rjsx-mode-hook) '(js-mode-hook web-mode-hook typescript-mode-hook js2-mode-hook rjsx-mode-hook)
@ -26,11 +30,6 @@
js-indent-level 2 js-indent-level 2
css-indent-offset 2) css-indent-offset 2)
;; ;; javascript
;; (evil-leader/set-key-for-mode 'rjsx-mode "t" #'wpc/toggle-between-js-test-and-module)
;; (evil-leader/set-key-for-mode 'rjsx-mode "x" #'wpc/toggle-between-js-component-and-store)
;; (evil-leader/set-key-for-mode 'rjsx-mode "u" #'wpc/jump-to-parent-file)
;; Flow for Javascript ;; Flow for Javascript
(use-package add-node-modules-path (use-package add-node-modules-path
:config :config

View file

@ -5,12 +5,17 @@
;; This module hosts my Evil preferences ;; This module hosts my Evil preferences
;; ;;
;; Wish List: ;; Wish List:
;; - drop support for `evil-leader' library in favor of `general.el'
;; - restore support for concise (n <kbd> <function>) instead of `general-mmap' ;; - restore support for concise (n <kbd> <function>) instead of `general-mmap'
;; - restore support for `general-unbind' ;; - restore support for `general-unbind'
;;; Code: ;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'general)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Packages ;; Packages
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -86,13 +91,10 @@
;; kbds for magit is with `evil-magit'. ;; kbds for magit is with `evil-magit'.
(use-package evil-magit) (use-package evil-magit)
;; expose a leader key ;; TODO: Consider moving this to another module.
(use-package evil-leader (general-define-key
:after (evil) :prefix "<SPC>"
:config :states '(normal)
(global-evil-leader-mode 1)
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key
"i" #'counsel-semantic-or-imenu "i" #'counsel-semantic-or-imenu
"I" #'ibuffer "I" #'ibuffer
"hk" #'helpful-callable "hk" #'helpful-callable
@ -113,7 +115,6 @@
"W" #'balance-windows "W" #'balance-windows
"gs" #'magit-status "gs" #'magit-status
"E" #'refine "E" #'refine
"es" #'wpc/create-snippet "es" #'wpc/create-snippet
;; TODO: Replace with `macros/ilambda' when that is working again. ;; TODO: Replace with `macros/ilambda' when that is working again.
"ev" (lambda () (interactive) (wpc/find-file-split "~/.config/nvim/init.vim")) "ev" (lambda () (interactive) (wpc/find-file-split "~/.config/nvim/init.vim"))
@ -124,13 +125,12 @@
"el" (lambda () (interactive) (wpc/find-file-split "~/variables.zsh")) "el" (lambda () (interactive) (wpc/find-file-split "~/variables.zsh"))
"ex" (lambda () (interactive) (wpc/find-file-split "~/.Xresources")) "ex" (lambda () (interactive) (wpc/find-file-split "~/.Xresources"))
"em" (lambda () (interactive) (wpc/find-file-split "~/.tmux.conf")) "em" (lambda () (interactive) (wpc/find-file-split "~/.tmux.conf"))
"l" #'locate "l" #'locate
"L" #'list-packages "L" #'list-packages
"B" #'magit-blame "B" #'magit-blame
"w" #'save-buffer "w" #'save-buffer
"r" #'wpc/evil-replace-under-point "r" #'wpc/evil-replace-under-point
"R" #'deadgrep)) "R" #'deadgrep)
;; create comments easily ;; create comments easily
(use-package evil-commentary (use-package evil-commentary

View file

@ -8,6 +8,16 @@
;;; Code: ;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'general)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst wpc/lisp-mode-hooks (defconst wpc/lisp-mode-hooks
'(lisp-mode-hook '(lisp-mode-hook
emacs-lisp-mode-hook emacs-lisp-mode-hook
@ -92,24 +102,12 @@
:config :config
(general-add-hook 'emacs-lisp-mode #'ielm-mode)) (general-add-hook 'emacs-lisp-mode #'ielm-mode))
;; TODO: Should I be using `general-define-key' or `evil-leader/set-key'? My
;; gut say `general-define-key'.
(general-define-key (general-define-key
:keymaps 'emacs-lisp-mode-map :keymaps 'emacs-lisp-mode-map
:states 'normal
:prefix "<SPC>" :prefix "<SPC>"
"x" #'eval-defun)
(general-define-key
:keymaps 'emacs-lisp-mode-map
:states 'normal :states 'normal
:prefix "<SPC>" "x" #'eval-defun
"X" #'eval-buffer) "X" #'eval-buffer
(general-define-key
:keymaps 'emacs-lisp-mode-map
:states 'normal
:prefix "<SPC>"
"d" (lambda () "d" (lambda ()
(interactive) (interactive)
(with-current-buffer (current-buffer) (with-current-buffer (current-buffer)

View file

@ -289,9 +289,5 @@
(todo/export-to-org todo/today) (todo/export-to-org todo/today)
(alert (string/concat "Exported today's TODOs to: " todo/org-file-path))) (alert (string/concat "Exported today's TODOs to: " todo/org-file-path)))
(when todo/install-kbds?
(evil-leader/set-key
"to" #'todo/orgify-today))
(provide 'todo) (provide 'todo)
;;; todo.el ends here ;;; todo.el ends here

View file

@ -14,6 +14,7 @@
(require 'fs) (require 'fs)
(require 'cycle) (require 'cycle)
(require 'string) (require 'string)
(require 'general)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Library ;; Library
@ -81,7 +82,9 @@
;; constants, etc. with the filename like `wallpaper'. ;; constants, etc. with the filename like `wallpaper'.
(when wallpaper/keybindings? (when wallpaper/keybindings?
(evil-leader/set-key (general-define-key
:prefix "<SPC>"
:states '(normal)
"Fw" #'wallpaper/next "Fw" #'wallpaper/next
"Pw" #'wallpaper/prev)) "Pw" #'wallpaper/prev))

View file

@ -29,7 +29,6 @@ let
evil evil
evil-collection evil-collection
evil-magit evil-magit
evil-leader
evil-commentary evil-commentary
evil-surround evil-surround
key-chord key-chord