setup ibuffer

master
John Turner 2 years ago
parent 04f350f889
commit 895bccda9e
No known key found for this signature in database
GPG Key ID: 422FE10CC41A94A2

@ -0,0 +1,8 @@
(setq ibuffer-saved-filter-groups
'(("default"
("misc" (name . "^\\*.*$"))
("dired" (mode . dired-mode)))))
(add-hook 'ibuffer-mode-hook (lambda () (ibuffer-switch-to-saved-filter-groups "default")))
(provide 'config-ibuffer-filter-groups)

@ -0,0 +1,16 @@
(define-ibuffer-column size-human-readable
(:name "Size" :inline t)
(let ((size (buffer-size)))
(cond
((> size (expt 1000 4))
(error "buffer is over 1TB large!"))
((> size (expt 1000 3))
(format "%sG" (/ size (expt 1000 3))))
((> size (expt 1000 2))
(format "%sM" (/ size (expt 1000 2))))
((> size 1000)
(format "%sK" (/ size 1000)))
(t
(format "%sB" size)))))
(provide 'config-ibuffer-human-readable-size)

@ -0,0 +1,11 @@
(defvar config-ibuffer-never-show '("^\\*Messages\\*$"
"^\\*Help\\*$"
"^\\*Completions\\*$"
"^\\*Backtrace\\*$"
"^\\*Async-native-compile-log\\*$"))
(mapc (lambda (p)
(add-to-list 'ibuffer-never-show-predicates p))
config-ibuffer-never-show)
(provide 'config-ibuffer-never-show)

@ -0,0 +1,22 @@
(require 'ibuffer)
(require 'ibuf-ext)
(require 'config-ibuffer-human-readable-size)
(require 'config-ibuffer-never-show)
(require 'config-ibuffer-filter-groups)
(setq ibuffer-display-summary nil
ibuffer-expert t)
(setq ibuffer-formats
'((mark modified read-only locked " "
(name 18 18 :left :elide)
" "
(size-human-readable 5 5 :right)
" "
(mode 16 16 :left :elide)
" " filename-and-process)
(mark " "
(name 16 -1)
" " filename)))
(provide 'config-ibuffer)

@ -7,5 +7,6 @@
(global-unset-key (kbd "<C-up>")) (global-unset-key (kbd "<C-up>"))
(global-unset-key (kbd "<C-down>")) (global-unset-key (kbd "<C-down>"))
(global-set-key (kbd "C-x k") 'kill-buffer) (global-set-key (kbd "C-x k") 'kill-buffer)
(global-set-key (kbd "C-x C-b") 'ibuffer)
(provide 'config-keys) (provide 'config-keys)

@ -9,6 +9,7 @@
(add-to-list 'load-path (file-name-concat config-directory "flycheck")) (add-to-list 'load-path (file-name-concat config-directory "flycheck"))
(add-to-list 'load-path (file-name-concat config-directory "flymake")) (add-to-list 'load-path (file-name-concat config-directory "flymake"))
(add-to-list 'load-path (file-name-concat config-directory "garbage-collection")) (add-to-list 'load-path (file-name-concat config-directory "garbage-collection"))
(add-to-list 'load-path (file-name-concat config-directory "ibuffer"))
(add-to-list 'load-path (file-name-concat config-directory "keys")) (add-to-list 'load-path (file-name-concat config-directory "keys"))
(add-to-list 'load-path (file-name-concat config-directory "man")) (add-to-list 'load-path (file-name-concat config-directory "man"))
(add-to-list 'load-path (file-name-concat config-directory "lsp-mode")) (add-to-list 'load-path (file-name-concat config-directory "lsp-mode"))
@ -30,6 +31,7 @@
(require 'config-electric) (require 'config-electric)
(require 'config-flymake) (require 'config-flymake)
(require 'config-garbage-collection) (require 'config-garbage-collection)
(require 'config-ibuffer)
(require 'config-keys) (require 'config-keys)
(require 'config-man) (require 'config-man)
(require 'config-package) (require 'config-package)

Loading…
Cancel
Save