summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2023-08-06 20:05:34 +0200
committerAlan Pearce2023-08-06 20:13:34 +0200
commiteb896949d088a8429c5521279edf0479bf44453a (patch)
tree263bc196e7335677c43e5c0237680953c015dc68
parent74cd2f42bdac28b252944c52491781b4d3d2c201 (diff)
downloadnixfiles-eb896949d088a8429c5521279edf0479bf44453a.tar.lz
nixfiles-eb896949d088a8429c5521279edf0479bf44453a.tar.zst
nixfiles-eb896949d088a8429c5521279edf0479bf44453a.zip
Emacs: group buffers in ibuffer by project, showing relative path
-rw-r--r--user/emacs/init.el15
-rw-r--r--user/settings/emacs.nix1
2 files changed, 16 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
diff --git a/user/settings/emacs.nix b/user/settings/emacs.nix
index 0e849e71..1303c8ef 100644
--- a/user/settings/emacs.nix
+++ b/user/settings/emacs.nix
@@ -149,6 +149,7 @@ in
         git-timemachine
         goto-chg
         helpful
+        ibuffer-project
         jinx
         just-mode
         justl