+*** Ibuffer
+
+#+begin_src emacs-lisp
+(use-package ibuffer
+ :bind
+ (("C-x C-b" . ibuffer-other-window)
+ ("C-c b B" . ibuffer-other-window)
+ :map ibuffer-mode-map
+ ("P" . ibuffer-backward-filter-group)
+ ("N" . ibuffer-forward-filter-group)
+ ("M-p" . ibuffer-do-print)
+ ("M-n" . ibuffer-do-shell-command-pipe-replace))
+ :config
+ ;; Use human readable Size column instead of original one
+ (define-ibuffer-column size-h
+ (:name "Size" :inline t)
+ (cond
+ ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
+ ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
+ ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
+ (t (format "%8d" (buffer-size)))))
+ :custom
+ (ibuffer-saved-filter-groups
+ '(("default"
+ ("dired" (mode . dired-mode))
+ ("org" (name . "^.*org$"))
+ ("web"
+ (or
+ (mode . web-mode)
+ (mode . css-mode)
+ (mode . scss-mode)
+ (mode . js2-mode)))
+ ("shell"
+ (or
+ (mode . eshell-mode)
+ (mode . shell-mode)))
+ ("notmuch" (name . "\*notmuch\*"))
+ ("programming"
+ (or
+ (mode . python-mode)
+ (mode . c++-mode)
+ (mode . emacs-lisp-mode)))
+ ("emacs"
+ (or
+ (name . "^\\*scratch\\*$")
+ (name . "^\\*Messages\\*$"))))))
+ (ibuffer-formats
+ '((mark modified read-only locked " "
+ (name 18 18 :left :elide)
+ " "
+ (size-h 9 -1 :right)
+ " "
+ (mode 16 16 :left :elide)
+ " " filename-and-process)
+ (mark " "
+ (name 16 -1)
+ " " filename)))
+ :hook (ibuffer . (lambda () (ibuffer-switch-to-saved-filter-groups "default"))))
+#+end_src
+