Create my-buffer-switch

This commit is contained in:
contrapunctus 2021-08-01 14:23:03 +05:30
parent 80b9874d49
commit f09426d0db
1 changed files with 12 additions and 1 deletions

View File

@ -1329,6 +1329,7 @@ Add these common operations to the hydra -
("i" (find-file "~/.emacs.d/init.org") "open init")
("I" contrapunctus-info-hydra/body "Info")
("k" (kill-buffer (current-buffer)) "kill" :color red)
("m" my-buffer-switch "Switch buffers")
("N" contrapunctus-line-display-hydra/body "line display")
("o" save-buffer "save")
("s" imenu-list "sidebar")
@ -2037,7 +2038,17 @@ and eval it."
("<f1> k" . #'helpful-key)
("<f1> v" . #'helpful-variable)))
#+END_SRC
** ibuffer
** Buffer management
#+BEGIN_SRC emacs-lisp
(defun my-buffer-switch ()
(interactive)
(let ((buffers (remove-if (lambda (buffer)
(or (string-match-p "^ " (buffer-name buffer))
(get-buffer-window-list buffer)))
(buffer-list))))
(switch-to-buffer (first buffers))))
#+END_SRC
*** ibuffer
#+BEGIN_SRC emacs-lisp
(use-package ibuffer
:bind