refactor(emacs): Cleanup

This commit is contained in:
Madeleine Sydney
2025-02-17 02:51:21 -07:00
parent 584cff0bd2
commit 0c2e7d7d6d
2 changed files with 55 additions and 51 deletions

View File

@@ -64,10 +64,8 @@
"If any Evil Ex search highlightings are active, remove them and return t. "If any Evil Ex search highlightings are active, remove them and return t.
Otherwise, nil." Otherwise, nil."
(let ((names '(evil-ex-substitute evil-ex-search))) (let ((names '(evil-ex-substitute evil-ex-search)))
(if (-any #'evil-ex-hl-active-p names) (when (-any #'evil-ex-hl-active-p names)
(progn (evil-ex-nohighlight) (prog1 t (evil-ex-nohighlight)))))
t)
nil)))
(add-hook 'syd-escape-hook #'syd-evil-nohl-h) (add-hook 'syd-escape-hook #'syd-evil-nohl-h)
(general-def (general-def
@@ -91,8 +89,8 @@ Otherwise, nil."
(unless noninteractive (unless noninteractive
(defvar syd-evil-collection-disabled-list (defvar syd-evil-collection-disabled-list
'(anaconda-mode buff-menu calc comint company custom eldoc elisp-mode ert '(anaconda-mode buff-menu calc comint company custom eldoc elisp-mode ert
free-keys helm help image indent kmacro kotlin-mode lispy outline free-keys helm help image indent kmacro kotlin-mode lispy outline
replace shortdoc simple slime tab-bar) replace shortdoc simple slime tab-bar)
"A list of `evil-collection' modules to ignore. See "A list of `evil-collection' modules to ignore. See
`evil-collection-mode-list' for a list of available options.") `evil-collection-mode-list' for a list of available options.")
@@ -109,35 +107,35 @@ Otherwise, nil."
;; It must be updated whenever evil-collection updates theirs. ;; It must be updated whenever evil-collection updates theirs.
(defvar evil-collection-mode-list (defvar evil-collection-mode-list
`(2048-game ag alchemist anaconda-mode apropos arc-mode atomic-chrome `(2048-game ag alchemist anaconda-mode apropos arc-mode atomic-chrome
auto-package-update beginend bluetooth bm bookmark auto-package-update beginend bluetooth bm bookmark
(buff-menu "buff-menu") bufler calc calendar cider citre cmake-mode (buff-menu "buff-menu") bufler calc calendar cider citre cmake-mode
color-rg comint company compile consult corfu crdt (csv "csv-mode") color-rg comint company compile consult corfu crdt (csv "csv-mode")
(custom cus-edit) cus-theme dape dashboard daemons deadgrep debbugs (custom cus-edit) cus-theme dape dashboard daemons deadgrep debbugs
debug devdocs dictionary diff-hl diff-mode dired dired-sidebar debug devdocs dictionary diff-hl diff-mode dired dired-sidebar
disk-usage distel doc-view docker eat ebib ebuku edbi edebug ediff eglot disk-usage distel doc-view docker eat ebib ebuku edbi edebug ediff eglot
elpaca ement explain-pause-mode eldoc elfeed elisp-mode elisp-refs elpaca ement explain-pause-mode eldoc elfeed elisp-mode elisp-refs
elisp-slime-nav embark emms ,@(if (> emacs-major-version 28) '(emoji)) elisp-slime-nav embark emms ,@(if (> emacs-major-version 28) '(emoji))
epa ert eshell eval-sexp-fu evil-mc eww fanyi finder flycheck flymake 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 forge free-keys geiser ggtags git-timemachine gited gnus go-mode gptel
grep guix hackernews helm help helpful hg-histedit hungry-delete hyrolo grep guix hackernews helm help helpful hg-histedit hungry-delete hyrolo
ibuffer (image image-mode) image-dired image+ imenu imenu-list ibuffer (image image-mode) image-dired image+ imenu imenu-list
(indent "indent") indium info ivy js2-mode (indent "indent") indium info ivy js2-mode
,@(if (>= emacs-major-version 30) '(kmacro)) leetcode lispy lms log-edit ,@(if (>= emacs-major-version 30) '(kmacro)) leetcode lispy lms log-edit
log-view lsp-ui-imenu lua-mode kotlin-mode macrostep man log-view lsp-ui-imenu lua-mode kotlin-mode macrostep man
(magit magit-repos magit-submodule) magit-repos magit-section (magit magit-repos magit-submodule) magit-repos magit-section
magit-todos markdown-mode monky mpc mpdel mu4e mu4e-conversation neotree magit-todos markdown-mode monky mpc mpdel mu4e mu4e-conversation neotree
newsticker notmuch nov omnisharp org org-present org-roam osx-dictionary newsticker notmuch nov omnisharp org org-present org-roam osx-dictionary
outline p4 (package-menu package) pass (pdf pdf-tools) popup proced outline p4 (package-menu package) pass (pdf pdf-tools) popup proced
prodigy profiler p-search python quickrun racer racket-describe realgud prodigy profiler p-search python quickrun racer racket-describe realgud
reftex replace restclient rg ripgrep rjsx-mode robe rtags ruby-mode reftex replace restclient rg ripgrep rjsx-mode robe rtags ruby-mode
scheme scroll-lock selectrum sh-script scheme scroll-lock selectrum sh-script
,@(if (> emacs-major-version 27) '(shortdoc)) simple simple-mpc slime ,@(if (> emacs-major-version 27) '(shortdoc)) simple simple-mpc slime
sly smerge-mode snake so-long speedbar tab-bar tablist tar-mode telega sly smerge-mode snake so-long speedbar tab-bar tablist tar-mode telega
(term term ansi-term multi-term) tetris thread tide timer-list (term term ansi-term multi-term) tetris thread tide timer-list
transmission trashed tuareg typescript-mode vc-annotate vc-dir vc-git transmission trashed tuareg typescript-mode vc-annotate vc-dir vc-git
vdiff vertico view vlf vterm vundo w3m wdired wgrep which-key vdiff vertico view vlf vterm vundo w3m wdired wgrep which-key
with-editor woman xref xwidget yaml-mode youtube-dl zmusic with-editor woman xref xwidget yaml-mode youtube-dl zmusic
(ztree ztree-diff))) (ztree ztree-diff)))
(cl-defun syd-evil-collection-init (module &key disabled-modules) (cl-defun syd-evil-collection-init (module &key disabled-modules)
"Initialise evil-collection-MODULE. "Initialise evil-collection-MODULE.
@@ -181,34 +179,34 @@ modules."
;; Emacs loads these two packages immediately, at startup, which needlessly ;; Emacs loads these two packages immediately, at startup, which needlessly
;; convolutes load order for evil-collection-help. ;; convolutes load order for evil-collection-help.
(with-transient-after 'help-mode (with-transient-after 'help-mode
(syd-evil-collection-init 'help)) (syd-evil-collection-init 'help))
(with-transient-after 'Buffer-menu-mode (with-transient-after 'Buffer-menu-mode
(syd-evil-collection-init '(buff-menu "buff-menu"))) (syd-evil-collection-init '(buff-menu "buff-menu")))
(with-transient-after 'calc-mode (with-transient-after 'calc-mode
(syd-evil-collection-init 'calc)) (syd-evil-collection-init 'calc))
(with-transient-after 'image-mode (with-transient-after 'image-mode
(syd-evil-collection-init 'image)) (syd-evil-collection-init 'image))
(with-transient-after 'emacs-lisp-mode (with-transient-after 'emacs-lisp-mode
(syd-evil-collection-init 'elisp-mode)) (syd-evil-collection-init 'elisp-mode))
(with-transient-after 'occur-mode (with-transient-after 'occur-mode
(syd-evil-collection-init 'replace)) (syd-evil-collection-init 'replace))
(with-transient-after 'indent-rigidly (with-transient-after 'indent-rigidly
(syd-evil-collection-init '(indent "indent"))) (syd-evil-collection-init '(indent "indent")))
(when (>= emacs-major-version 30) (when (>= emacs-major-version 30)
(with-transient-after 'kmacro-menu-mode (with-transient-after 'kmacro-menu-mode
(syd-evil-collection-init 'kmacro))) (syd-evil-collection-init 'kmacro)))
(with-transient-after 'minibuffer-setup-hook (with-transient-after 'minibuffer-setup-hook
(when evil-collection-setup-minibuffer (when evil-collection-setup-minibuffer
(syd-evil-collection-init 'minibuffer) (syd-evil-collection-init 'minibuffer)
(evil-collection-minibuffer-insert))) (evil-collection-minibuffer-insert)))
(with-transient-after 'process-menu-mode (with-transient-after 'process-menu-mode
(syd-evil-collection-init '(process-menu simple))) (syd-evil-collection-init '(process-menu simple)))
(with-transient-after 'shortdoc-mode (with-transient-after 'shortdoc-mode
(syd-evil-collection-init 'shortdoc)) (syd-evil-collection-init 'shortdoc))
(with-transient-after 'tabulated-list-mode (with-transient-after 'tabulated-list-mode
(syd-evil-collection-init 'tabulated-list)) (syd-evil-collection-init 'tabulated-list))
(with-transient-after 'tab-bar-mode (with-transient-after 'tab-bar-mode
(syd-evil-collection-init 'tab-bar)) (syd-evil-collection-init 'tab-bar))
;; HACK: Do this ourselves because evil-collection break's ;; HACK: Do this ourselves because evil-collection break's
;; `eval-after-load' load order by loading their target plugin before ;; `eval-after-load' load order by loading their target plugin before

View File

@@ -113,6 +113,11 @@
:maps 'help-mode-map :maps 'help-mode-map
"<escape>" #'syd/escape) "<escape>" #'syd/escape)
;; Insert
(general-def
:prefix-map 'syd-leader-insert-map
"u" #'insert-char)
;; Leader ;; Leader
(general-def (general-def
:keymaps 'syd-leader-map :keymaps 'syd-leader-map
@@ -127,7 +132,8 @@
"f" `("File" . ,syd-leader-file-map) "f" `("File" . ,syd-leader-file-map)
"s" `("Search" . ,syd-leader-search-map) "s" `("Search" . ,syd-leader-search-map)
"h" `("Help" . ,help-map) "h" `("Help" . ,help-map)
"n" `("Notes" . ,syd-leader-notes-map))) "n" `("Notes" . ,syd-leader-notes-map)
"i" `("Insert" . ,syd-leader-insert-map)))
(syd-keybinds-initialise) (syd-keybinds-initialise)