Emacs: Enable all-the-icons-ivy-rich.
This commit is contained in:
parent
f9dde7ea77
commit
f15ae528bc
|
@ -1,6 +1,6 @@
|
|||
;;; appearance.el --- Configure appearance. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Time-stamp: <2020-02-11T17:48:36+0100>
|
||||
;; Time-stamp: <2020-02-20T18:49:00+0100>
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
|||
|
||||
;; Icon font (required by doom and others).
|
||||
(use-package all-the-icons
|
||||
:pin melpa ; We need > 3.2.0 for all-the-icons-ivy-rich (issue #4).
|
||||
|
||||
:init
|
||||
(defun my/font-installed-p (font-name)
|
||||
"Check if font with FONT-NAME is available."
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; ui.el --- Configure user interfaces. -*- lexical-binding: t; -*-
|
||||
|
||||
;; Time-stamp: <2020-02-19T23:50:35+0100>
|
||||
;; Time-stamp: <2020-02-20T18:49:40+0100>
|
||||
|
||||
;;; Commentary:
|
||||
;; * treemacs
|
||||
|
@ -81,43 +81,15 @@
|
|||
(use-package ivy-rich
|
||||
;; all-the-icons-ivy would override the ivy-rich switch-buffer improvements.
|
||||
:after (all-the-icons-ivy counsel)
|
||||
:config
|
||||
(defun my/ivy-rich-switch-buffer-icon (candidate)
|
||||
"Return icon for `candidate'."
|
||||
(with-current-buffer
|
||||
(get-buffer candidate)
|
||||
(let ((icon (all-the-icons-icon-for-mode major-mode)))
|
||||
(if (symbolp icon)
|
||||
(all-the-icons-icon-for-mode 'fundamental-mode)
|
||||
icon))))
|
||||
|
||||
;; Add icons to buffer switcher.
|
||||
;; <https://github.com/Yevgnen/ivy-rich/issues/37#issuecomment-583033211>
|
||||
(setq ivy-rich-display-transformers-list
|
||||
(plist-put ivy-rich-display-transformers-list 'ivy-switch-buffer
|
||||
'(:columns
|
||||
((my/ivy-rich-switch-buffer-icon (:width 1))
|
||||
(ivy-rich-candidate (:width 0.25))
|
||||
(ivy-rich-switch-buffer-size (:width 0.05 :face font-lock-comment-face))
|
||||
(ivy-rich-switch-buffer-indicators (:width 0.05 :face error :align right))
|
||||
(ivy-rich-switch-buffer-major-mode (:width 0.1 :face font-lock-function-name-face))
|
||||
(ivy-rich-switch-buffer-project (:width 0.15 :face success))
|
||||
(ivy-rich-switch-buffer-path (:width (lambda (x) (ivy-rich-switch-buffer-shorten-path x (ivy-rich-minibuffer-width 0.4))) :face font-lock-keyword-face)))
|
||||
:predicate
|
||||
(lambda (cand) (get-buffer cand))
|
||||
:delimiter "\t"
|
||||
)))
|
||||
|
||||
(ivy-rich-mode 1)
|
||||
(setcdr (assq t ivy-format-functions-alist) #'ivy-format-function-line)
|
||||
:config (ivy-rich-mode 1)
|
||||
)
|
||||
|
||||
;; ;; Use icons in ivy-rich.
|
||||
;; (use-package all-the-icons-ivy-rich
|
||||
;; :pin melpa ; We need > 1.1.0.
|
||||
;; :after (all-the-icons ivy-rich)
|
||||
;; :config (all-the-icons-ivy-rich-mode 1)
|
||||
;; )
|
||||
;; Use icons in ivy-rich.
|
||||
(use-package all-the-icons-ivy-rich
|
||||
:pin melpa ; We need > 1.0.0.
|
||||
:after (all-the-icons ivy-rich)
|
||||
:config (all-the-icons-ivy-rich-mode 1)
|
||||
)
|
||||
|
||||
(use-package ivy-purpose
|
||||
:after (window-purpose)
|
||||
|
|
Loading…
Reference in New Issue
Block a user