29 lines
741 B
EmacsLisp
29 lines
741 B
EmacsLisp
;; -*- lexical-binding: t; -*-
|
|
|
|
;; Buffer-related configuration
|
|
(defun kill-other-buffers ()
|
|
"Kill all other buffers."
|
|
(interactive)
|
|
(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
|
|
"TAB" #'switch-to-previous-buffer
|
|
"b" '(nil :which-key "buffer")
|
|
"bb" #'switch-to-buffer
|
|
"bd" #'kill-buffer
|
|
"bm" #'kill-other-buffers
|
|
"br" #'rename-buffer)
|
|
|
|
;; A library that provides a hook called on switching buffers
|
|
(use-package switch-buffer-functions
|
|
:demand t)
|
|
|
|
(provide 'init-buffers)
|