Add emacs/ibuffer module
And bind 'SPC b i' to ibuffer
This commit is contained in:
parent
5215b79f7a
commit
6e0a93233d
6 changed files with 112 additions and 0 deletions
|
@ -60,6 +60,7 @@
|
||||||
:emacs
|
:emacs
|
||||||
dired ; making dired pretty [functional]
|
dired ; making dired pretty [functional]
|
||||||
electric ; smarter, keyword-based electric-indent
|
electric ; smarter, keyword-based electric-indent
|
||||||
|
ibuffer ; interactive buffer management
|
||||||
vc ; version-control and Emacs, sitting in a tree
|
vc ; version-control and Emacs, sitting in a tree
|
||||||
|
|
||||||
:term
|
:term
|
||||||
|
|
|
@ -65,6 +65,7 @@ Modules that reconfigure or augment packages or features built into Emacs.
|
||||||
|
|
||||||
+ [[file:emacs/dired/README.org][dired]] =+ranger +icons=:
|
+ [[file:emacs/dired/README.org][dired]] =+ranger +icons=:
|
||||||
+ electric:
|
+ electric:
|
||||||
|
+ [[file:emacs/ibuffer/README.org][ibuffer]] =+icons=:
|
||||||
+ vc:
|
+ vc:
|
||||||
|
|
||||||
* :term
|
* :term
|
||||||
|
|
|
@ -596,6 +596,7 @@
|
||||||
(:unless (featurep! :ui workspaces)
|
(:unless (featurep! :ui workspaces)
|
||||||
:desc "Switch buffer" "b" #'switch-to-buffer)
|
:desc "Switch buffer" "b" #'switch-to-buffer)
|
||||||
:desc "Kill buffer" "d" #'kill-current-buffer
|
:desc "Kill buffer" "d" #'kill-current-buffer
|
||||||
|
:desc "ibuffer" "i" #'ibuffer
|
||||||
:desc "Kill buffer" "k" #'kill-current-buffer
|
:desc "Kill buffer" "k" #'kill-current-buffer
|
||||||
:desc "Switch to last buffer" "l" #'evil-switch-to-windows-last-buffer
|
:desc "Switch to last buffer" "l" #'evil-switch-to-windows-last-buffer
|
||||||
:desc "Next buffer" "n" #'next-buffer
|
:desc "Next buffer" "n" #'next-buffer
|
||||||
|
|
36
modules/emacs/ibuffer/README.org
Normal file
36
modules/emacs/ibuffer/README.org
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
#+TITLE: emacs/ibuffer
|
||||||
|
#+DATE: October 20, 2019
|
||||||
|
#+SINCE: v2.1.0
|
||||||
|
#+STARTUP: inlineimages
|
||||||
|
|
||||||
|
* Table of Contents :TOC_3:noexport:
|
||||||
|
- [[#description][Description]]
|
||||||
|
- [[#module-flags][Module Flags]]
|
||||||
|
- [[#plugins][Plugins]]
|
||||||
|
- [[#prerequisites][Prerequisites]]
|
||||||
|
- [[#features][Features]]
|
||||||
|
- [[#configuration][Configuration]]
|
||||||
|
- [[#troubleshooting][Troubleshooting]]
|
||||||
|
|
||||||
|
* Description
|
||||||
|
This module augments ibuffer.
|
||||||
|
|
||||||
|
+ Adds project-based grouping of buffers
|
||||||
|
+ Support for file-type icons
|
||||||
|
+ Uses human-readable file-size
|
||||||
|
|
||||||
|
** Module Flags
|
||||||
|
+ =+icons= Enables filetype icons for buffers
|
||||||
|
|
||||||
|
** Plugins
|
||||||
|
+ [[https://github.com/purcell/ibuffer-projectile][ibuffer-projectile]]
|
||||||
|
+ [[https://github.com/purcell/ibuffer-vc][ibuffer-vc]]
|
||||||
|
|
||||||
|
* Prerequisites
|
||||||
|
This module has no prereqisites.
|
||||||
|
|
||||||
|
* TODO Features
|
||||||
|
|
||||||
|
* TODO Configuration
|
||||||
|
|
||||||
|
* TODO Troubleshooting
|
68
modules/emacs/ibuffer/config.el
Normal file
68
modules/emacs/ibuffer/config.el
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
;;; emacs/ibuffer/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
(after! ibuffer
|
||||||
|
(set-popup-rule! "^\\*Ibuffer\\*$" :ignore t)
|
||||||
|
|
||||||
|
(setq ibuffer-show-empty-filter-groups nil
|
||||||
|
ibuffer-filter-group-name-face '(:inherit (success bold))
|
||||||
|
ibuffer-formats
|
||||||
|
`((mark modified read-only ,(if EMACS26+ 'locked "")
|
||||||
|
,@(if (featurep! +icons)
|
||||||
|
`(;; Here you may adjust by replacing :right with :center
|
||||||
|
;; or :left According to taste, if you want the icon
|
||||||
|
;; further from the name
|
||||||
|
" " (icon 2 2 :left :elide)
|
||||||
|
,(propertize " " 'display `(space :align-to 8)))
|
||||||
|
'(" "))
|
||||||
|
(name 18 18 :left :elide)
|
||||||
|
" " (size 9 -1 :right)
|
||||||
|
" " (mode 16 16 :left :elide)
|
||||||
|
,@(when (require 'ibuffer-vc nil t)
|
||||||
|
'(" " (vc-status 12 :left)))
|
||||||
|
" " filename-and-process)
|
||||||
|
(mark " " (name 16 -1) " " filename)))
|
||||||
|
|
||||||
|
;; Display buffer icons on GUI
|
||||||
|
(define-ibuffer-column icon (:name " ")
|
||||||
|
(let ((icon (if (and (buffer-file-name)
|
||||||
|
(all-the-icons-auto-mode-match?))
|
||||||
|
(all-the-icons-icon-for-file (file-name-nondirectory (buffer-file-name)) :v-adjust -0.05)
|
||||||
|
(all-the-icons-icon-for-mode major-mode :v-adjust -0.05))))
|
||||||
|
(if (symbolp icon)
|
||||||
|
(setq icon (all-the-icons-faicon "file-o" :face 'all-the-icons-dsilver :height 0.8 :v-adjust 0.0))
|
||||||
|
icon)))
|
||||||
|
|
||||||
|
;; Redefine size column to display human readable size
|
||||||
|
(define-ibuffer-column size
|
||||||
|
(:name "Size"
|
||||||
|
:inline t
|
||||||
|
:header-mouse-map ibuffer-size-header-map)
|
||||||
|
(file-size-human-readable (buffer-size)))
|
||||||
|
|
||||||
|
(when (featurep! :completion ivy)
|
||||||
|
(defadvice! +ibuffer-use-counsel-maybe-a (file &optional wildcards)
|
||||||
|
"Use `counsel-find-file' instead of `find-file'."
|
||||||
|
:override #'ibuffer-find-file
|
||||||
|
(interactive)
|
||||||
|
(counsel-find-file
|
||||||
|
(let ((buf (ibuffer-current-buffer)))
|
||||||
|
(if (buffer-live-p buf)
|
||||||
|
(with-current-buffer buf
|
||||||
|
default-directory)
|
||||||
|
default-directory)))))
|
||||||
|
|
||||||
|
(map! :map ibuffer-mode-map :n "q" #'kill-current-buffer))
|
||||||
|
|
||||||
|
|
||||||
|
(use-package! ibuffer-projectile
|
||||||
|
;; Group ibuffer's list by project root
|
||||||
|
:hook (ibuffer . ibuffer-projectile-set-filter-groups)
|
||||||
|
:config
|
||||||
|
(setq ibuffer-projectile-prefix
|
||||||
|
(if (featurep! +icons)
|
||||||
|
(concat (all-the-icons-octicon
|
||||||
|
"file-directory"
|
||||||
|
:face ibuffer-filter-group-name-face
|
||||||
|
:v-adjust -0.05)
|
||||||
|
" ")
|
||||||
|
"Project: ")))
|
5
modules/emacs/ibuffer/packages.el
Normal file
5
modules/emacs/ibuffer/packages.el
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
;; -*- no-byte-compile: t; -*-
|
||||||
|
;;; emacs/ibuffer/packages.el
|
||||||
|
|
||||||
|
(package! ibuffer-projectile)
|
||||||
|
(package! ibuffer-vc)
|
Loading…
Add table
Add a link
Reference in a new issue