1 ;;; bandali-ibuffer.el --- bandali's Ibuffer setup -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2018-2020 Amin Bandali
5 ;; Author: Amin Bandali <bandali@gnu.org>
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
28 ibuffer-saved-filter-groups
30 ("dired" (mode . dired-mode
))
31 ("org" (mode . org-mode
))
34 (mode . gnus-group-mode
)
35 (mode . gnus-summary-mode
)
36 (mode . gnus-article-mode
)
37 (mode . message-mode
)))
55 (mode . emacs-lisp-mode
)
67 (name .
"^\\*scratch\\*$")
68 (name .
"^\\*Messages\\*$")))
69 ("exwm" (mode . exwm-mode
))
70 ("erc" (mode . erc-mode
))))
72 '((mark modified read-only locked
" "
73 (name 72 72 :left
:elide
)
77 (mode 16 16 :left
:elide
)
78 " " filename-and-process
)
82 (with-eval-after-load 'ibuffer
83 ;; Use human readable Size column instead of original one
84 (define-ibuffer-column size-h
85 (:name
"Size" :inline t
)
87 ((> (buffer-size) 1000000) (format "%7.1fM" (/ (buffer-size) 1000000.0)))
88 ((> (buffer-size) 100000) (format "%7.0fk" (/ (buffer-size) 1000.0)))
89 ((> (buffer-size) 1000) (format "%7.1fk" (/ (buffer-size) 1000.0)))
90 (t (format "%8d" (buffer-size)))))
93 (define-key ibuffer-mode-map
(kbd "P")
94 #'ibuffer-backward-filter-group
)
95 (define-key ibuffer-mode-map
(kbd "N")
96 #'ibuffer-forward-filter-group
)
97 (define-key ibuffer-mode-map
(kbd "M-p")
99 (define-key ibuffer-mode-map
(kbd "M-n")
100 #'ibuffer-do-shell-command-pipe-replace
))
101 ;; global key bindings
102 (global-set-key (kbd "C-x C-b") #'ibuffer
)
104 (declare-function ibuffer-switch-to-saved-filter-groups
"ibuf-ext"
106 (add-hook 'ibuffer-hook
107 (lambda () (ibuffer-switch-to-saved-filter-groups "default")))
109 (provide 'bandali-ibuffer
)
110 ;;; bandali-ibuffer.el ends here