summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-10-12 12:21:18 -0500
committerCraig Jennings <c@cjennings.net>2025-10-12 12:21:18 -0500
commit5db41b5a2dc7107f2d3bd2c226e1dbc3a91719e8 (patch)
tree6a6cc010b076ea68c8b9c7898a8de462e978b151 /modules
parent6977f5424c638dc2ee930020ef746f52f3b3a5db (diff)
refactor: keybindings: Consolidate custom keymap setup
Unbind Flyspell's 'C-;' keybinding. Move the custom-keymap definition to keybindings.el bound 'C-;'
Diffstat (limited to 'modules')
-rw-r--r--modules/custom-functions.el28
-rw-r--r--modules/keybindings.el26
2 files changed, 30 insertions, 24 deletions
diff --git a/modules/custom-functions.el b/modules/custom-functions.el
index 61c6e883..e9a05de3 100644
--- a/modules/custom-functions.el
+++ b/modules/custom-functions.el
@@ -154,26 +154,14 @@ This advice ensures `align-regexp' uses spaces by binding `indent-tabs-mode' to
(advice-remove 'align-regexp #'align-regexp-with-spaces) ; in case this is reloaded
(advice-add 'align-regexp :around #'cj/align-regexp-with-spaces)
-;; Must unbind Flyspell's 'C-;' keybinding before it's assigned to cj/custom-keymap
-(global-unset-key (kbd "C-;"))
-(eval-after-load "flyspell"
- '(define-key flyspell-mode-map (kbd "C-;") nil))
-
-(defvar cj/custom-keymap
- (let ((map (make-sparse-keymap)))
- (define-key map ")" 'cj/jump-to-matching-paren)
- (define-key map "f" 'cj/format-region-or-buffer)
- (define-key map "W" 'cj/count-words-buffer-or-region)
- (define-key map "/" 'cj/replace-fraction-glyphs)
- (define-key map "A" 'align-regexp)
- (define-key map "B" 'toggle-debug-on-error)
- (define-key map "|" 'display-fill-column-indicator-mode)
-
- ;; load debug helpers only on this keybinding
- map)
- "The base key map for custom elisp functions holding miscellaneous functions.
-Other key maps extend from this key map to hold categorized functions.")
-(global-set-key (kbd "C-;") cj/custom-keymap)
+
+(define-key cj/custom-keymap ")" 'cj/jump-to-matching-paren)
+(define-key cj/custom-keymap "f" 'cj/format-region-or-buffer)
+(define-key cj/custom-keymap "W" 'cj/count-words-buffer-or-region)
+(define-key cj/custom-keymap "/" 'cj/replace-fraction-glyphs)
+(define-key cj/custom-keymap "A" 'align-regexp)
+(define-key cj/custom-keymap "B" 'toggle-debug-on-error)
+(define-key cj/custom-keymap "|" 'display-fill-column-indicator-mode)
;;; ---------------------- Whitespace Operations And Keymap ---------------------
diff --git a/modules/keybindings.el b/modules/keybindings.el
index 3d817013..d7af0bb2 100644
--- a/modules/keybindings.el
+++ b/modules/keybindings.el
@@ -3,8 +3,6 @@
;;; Commentary:
-
-
;; Commonly used files should be easy to jump to. The "jump-to" keymap has the
;; "C-c j" prefix and immediately opens files defined in user-constants.el.
@@ -24,6 +22,28 @@
;; remap Shift Backspace to Delete
(global-set-key (kbd "S-<backspace>") 'delete-forward-char)
+;; ------------------------------- Custom Keymap -------------------------------
+
+(defvar cj/custom-keymap
+ (let ((map (make-sparse-keymap)))
+ map)
+ "The base key map for custom elisp functions holding miscellaneous functions.
+Other key maps extend from this key map to hold categorized functions.")
+
+;; Set the global binding
+(global-set-key (kbd "C-;") cj/custom-keymap)
+
+;; Override flyspell's binding when it loads
+(with-eval-after-load 'flyspell
+ (define-key flyspell-mode-map (kbd "C-;") nil))
+
+;; Unnecessary, but leaving here for reference.
+;; Optional: Ensure it stays unbound even if flyspell redefines it
+;; (add-hook 'flyspell-mode-hook
+;; (lambda ()
+;; (define-key flyspell-mode-map (kbd "C-;") nil)))
+
+
;; ------------------------------ Jump To Commands -----------------------------
;; quick access for commonly used files
@@ -50,7 +70,6 @@
(define-key jump-to-keymap (kbd "I")
#'(lambda () (interactive) (find-file emacs-init-file)))
-
;; ---------------------------- Keybinding Discovery ---------------------------
(use-package free-keys
@@ -95,6 +114,5 @@
(message (concat "Seriously, " user-name
"? Use 'C-/'. It's faster."))))
-
(provide 'keybindings)
;;; keybindings.el ends here