summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--emacs.d/init.el29
1 files changed, 28 insertions, 1 deletions
diff --git a/emacs.d/init.el b/emacs.d/init.el
index f0d585b..2cedd4a 100644
--- a/emacs.d/init.el
+++ b/emacs.d/init.el
@@ -168,7 +168,34 @@
   (setq helm-split-window-in-side-p t))
 
 (use-package ibuffer
-  :bind ("C-x C-b" . ibuffer))
+  :ensure t
+  :defer t
+  :bind ("C-x C-b" . ibuffer)
+  :init
+  (setq ibuffer-show-empty-filter-groups nil
+        ibuffer-saved-filter-groups
+        (quote (("default"
+                 ("repl"   (name . "repl"))
+                 ("elisp"  (mode . emacs-lisp-mode))
+                 ("ruby"   (name . "^\\.rb$"))
+                 ("json"   (mode . json-mode))
+                 ("sh"     (mode . sh-mode))
+                 ("lisp"   (mode . lisp-mode))
+                 ("magit"  (mode . magit-mode))
+                 ("python" (mode . python-mode))
+                 ("java"   (mode . java-mode))
+                 ("go"     (mode . go-mode))
+                 ("text"   (mode . text-mode))
+                 ("dired"  (mode . dired-mode))
+                 ("emacs"  (or
+                            (name . "^\\*.*\\*$")
+                            (mode . fundamental-mode)))))))
+
+  (add-hook 'ibuffer-mode-hook  ;; organise by filter-groups
+            '(lambda ()
+               (ibuffer-auto-mode 1)
+               (setq mode-name "≣")
+               (ibuffer-switch-to-saved-filter-groups "default"))))
 
 (use-package json-mode
   :ensure t