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

View file

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

View file

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

View file

@ -11,6 +11,10 @@
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Constants
(defconst wpc/js-hooks
'(js-mode-hook web-mode-hook typescript-mode-hook js2-mode-hook rjsx-mode-hook)
@ -26,11 +30,6 @@
js-indent-level 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
(use-package add-node-modules-path
:config

View file

@ -5,12 +5,17 @@
;; This module hosts my Evil preferences
;;
;; 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 `general-unbind'
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'general)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Packages
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -86,51 +91,46 @@
;; kbds for magit is with `evil-magit'.
(use-package evil-magit)
;; expose a leader key
(use-package evil-leader
:after (evil)
:config
(global-evil-leader-mode 1)
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key
"i" #'counsel-semantic-or-imenu
"I" #'ibuffer
"hk" #'helpful-callable
"hf" #'helpful-function
"hm" #'helpful-macro
"hc" #'helpful-command
"hk" #'helpful-key
"hv" #'helpful-variable
"hp" #'helpful-at-point
"s" #'flyspell-mode
"S" #'sort-lines
"a" #'wpc-terminal/toggle
"=" #'align
"p" #'flycheck-previous-error
"f" #'wpc/find-file
"n" #'flycheck-next-error
"N" #'smerge-next
"W" #'balance-windows
"gs" #'magit-status
"E" #'refine
"es" #'wpc/create-snippet
;; TODO: Replace with `macros/ilambda' when that is working again.
"ev" (lambda () (interactive) (wpc/find-file-split "~/.config/nvim/init.vim"))
"ee" (lambda () (interactive) (wpc/find-file-split "~/.emacs.d/init.el"))
"ez" (lambda () (interactive) (wpc/find-file-split "~/.zshrc"))
"ea" (lambda () (interactive) (wpc/find-file-split "~/aliases.zsh"))
"ef" (lambda () (interactive) (wpc/find-file-split "~/functions.zsh"))
"el" (lambda () (interactive) (wpc/find-file-split "~/variables.zsh"))
"ex" (lambda () (interactive) (wpc/find-file-split "~/.Xresources"))
"em" (lambda () (interactive) (wpc/find-file-split "~/.tmux.conf"))
"l" #'locate
"L" #'list-packages
"B" #'magit-blame
"w" #'save-buffer
"r" #'wpc/evil-replace-under-point
"R" #'deadgrep))
;; TODO: Consider moving this to another module.
(general-define-key
:prefix "<SPC>"
:states '(normal)
"i" #'counsel-semantic-or-imenu
"I" #'ibuffer
"hk" #'helpful-callable
"hf" #'helpful-function
"hm" #'helpful-macro
"hc" #'helpful-command
"hk" #'helpful-key
"hv" #'helpful-variable
"hp" #'helpful-at-point
"s" #'flyspell-mode
"S" #'sort-lines
"a" #'wpc-terminal/toggle
"=" #'align
"p" #'flycheck-previous-error
"f" #'wpc/find-file
"n" #'flycheck-next-error
"N" #'smerge-next
"W" #'balance-windows
"gs" #'magit-status
"E" #'refine
"es" #'wpc/create-snippet
;; TODO: Replace with `macros/ilambda' when that is working again.
"ev" (lambda () (interactive) (wpc/find-file-split "~/.config/nvim/init.vim"))
"ee" (lambda () (interactive) (wpc/find-file-split "~/.emacs.d/init.el"))
"ez" (lambda () (interactive) (wpc/find-file-split "~/.zshrc"))
"ea" (lambda () (interactive) (wpc/find-file-split "~/aliases.zsh"))
"ef" (lambda () (interactive) (wpc/find-file-split "~/functions.zsh"))
"el" (lambda () (interactive) (wpc/find-file-split "~/variables.zsh"))
"ex" (lambda () (interactive) (wpc/find-file-split "~/.Xresources"))
"em" (lambda () (interactive) (wpc/find-file-split "~/.tmux.conf"))
"l" #'locate
"L" #'list-packages
"B" #'magit-blame
"w" #'save-buffer
"r" #'wpc/evil-replace-under-point
"R" #'deadgrep)
;; create comments easily
(use-package evil-commentary

View file

@ -8,6 +8,16 @@
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Dependencies
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'general)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Configuration
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst wpc/lisp-mode-hooks
'(lisp-mode-hook
emacs-lisp-mode-hook
@ -92,24 +102,12 @@
:config
(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
:keymaps 'emacs-lisp-mode-map
:states 'normal
:prefix "<SPC>"
"x" #'eval-defun)
(general-define-key
:keymaps 'emacs-lisp-mode-map
:states 'normal
:prefix "<SPC>"
"X" #'eval-buffer)
(general-define-key
:keymaps 'emacs-lisp-mode-map
:states 'normal
:prefix "<SPC>"
"x" #'eval-defun
"X" #'eval-buffer
"d" (lambda ()
(interactive)
(with-current-buffer (current-buffer)

View file

@ -289,9 +289,5 @@
(todo/export-to-org todo/today)
(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)
;;; todo.el ends here

View file

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

View file

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