From 46f9e37218a7498e57c0bf3e85cc0421e0e7a983 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Tue, 21 Oct 2025 17:34:05 -0500 Subject: feat:custom-misc: added switch to previous buffer C-; SPC --- modules/custom-misc.el | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/custom-misc.el') 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) -- cgit v1.2.3