Files
emacs/config/ibuffer.org

127 lines
4.6 KiB
Org Mode
Raw Normal View History

* IBuffer
Buffer management is a constant irritation with any editor. After
having a bit of a performance issue when using [[https://github.com/florommel/bufferlo][bufferlo]] I've decided
to try doing something with emacs's built in IBuffer.
This is *heavily* inspired, and mostly outright copied from this [[https://olddeuteronomy.github.io/post/emacs-ibuffer-config/][post]]
by [[https://olddeuteronomy.github.io][The Emacs Cat]].
Icons can make identifying buffers easy at a glance so I think adding
them is pretty handy.
#+begin_src emacs-lisp
(use-package all-the-icons-ibuffer
:ensure t
:after (all-the-icons)
:hook
(ibuffer-mode . all-the-icons-ibuffer-mode))
#+end_src
Now for the main part of the configuration. This provides a nice
logical grouping for buffers. As I use this more I might change
the grouping to be a bit less file type oriented, and lean more
towards use case.
#+begin_src emacs-lisp
(use-package ibuffer :ensure nil
:bind
(("C-x B" . ibuffer))
:config
(setq ibuffer-expert t)
(setq ibuffer-display-summary nil)
(setq ibuffer-use-other-window nil)
(setq ibuffer-show-empty-filter-groups nil)
(setq ibuffer-default-sorting-mode 'filename/process)
(setq ibuffer-title-face 'font-lock-doc-face)
(setq ibuffer-use-header-line t)
(setq ibuffer-default-shrink-to-minimum-size nil)
(setq ibuffer-formats
'((mark modified read-only locked " "
(name 30 30 :left :elide)
" "
(size 9 -1 :right)
" "
(mode 16 16 :left :elide)
" " filename-and-process)
(mark " "
(name 16 -1)
" " filename)))
(setq ibuffer-saved-filter-groups
'(("Main"
("Directories" (mode . dired-mode))
("C++" (or
(mode . c++-mode)
(mode . c++-ts-mode)
(mode . c-mode)
(mode . c-ts-mode)
(mode . c-or-c++-ts-mode)))
("Python" (or
(mode . python-ts-mode)
(mode . c-mode)
(mode . python-mode)))
("Build" (or
(mode . make-mode)
(mode . makefile-gmake-mode)
(name . "^Makefile$")
(mode . change-log-mode)))
("Scripts" (or
(mode . shell-script-mode)
(mode . shell-mode)
(mode . sh-mode)
(mode . lua-mode)
(mode . bat-mode)))
("Config" (or
(mode . conf-mode)
(mode . conf-toml-mode)
(mode . toml-ts-mode)
(mode . conf-windows-mode)
(name . "^\\.clangd$")
(name . "^\\.gitignore$")
(name . "^Doxyfile$")
(name . "^config\\.toml$")
(mode . yaml-mode)))
("Web" (or
(mode . mhtml-mode)
(mode . html-mode)
(mode . web-mode)
(mode . nxml-mode)))
("CSS" (or
(mode . css-mode)
(mode . sass-mode)))
("JS" (or
(mode . js-mode)
(mode . rjsx-mode)))
("Markup" (or
(mode . markdown-mode)
(mode . adoc-mode)))
("Org" (mode . org-mode))
("LaTeX" (name . "\.tex$"))
("Magit" (or
(mode . magit-blame-mode)
(mode . magit-cherry-mode)
(mode . magit-diff-mode)
(mode . magit-log-mode)
(mode . magit-process-mode)
(mode . magit-status-mode)))
("Apps" (or
(mode . elfeed-search-mode)
(mode . elfeed-show-mode)))
("Fundamental" (or
(mode . fundamental-mode)
(mode . text-mode)))
("Emacs" (or
(mode . emacs-lisp-mode)
(name . "^\\*Help\\*$")
(name . "^\\*Custom.*")
(name . "^\\*Org Agenda\\*$")
(name . "^\\*info\\*$")
(name . "^\\*scratch\\*$")
(name . "^\\*Backtrace\\*$")
(name . "^\\*Messages\\*$"))))))
:hook
(ibuffer-mode . (lambda ()
(ibuffer-switch-to-saved-filter-groups "Main")))
)
#+end_src