This is a mess
I'm sorry. I really wanted to improve my commit discipline. I know. I can't be fucked to comb this diff and split it into 8 properly-ordered commits, like I know I should. I'm not having a good time right now. We'll do better moving forward.
This commit is contained in:
@@ -33,24 +33,168 @@
|
||||
;; These two are required for evil-collection.
|
||||
(setq evil-want-keybinding nil
|
||||
evil-want-integration t)
|
||||
|
||||
:config
|
||||
;; 'M-:' starts off in insert mode, yet initialises with the normal mode
|
||||
;; cursor. Quick fix! }:P
|
||||
(add-hook 'minibuffer-setup-hook
|
||||
#'evil-refresh-cursor)
|
||||
|
||||
;; Unbind 'C-k'. Normally, it inserts digraphs; I have a compose key. It
|
||||
;; often gets in the way of buffers with navigation, e.g. scrolling through
|
||||
;; shell/REPL history, navigating Vertico completions, etc.
|
||||
(keymap-set evil-insert-state-map "C-k" nil)
|
||||
|
||||
;; In imitation of Vim's :mes[sages] command, define an Evil analogue to show
|
||||
;; the echo area.
|
||||
(evil-ex-define-cmd "mes[sages]"
|
||||
#'view-echo-area-messages)
|
||||
|
||||
(evil-mode 1))
|
||||
|
||||
(defvar evil-collection-key-blacklist)
|
||||
|
||||
|
||||
;; A large, community-sourced collection of preconfigured Evil-mode
|
||||
;; integrations.
|
||||
(use-package evil-collection
|
||||
:after evil
|
||||
:defer t
|
||||
:custom (evil-collection-setup-minibuffer t)
|
||||
:config
|
||||
(evil-collection-init))
|
||||
(unless noninteractive
|
||||
(defvar syd-evil-collection-disabled-list
|
||||
'(anaconda-mode buff-menu calc comint company custom eldoc elisp-mode ert
|
||||
free-keys helm help image indent kmacro kotlin-mode lispy outline
|
||||
replace shortdoc simple slime tab-bar)
|
||||
"A list of `evil-collection' modules to ignore. See
|
||||
`evil-collection-mode-list' for a list of available options.")
|
||||
|
||||
;; We do this ourselves.
|
||||
(defvar evil-collection-want-unimpaired-p nil)
|
||||
;; We binds goto-reference on gD and goto-assignments on gA ourselves
|
||||
(defvar evil-collection-want-find-usages-bindings-p nil)
|
||||
;; Reduces keybind conflicts between outline-mode and org-mode (which is
|
||||
;; derived from outline-mode).
|
||||
(defvar evil-collection-outline-enable-in-minor-mode-p nil)
|
||||
;; We handle loading evil-collection ourselves
|
||||
(defvar evil-collection--supported-modes nil)
|
||||
;; This has to be defined here since evil-collection doesn't autoload its own.
|
||||
;; It must be updated whenever evil-collection updates theirs. Here's an easy
|
||||
;; way to update it:
|
||||
(defvar evil-collection-mode-list
|
||||
`(2048-game ag alchemist anaconda-mode apropos arc-mode atomic-chrome
|
||||
auto-package-update beginend bluetooth bm bookmark
|
||||
(buff-menu "buff-menu") bufler calc calendar cider citre cmake-mode
|
||||
color-rg comint company compile consult corfu crdt (csv "csv-mode")
|
||||
(custom cus-edit) cus-theme dape dashboard daemons deadgrep debbugs
|
||||
debug devdocs dictionary diff-hl diff-mode dired dired-sidebar
|
||||
disk-usage distel doc-view docker eat ebib ebuku edbi edebug ediff eglot
|
||||
elpaca ement explain-pause-mode eldoc elfeed elisp-mode elisp-refs
|
||||
elisp-slime-nav embark emms ,@(if (> emacs-major-version 28) '(emoji))
|
||||
epa ert eshell eval-sexp-fu evil-mc eww fanyi finder flycheck flymake
|
||||
forge free-keys geiser ggtags git-timemachine gited gnus go-mode gptel
|
||||
grep guix hackernews helm help helpful hg-histedit hungry-delete hyrolo
|
||||
ibuffer (image image-mode) image-dired image+ imenu imenu-list
|
||||
(indent "indent") indium info ivy js2-mode
|
||||
,@(if (>= emacs-major-version 30) '(kmacro)) leetcode lispy lms log-edit
|
||||
log-view lsp-ui-imenu lua-mode kotlin-mode macrostep man
|
||||
(magit magit-repos magit-submodule) magit-repos magit-section
|
||||
magit-todos markdown-mode monky mpc mpdel mu4e mu4e-conversation neotree
|
||||
newsticker notmuch nov omnisharp org org-present org-roam osx-dictionary
|
||||
outline p4 (package-menu package) pass (pdf pdf-tools) popup proced
|
||||
prodigy profiler p-search python quickrun racer racket-describe realgud
|
||||
reftex replace restclient rg ripgrep rjsx-mode robe rtags ruby-mode
|
||||
scheme scroll-lock selectrum sh-script
|
||||
,@(if (> emacs-major-version 27) '(shortdoc)) simple simple-mpc slime
|
||||
sly smerge-mode snake so-long speedbar tab-bar tablist tar-mode telega
|
||||
(term term ansi-term multi-term) tetris thread tide timer-list
|
||||
transmission trashed tuareg typescript-mode vc-annotate vc-dir vc-git
|
||||
vdiff vertico view vlf vterm vundo w3m wdired wgrep which-key
|
||||
with-editor woman xref xwidget yaml-mode youtube-dl zmusic
|
||||
(ztree ztree-diff)))
|
||||
|
||||
(cl-defun syd-evil-collection-init (module &key disabled-modules)
|
||||
"Initialise evil-collection-MODULE.
|
||||
|
||||
A wrapper for `evil-collection-init' that respects a given list of disabled
|
||||
modules."
|
||||
(let ((module* (or (car-safe module) module)))
|
||||
(unless (memq module* disabled-modules)
|
||||
(message "Loading evil-collection-%s%s"
|
||||
module*
|
||||
(if after-init-time "" " too early! }:("))
|
||||
(with-demoted-errors "error loading evil-collection: %s"
|
||||
(evil-collection-init (list module))))))
|
||||
|
||||
(defun syd-evil-collection-disable-blacklist-a (fn)
|
||||
(let (evil-collection-key-blacklist)
|
||||
(funcall-interactively fn)))
|
||||
|
||||
;; Allow binding to ESC.
|
||||
(advice-add #'evil-collection-vterm-toggle-send-escape
|
||||
:around #'syd-evil-collection-disable-blacklist-a)
|
||||
|
||||
;; These modes belong to packages that Emacs always loads at startup, causing
|
||||
;; evil-collection and it's co-packages to all load immediately. We avoid
|
||||
;; this by loading them after evil-collection has first loaded...
|
||||
(with-eval-after-load 'evil-collection
|
||||
(require 'syd-prelude)
|
||||
(require 'syd-keybinds)
|
||||
;; Don't let evil-collection interfere with certain keys
|
||||
(setq evil-collection-key-blacklist
|
||||
(append (list syd-leader-key syd-localleader-key
|
||||
syd-alt-leader-key)
|
||||
evil-collection-key-blacklist
|
||||
;; Reserved for goto definition; lookup docs; eval; eval
|
||||
;; buffer; movement prefix; movement prefix; escaping };).
|
||||
'("gd" "K" "gr" "gR" "[" "]" "<escape>")))
|
||||
|
||||
(mapc #'syd-evil-collection-init '(comint custom))
|
||||
|
||||
(with-eval-after-load 'evil
|
||||
;; Emacs loads these two packages immediately, at startup, which needlessly
|
||||
;; convolutes load order for evil-collection-help.
|
||||
(with-transient-after 'help-mode
|
||||
(syd-evil-collection-init 'help))
|
||||
(with-transient-after 'Buffer-menu-mode
|
||||
(syd-evil-collection-init '(buff-menu "buff-menu")))
|
||||
(with-transient-after 'calc-mode
|
||||
(syd-evil-collection-init 'calc))
|
||||
(with-transient-after 'image-mode
|
||||
(syd-evil-collection-init 'image))
|
||||
(with-transient-after 'emacs-lisp-mode
|
||||
(syd-evil-collection-init 'elisp-mode))
|
||||
(with-transient-after 'occur-mode
|
||||
(syd-evil-collection-init 'replace))
|
||||
(with-transient-after 'indent-rigidly
|
||||
(syd-evil-collection-init '(indent "indent")))
|
||||
(when (>= emacs-major-version 30)
|
||||
(with-transient-after 'kmacro-menu-mode
|
||||
(syd-evil-collection-init 'kmacro)))
|
||||
(with-transient-after 'minibuffer-setup-hook
|
||||
(when evil-collection-setup-minibuffer
|
||||
(syd-evil-collection-init 'minibuffer)
|
||||
(evil-collection-minibuffer-insert)))
|
||||
(with-transient-after 'process-menu-mode
|
||||
(syd-evil-collection-init '(process-menu simple)))
|
||||
(with-transient-after 'shortdoc-mode
|
||||
(syd-evil-collection-init 'shortdoc))
|
||||
(with-transient-after 'tabulated-list-mode
|
||||
(syd-evil-collection-init 'tabulated-list))
|
||||
(with-transient-after 'tab-bar-mode
|
||||
(syd-evil-collection-init 'tab-bar))
|
||||
|
||||
;; HACK: Do this ourselves because evil-collection break's
|
||||
;; `eval-after-load' load order by loading their target plugin before
|
||||
;; applying keys. This makes it hard for end-users to overwrite these
|
||||
;; keybinds with a simple `after!' or `with-eval-after-load'.
|
||||
(dolist (mode evil-collection-mode-list)
|
||||
(dolist (req (or (cdr-safe mode) (list mode)))
|
||||
(with-eval-after-load req
|
||||
(syd-evil-collection-init
|
||||
mode
|
||||
:disabled-modules syd-evil-collection-disabled-list))))))))
|
||||
|
||||
;; Tim Pope's famous `surround.vim' for Evil.
|
||||
(use-package evil-surround
|
||||
|
||||
Reference in New Issue
Block a user