Add binding to switch to most recent buffer

This commit is contained in:
Jeremy Dormitzer 2021-02-23 11:07:23 -05:00
parent 2c95b17866
commit c690a853e8

View File

@ -6,7 +6,15 @@
(interactive) (interactive)
(mapc 'kill-buffer (delq (current-buffer) (buffer-list)))) (mapc 'kill-buffer (delq (current-buffer) (buffer-list))))
(defun 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)))
(leader-def-key (leader-def-key
"TAB" #'switch-to-previous-buffer
"b" '(nil :which-key "buffer") "b" '(nil :which-key "buffer")
"bb" #'switch-to-buffer "bb" #'switch-to-buffer
"bd" #'kill-buffer "bd" #'kill-buffer