completion/ivy: add +icons flag
This replaces +ivy-buffer-icons. Renders #1362 unnecessary.
This commit is contained in:
parent
7c72f6f698
commit
1911f44e66
3 changed files with 57 additions and 45 deletions
|
@ -4,27 +4,27 @@
|
||||||
#+STARTUP: inlineimages
|
#+STARTUP: inlineimages
|
||||||
|
|
||||||
* Table of Contents :TOC_3:noexport:
|
* Table of Contents :TOC_3:noexport:
|
||||||
- [[Description][Description]]
|
- [[#description][Description]]
|
||||||
- [[Module Flags][Module Flags]]
|
- [[#module-flags][Module Flags]]
|
||||||
- [[Plugins][Plugins]]
|
- [[#plugins][Plugins]]
|
||||||
- [[Hacks][Hacks]]
|
- [[#hacks][Hacks]]
|
||||||
- [[Prerequisites][Prerequisites]]
|
- [[#prerequisites][Prerequisites]]
|
||||||
- [[Install][Install]]
|
- [[#install][Install]]
|
||||||
- [[MacOS][MacOS]]
|
- [[#macos][MacOS]]
|
||||||
- [[Arch Linux][Arch Linux]]
|
- [[#arch-linux][Arch Linux]]
|
||||||
- [[Features][Features]]
|
- [[#features][Features]]
|
||||||
- [[Jump-to-file project navigation][Jump-to-file project navigation]]
|
- [[#jump-to-file-project-navigation][Jump-to-file project navigation]]
|
||||||
- [[Project search & replace][Project search & replace]]
|
- [[#project-search--replace][Project search & replace]]
|
||||||
- [[In-buffer searching][In-buffer searching]]
|
- [[#in-buffer-searching][In-buffer searching]]
|
||||||
- [[Task lookup][Task lookup]]
|
- [[#task-lookup][Task lookup]]
|
||||||
- [[Ivy integration for various completing commands][Ivy integration for various completing commands]]
|
- [[#ivy-integration-for-various-completing-commands][Ivy integration for various completing commands]]
|
||||||
- [[General][General]]
|
- [[#general][General]]
|
||||||
- [[Jump to files, buffers or projects)][Jump to files, buffers or projects)]]
|
- [[#jump-to-files-buffers-or-projects][Jump to files, buffers or projects)]]
|
||||||
- [[Search][Search]]
|
- [[#search][Search]]
|
||||||
- [[Configuration][Configuration]]
|
- [[#configuration][Configuration]]
|
||||||
- [[Enable fuzzy/non-fuzzy search for specific commands][Enable fuzzy/non-fuzzy search for specific commands]]
|
- [[#enable-fuzzynon-fuzzy-search-for-specific-commands][Enable fuzzy/non-fuzzy search for specific commands]]
|
||||||
- [[Change the position of the ivy childframe][Change the position of the ivy childframe]]
|
- [[#change-the-position-of-the-ivy-childframe][Change the position of the ivy childframe]]
|
||||||
- [[Troubleshooting][Troubleshooting]]
|
- [[#troubleshooting][Troubleshooting]]
|
||||||
|
|
||||||
* Description
|
* Description
|
||||||
This module provides Ivy integration for a variety of Emacs commands, as well as
|
This module provides Ivy integration for a variety of Emacs commands, as well as
|
||||||
|
@ -40,6 +40,8 @@ lighter, simpler and faster in many cases.
|
||||||
+ =+fuzzy= Enables the fuzzy method for ivy searches.
|
+ =+fuzzy= Enables the fuzzy method for ivy searches.
|
||||||
+ =+childframe= Causes Ivy to display in a floating child frame, above Emacs.
|
+ =+childframe= Causes Ivy to display in a floating child frame, above Emacs.
|
||||||
*This requires GUI Emacs 26.1+*
|
*This requires GUI Emacs 26.1+*
|
||||||
|
+ =+icons= Enables file icons for switch-{buffer,project}/find-file counsel
|
||||||
|
commands.
|
||||||
|
|
||||||
** Plugins
|
** Plugins
|
||||||
+ [[https://github.com/abo-abo/swiper][ivy]]
|
+ [[https://github.com/abo-abo/swiper][ivy]]
|
||||||
|
@ -52,6 +54,7 @@ lighter, simpler and faster in many cases.
|
||||||
+ [[https://github.com/DarwinAwardWinner/amx][amx]]
|
+ [[https://github.com/DarwinAwardWinner/amx][amx]]
|
||||||
+ [[https://github.com/lewang/flx][flx]]* (=+fuzzy=)
|
+ [[https://github.com/lewang/flx][flx]]* (=+fuzzy=)
|
||||||
+ [[https://github.com/tumashu/ivy-posframe][ivy-posframe]]* (=+childframe=)
|
+ [[https://github.com/tumashu/ivy-posframe][ivy-posframe]]* (=+childframe=)
|
||||||
|
+ [[https://github.com/asok/all-the-icons-ivy][all-the-icons-ivy]]* (=+icons=)
|
||||||
|
|
||||||
** Hacks
|
** Hacks
|
||||||
+ Functions with ivy/counsel equivalents have been globally remapped (like
|
+ Functions with ivy/counsel equivalents have been globally remapped (like
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
;;; completion/ivy/config.el -*- lexical-binding: t; -*-
|
;;; completion/ivy/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +ivy-buffer-icons nil
|
|
||||||
"If non-nil, show buffer mode icons in `ivy-switch-buffer' and the like.")
|
|
||||||
|
|
||||||
(defvar +ivy-buffer-preview nil
|
(defvar +ivy-buffer-preview nil
|
||||||
"If non-nil, preview buffers while switching, à la `counsel-switch-buffer'.
|
"If non-nil, preview buffers while switching, à la `counsel-switch-buffer'.
|
||||||
|
|
||||||
|
@ -88,26 +85,12 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
|
|
||||||
|
|
||||||
(def-package! ivy-rich
|
(def-package! ivy-rich
|
||||||
:hook (ivy-mode . ivy-rich-mode)
|
:after ivy
|
||||||
:config
|
:config
|
||||||
(when +ivy-buffer-icons
|
(when (featurep! +icons)
|
||||||
(cl-pushnew '(+ivy-rich-buffer-icon (:width 2 :align right))
|
(cl-pushnew '(all-the-icons-ivy-icon-for-file (:width 2 :align right))
|
||||||
(cadr (plist-get ivy-rich-display-transformers-list
|
(cadr (plist-get ivy-rich-display-transformers-list
|
||||||
'ivy-switch-buffer)))
|
'ivy-switch-buffer))))
|
||||||
(after! counsel-projectile
|
|
||||||
(setq ivy-rich-display-transformers-list
|
|
||||||
(plist-put ivy-rich-display-transformers-list
|
|
||||||
'counsel-projectile-switch-project
|
|
||||||
'(:columns
|
|
||||||
(((lambda (_) (all-the-icons-octicon "file-directory"))
|
|
||||||
(:width 2 :align right))
|
|
||||||
(ivy-rich-candidate)))))
|
|
||||||
(setq ivy-rich-display-transformers-list
|
|
||||||
(plist-put ivy-rich-display-transformers-list
|
|
||||||
'counsel-projectile-find-file
|
|
||||||
'(:columns
|
|
||||||
((all-the-icons-icon-for-file (:width 2 :align right))
|
|
||||||
(ivy-rich-candidate)))))))
|
|
||||||
|
|
||||||
;; Remove built-in coloring of buffer list; we do our own
|
;; Remove built-in coloring of buffer list; we do our own
|
||||||
(setq ivy-switch-buffer-faces-alist nil)
|
(setq ivy-switch-buffer-faces-alist nil)
|
||||||
|
@ -125,7 +108,26 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
(dolist (cmd '(+ivy--switch-buffer counsel-projectile-switch-to-buffer))
|
(dolist (cmd '(+ivy--switch-buffer counsel-projectile-switch-to-buffer))
|
||||||
(setq ivy-rich-display-transformers-list
|
(setq ivy-rich-display-transformers-list
|
||||||
(plist-put ivy-rich-display-transformers-list
|
(plist-put ivy-rich-display-transformers-list
|
||||||
cmd ivy-switch-buffer-transformer)))))
|
cmd ivy-switch-buffer-transformer))))
|
||||||
|
|
||||||
|
;; Reload ivy which so changes to `ivy-rich-display-transformers-list' work
|
||||||
|
(ivy-rich-mode +1))
|
||||||
|
|
||||||
|
|
||||||
|
(def-package! all-the-icons-ivy
|
||||||
|
:when (featurep! +icons)
|
||||||
|
:after ivy
|
||||||
|
:config
|
||||||
|
;; `all-the-icons-ivy' is incompatible with ivy-rich's switch-buffer
|
||||||
|
;; modifications, so we disable them and merge them ourselves
|
||||||
|
(setq all-the-icons-ivy-buffer-commands nil)
|
||||||
|
|
||||||
|
(all-the-icons-ivy-setup)
|
||||||
|
(after! counsel-projectile
|
||||||
|
(let ((all-the-icons-ivy-file-commands '(counsel-projectile
|
||||||
|
counsel-projectile-find-file
|
||||||
|
counsel-projectile-find-dir)))
|
||||||
|
(all-the-icons-ivy-setup))))
|
||||||
|
|
||||||
|
|
||||||
(def-package! counsel
|
(def-package! counsel
|
||||||
|
@ -201,8 +203,12 @@ immediately runs it on the current candidate (ending the ivy session)."
|
||||||
|
|
||||||
|
|
||||||
(def-package! counsel-projectile
|
(def-package! counsel-projectile
|
||||||
:commands (counsel-projectile-find-file counsel-projectile-find-dir counsel-projectile-switch-to-buffer
|
:commands (counsel-projectile-find-file
|
||||||
counsel-projectile-grep counsel-projectile-ag counsel-projectile-switch-project)
|
counsel-projectile-find-dir
|
||||||
|
counsel-projectile-switch-to-buffer
|
||||||
|
counsel-projectile-grep
|
||||||
|
counsel-projectile-ag
|
||||||
|
counsel-projectile-switch-project)
|
||||||
:init
|
:init
|
||||||
(map! [remap projectile-find-file] #'+ivy/projectile-find-file
|
(map! [remap projectile-find-file] #'+ivy/projectile-find-file
|
||||||
[remap projectile-find-dir] #'counsel-projectile-find-dir
|
[remap projectile-find-dir] #'counsel-projectile-find-dir
|
||||||
|
|
|
@ -15,3 +15,6 @@
|
||||||
|
|
||||||
(when (and EMACS26+ (featurep! +childframe))
|
(when (and EMACS26+ (featurep! +childframe))
|
||||||
(package! ivy-posframe))
|
(package! ivy-posframe))
|
||||||
|
|
||||||
|
(when (featurep! +icons)
|
||||||
|
(package! all-the-icons-ivy))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue