summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
authorAlan Pearce2023-08-06 20:05:34 +0200
committerAlan Pearce2023-08-06 20:13:34 +0200
commiteb896949d088a8429c5521279edf0479bf44453a (patch)
tree263bc196e7335677c43e5c0237680953c015dc68 /user/emacs
parent74cd2f42bdac28b252944c52491781b4d3d2c201 (diff)
downloadnixfiles-eb896949d088a8429c5521279edf0479bf44453a.tar.lz
nixfiles-eb896949d088a8429c5521279edf0479bf44453a.tar.zst
nixfiles-eb896949d088a8429c5521279edf0479bf44453a.zip
Emacs: group buffers in ibuffer by project, showing relative path
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/init.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 4da7f9ab..713932ce 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -925,6 +925,21 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
               (evil-ex-define-cmd "pb" #'project-switch-to-buffer)
               (evil-ex-define-cmd "psw[itch]" #'project-switch-project))))
 
+(use-package ibuffer-project
+  :config (progn
+            (defun ibuffer-project-set-filter-groups ()
+               (setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups))
+               (unless (eq ibuffer-sorting-mode 'project-file-relative)
+                 (ibuffer-do-sort-by-project-file-relative)))
+            (add-hook 'ibuffer-hook #'ibuffer-project-set-filter-groups)
+            (add-to-list 'ibuffer-project-root-functions '(file-remote-p . "Remote"))
+            (setq ibuffer-formats '((mark modified read-only locked " "
+                                          (name 18 18 :left :elide)
+                                          " "
+                                          (size 9 -1 :right)
+                                          " "
+                                          (mode 16 16 :left :elide)
+                                          " " project-file-relative)))))
 (use-package consult-ghq
   :defer 5
   :general (:keymaps 'project-prefix-map