summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2025-10-21 17:34:05 -0500
committerCraig Jennings <c@cjennings.net>2025-10-21 17:34:05 -0500
commit46f9e37218a7498e57c0bf3e85cc0421e0e7a983 (patch)
tree7fba13a69520f04ace1272f39100d717488c79ee
parentbd82619011c244e94f01f487b83345f344794e1d (diff)
feat:custom-misc: added switch to previous buffer C-; SPC
-rw-r--r--modules/custom-misc.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/custom-misc.el b/modules/custom-misc.el
index 2e7e5d44..0c6d7ac8 100644
--- a/modules/custom-misc.el
+++ b/modules/custom-misc.el
@@ -60,6 +60,11 @@ Replaces tabs with spaces, deletes trailing whitespace, and reindents."
(delete-trailing-whitespace (point-min) (point-max))))
(message "Formatted %s" (if (use-region-p) "region" "buffer"))))
+(defun cj/switch-to-previous-buffer ()
+ "Switch to previously open buffer.
+Repeated invocations toggle between the two most recently open buffers."
+ (interactive)
+ (switch-to-buffer (other-buffer (current-buffer) 1)))
(defun cj/count-words-buffer-or-region ()
"Count the number of words in the buffer or region.
@@ -116,6 +121,7 @@ to nil."
(keymap-set cj/custom-keymap "W" #'cj/count-words-buffer-or-region)
(keymap-set cj/custom-keymap "/" #'cj/replace-fraction-glyphs)
(keymap-set cj/custom-keymap "A" #'align-regexp)
+(keymap-set cj/custom-keymap "SPC" #'cj/switch-to-previous-buffer)
(keymap-set cj/custom-keymap "|" #'display-fill-column-indicator-mode)
(provide 'custom-misc)