summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmin Bandali <amin@gnu.org>2018-09-02 22:55:59 -0400
committerAmin Bandali <amin@gnu.org>2018-09-02 22:55:59 -0400
commit4d86735ab4d03a75f10bb02ad5828de0bbe168d8 (patch)
treec04c50a7d6b65d4493196d2034710bdc9e0cadb4
parentf54dea25242ffde22ad737b8b6fbe4e4cd72d417 (diff)
downloadconfigs-4d86735ab4d03a75f10bb02ad5828de0bbe168d8.tar.gz
configs-4d86735ab4d03a75f10bb02ad5828de0bbe168d8.tar.xz
configs-4d86735ab4d03a75f10bb02ad5828de0bbe168d8.zip
[emacs] configure Ibuffer
-rw-r--r--init.org60
1 files changed, 59 insertions, 1 deletions
diff --git a/init.org b/init.org
index 206b6be..e7882d5 100644
--- a/init.org
+++ b/init.org
@@ -635,8 +635,8 @@ Enable =winner-mode=.
#+begin_src emacs-lisp
(bind-keys
- ("C-c b B" . ibuffer-list-buffers)
("C-c b k" . kill-this-buffer)
+ ("C-c s s" . save-buffer)
("C-c b s" . save-buffer)
("C-c S" . save-buffer)
("C-c o" . other-window)
@@ -852,6 +852,64 @@ There's no way I could top that, so I won't attempt to.
:hook (eshell-mode . amin|eshell-setup))
#+end_src
+*** 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 . 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
+
* Borg's =layer/essentials=
TODO: break this giant source block down into individual org sections.