Drop use-package in keybindings.el

I'm attempting to kill that zombie bug about evil-want-keybinding...
This commit is contained in:
William Carroll 2020-08-19 16:34:30 +01:00
parent 39622607ff
commit 53be40b1a6

View file

@ -29,63 +29,68 @@
(require 'buffer) (require 'buffer)
(require 'display) (require 'display)
(require 'device) (require 'device)
(require 'evil-ex)
(use-package evil ;; Note: The following lines must be sorted this way.
:init (setq evil-want-integration t)
;; Should remove the warning messages on init. (setq evil-want-keybinding nil)
(setq evil-want-integration t) (general-evil-setup)
;; TODO: Troubleshoot why this binding causes the following warning: (require 'evil)
;; "Warning (evil-collection): `evil-want-keybinding' was set to nil but not (require 'evil-collection)
;; before loading evil." (require 'evil-magit)
(setq evil-want-keybinding nil) (require 'evil-commentary)
(general-evil-setup) (require 'evil-surround)
:config (require 'key-chord)
;; Ensure that evil's command mode behaves with readline bindings.
(general-define-key ;; Ensure that evil's command mode behaves with readline bindings.
:keymaps 'evil-ex-completion-map (general-define-key
"C-a" #'move-beginning-of-line :keymaps 'evil-ex-completion-map
"C-e" #'move-end-of-line "C-a" #'move-beginning-of-line
"C-k" #'kill-line "C-e" #'move-end-of-line
"C-u" #'evil-delete-whole-line "C-k" #'kill-line
"C-v" #'evil-paste-after "C-u" #'evil-delete-whole-line
"C-d" #'delete-char "C-v" #'evil-paste-after
"C-f" #'forward-char "C-d" #'delete-char
"M-b" #'backward-word "C-f" #'forward-char
"M-f" #'forward-word "M-b" #'backward-word
"M-d" #'kill-word "M-f" #'forward-word
"M-DEL" #'backward-kill-word "M-d" #'kill-word
"C-b" #'backward-char) "M-DEL" #'backward-kill-word
;; TODO: Ensure all of my custom keybindings end up in a single map that is "C-b" #'backward-char)
;; easy to enable or disable.
(general-mmap (general-mmap
:keymaps 'override :keymaps 'override
"RET" #'evil-goto-line "RET" #'evil-goto-line
"H" #'evil-first-non-blank "H" #'evil-first-non-blank
"L" #'evil-end-of-line "L" #'evil-end-of-line
"_" #'ranger "_" #'ranger
"-" #'dired-jump "-" #'dired-jump
"sl" #'wpc/evil-window-vsplit-right "sl" #'wpc/evil-window-vsplit-right
"sh" #'evil-window-vsplit "sh" #'evil-window-vsplit
"sk" #'evil-window-split "sk" #'evil-window-split
"sj" #'wpc/evil-window-split-down) "sj" #'wpc/evil-window-split-down)
(general-nmap
:keymaps 'override (general-nmap
"gd" #'xref-find-definitions :keymaps 'override
;; Wrapping `xref-find-references' in the `let' binding to prevent xref from "gd" #'xref-find-definitions
;; prompting. There are other ways to handle this variable, such as setting ;; Wrapping `xref-find-references' in the `let' binding to prevent xref from
;; it globally with `setq' or buffer-locally with `setq-local'. For now, I ;; prompting. There are other ways to handle this variable, such as setting
;; prefer setting it with `let', which should bind it in the dynamic scope ;; it globally with `setq' or buffer-locally with `setq-local'. For now, I
;; for the duration of the `xref-find-references' function call. ;; prefer setting it with `let', which should bind it in the dynamic scope
"gx" (lambda () ;; for the duration of the `xref-find-references' function call.
(interactive) "gx" (lambda ()
(let ((xref-prompt-for-identifier nil)) (interactive)
(call-interactively #'xref-find-references)))) (let ((xref-prompt-for-identifier nil))
(general-unbind 'motion "M-." "C-p" "<SPC>") (call-interactively #'xref-find-references))))
(general-unbind 'normal "s" "M-." "C-p" "C-n")
(general-unbind 'insert "C-v" "C-d" "C-a" "C-e" "C-n" "C-p" "C-k") (general-unbind 'motion "M-." "C-p" "<SPC>")
(setq evil-symbol-word-search t) (general-unbind 'normal "s" "M-." "C-p" "C-n")
(evil-mode 1)) (general-unbind 'insert "C-v" "C-d" "C-a" "C-e" "C-n" "C-p" "C-k")
(setq evil-symbol-word-search t)
(evil-mode 1)
(evil-collection-init)
(evil-commentary-mode)
(global-evil-surround-mode 1)
;; Ensure the Evil search results get centered vertically. ;; Ensure the Evil search results get centered vertically.
(progn (progn
@ -99,29 +104,8 @@
(after advice-for-evil-search-previous activate) (after advice-for-evil-search-previous activate)
(evil-scroll-line-to-center (line-number-at-pos)))) (evil-scroll-line-to-center (line-number-at-pos))))
(use-package evil-collection (key-chord-mode 1)
:after (evil) (key-chord-define evil-insert-state-map "jk" 'evil-normal-state)
:config
(evil-collection-init))
(use-package evil-magit)
;; create comments easily
(use-package evil-commentary
:after (evil)
:config
(evil-commentary-mode))
(use-package evil-surround
:after (evil)
:config
(global-evil-surround-mode 1))
(use-package key-chord
:after (evil)
:config
(key-chord-mode 1)
(key-chord-define evil-insert-state-map "jk" 'evil-normal-state))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; General KBDs ;; General KBDs