Last year I wrote about Eyebrowse, a cool workspace manager that has proven to be a reliable friend until recently. Eyebrowse is a helpful extension, but as it turns out the built-in Ibuffer is enough to make sense of all of the buffers available. I open it with C-x C-b, which is one of the most used key bindings in my everyday Emacs interactions.
Ibuffer presents a customizable list of buffers on which, much like Dired, we can apply different kinds of operations: filter, sort, group, mark, delete, bury, visit. Just press h in Ibuffer to get an idea.
Since I mainly work on projects versioned on Git, ibuffer-vc helps with grouping the buffers in a project-based fashion and operate on them. For instance, to quickly close a project and its related buffers, mark the project header for deletion with d and then press x.
One thing I was missing in Ibuffer was an integration with Magit. I wanted to
magit-status in the project the current buffer (i.e., the buffer where
point is on) belongs to.
(defun mu-ibuffer-magit () "Open `magit-status' for the current buffer." (interactive) (let ((buf (ibuffer-current-buffer t))) (magit-status (cdr (ibuffer-vc-root buf)))))
I’ve bound this function to v in
ibuffer-mode-map. Note that
v was previously calling
ibuffer-do-view, so you may want to pick
the key that suits you best.