Drop support for wpc-keybindings
In favor of keybindings.el! Now I have: - kbd.el: There are no keybindings in this file. It's just a library for working with keybindings in Emacs. - keybindings.el: (hopefully) all of my keybindings for EXWM, evil, etc.
This commit is contained in:
parent
4ae6eff607
commit
3dc7f7758b
3 changed files with 121 additions and 191 deletions
|
|
@ -3,6 +3,14 @@
|
|||
|
||||
;;; Commentary:
|
||||
;; Attempting to centralize my keybindings to simplify my configuration.
|
||||
;;
|
||||
;; I have some expectations about my keybindings. Here are some of those
|
||||
;; defined:
|
||||
;; - In insert mode:
|
||||
;; - C-a: beginning-of-line
|
||||
;; - C-e: end-of-line
|
||||
;; - C-b: backwards-char
|
||||
;; - C-f: forwards-char
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
|
@ -23,10 +31,106 @@
|
|||
(require 'device)
|
||||
(require 'evil-ex)
|
||||
|
||||
(use-package evil
|
||||
:init
|
||||
;; Should remove the warning messages on init.
|
||||
(setq evil-want-integration t)
|
||||
;; TODO: Troubleshoot why this binding causes the following warning:
|
||||
;; "Warning (evil-collection): `evil-want-keybinding' was set to nil but not
|
||||
;; before loading evil."
|
||||
(setq evil-want-keybinding nil)
|
||||
(general-evil-setup)
|
||||
:config
|
||||
;; Ensure that evil's command mode behaves with readline bindings.
|
||||
(general-define-key
|
||||
:keymaps 'evil-ex-completion-map
|
||||
"C-a" #'move-beginning-of-line
|
||||
"C-e" #'move-end-of-line
|
||||
"C-k" #'kill-line
|
||||
"C-u" #'evil-delete-whole-line
|
||||
"C-v" #'evil-paste-after
|
||||
"C-d" #'delete-char
|
||||
"C-f" #'forward-char
|
||||
"M-b" #'backward-word
|
||||
"M-f" #'forward-word
|
||||
"M-d" #'kill-word
|
||||
"M-DEL" #'backward-kill-word
|
||||
"C-b" #'backward-char)
|
||||
;; TODO: Ensure all of my custom keybindings end up in a single map that is
|
||||
;; easy to enable or disable.
|
||||
(general-mmap
|
||||
:keymaps 'override
|
||||
"RET" #'evil-goto-line
|
||||
"H" #'evil-first-non-blank
|
||||
"L" #'evil-end-of-line
|
||||
"_" #'ranger
|
||||
"-" #'dired-jump
|
||||
"sl" #'wpc/evil-window-vsplit-right
|
||||
"sh" #'evil-window-vsplit
|
||||
"sk" #'evil-window-split
|
||||
"sj" #'wpc/evil-window-split-down)
|
||||
(general-nmap
|
||||
:keymaps 'override
|
||||
"gd" #'xref-find-definitions
|
||||
;; Wrapping `xref-find-references' in the `let' binding to prevent xref from
|
||||
;; prompting. There are other ways to handle this variable, such as setting
|
||||
;; it globally with `setq' or buffer-locally with `setq-local'. For now, I
|
||||
;; prefer setting it with `let', which should bind it in the dynamic scope
|
||||
;; for the duration of the `xref-find-references' function call.
|
||||
"gx" (lambda ()
|
||||
(interactive)
|
||||
(let ((xref-prompt-for-identifier nil))
|
||||
(call-interactively #'xref-find-references))))
|
||||
(general-unbind 'motion "M-." "C-p" "<SPC>")
|
||||
(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")
|
||||
(setq evil-symbol-word-search t)
|
||||
(evil-mode 1))
|
||||
|
||||
;; Ensure the Evil search results get centered vertically.
|
||||
(progn
|
||||
(defadvice isearch-update
|
||||
(before advice-for-isearch-update activate)
|
||||
(evil-scroll-line-to-center (line-number-at-pos)))
|
||||
(defadvice evil-search-next
|
||||
(after advice-for-evil-search-next activate)
|
||||
(evil-scroll-line-to-center (line-number-at-pos)))
|
||||
(defadvice evil-search-previous
|
||||
(after advice-for-evil-search-previous activate)
|
||||
(evil-scroll-line-to-center (line-number-at-pos))))
|
||||
|
||||
(use-package evil-collection
|
||||
:after (evil)
|
||||
: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))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Configuration
|
||||
;; General KBDs
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; This may be contraversial, but I never use the prefix key, and I'd prefer to
|
||||
;; have to bound to the readline function that deletes the entire line.
|
||||
(general-unbind "C-u")
|
||||
|
||||
(defmacro keybinding/exwm (c fn)
|
||||
"Bind C to FN using `exwm-input-set-key' with `kbd' applied to C."
|
||||
`(exwm-input-set-key (kbd ,c) ,fn))
|
||||
|
|
@ -42,6 +146,22 @@
|
|||
(keybinding/exwm (kbd/raw 'x11 "s") #'scrot/select)
|
||||
(keybinding/exwm "<C-M-tab>" #'exwm/switch-to-exwm-buffer)
|
||||
|
||||
(general-define-key
|
||||
:keymaps 'override
|
||||
"M-q" #'delete-window
|
||||
"<s-return>" #'toggle-frame-fullscreen
|
||||
"M-h" #'windmove-left
|
||||
"M-l" #'windmove-right
|
||||
"M-k" #'windmove-up
|
||||
"M-j" #'windmove-down
|
||||
"M-q" #'delete-window)
|
||||
|
||||
;; Support pasting in M-:.
|
||||
(general-define-key
|
||||
:keymaps 'read-expression-map
|
||||
"C-v" #'clipboard-yank
|
||||
"C-S-v" #'clipboard-yank)
|
||||
|
||||
(general-define-key
|
||||
:prefix "<SPC>"
|
||||
:states '(normal)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue