summary refs log tree commit diff
path: root/emacs.d
diff options
context:
space:
mode:
authorFranck Cuny <franck.cuny@gmail.com>2016-10-29 13:14:32 -0700
committerFranck Cuny <franck.cuny@gmail.com>2016-10-29 13:14:32 -0700
commit672802e7609b1ba8d26b2eeae940570df8a3ecfc (patch)
treec36eaccc2d742eae40143488154d22072b1a7f7d /emacs.d
parent[emacs] Ensure go-eldoc and gotest are installed. (diff)
downloademacs.d-672802e7609b1ba8d26b2eeae940570df8a3ecfc.tar.gz
[emacs] Nicer configuration for `ibuffer'.
Group buffers per mode.
Diffstat (limited to '')
-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