              (target (read-file-name (format "%s %s to:" prompt source))))
         (funcall cmd source target 1))))
 
+  (when +ivy-buffer-icons
+    (defun +ivy-reload-icons ()
+      (setq ivy-rich--display-transformers-list
+            (plist-put ivy-rich--display-transformers-list
+                       'ivy-switch-buffer
+                       '(:columns
+                         ((all-the-icons-icon-for-file (:width 2 :align right))
+                                        ; return the icon for the file
+                          (+ivy-rich-buffer-name (:width 30))
+                                        ; return the candidate itself
+                          (ivy-rich-switch-buffer-size (:width 7))
+                                        ; return the buffer size
+                          (ivy-rich-switch-buffer-indicators
+                           (:width 4 :face error :align right))
+                                        ; return the buffer indicators
+                          (ivy-rich-switch-buffer-major-mode
+                           (:width 12 :face warning))
+                                        ; return the major mode info
+                          (ivy-rich-switch-buffer-project
+                           (:width 15 :face success))
+                                        ; return project name using `projectile'
+                          (ivy-rich-switch-buffer-path
+                           (:width (lambda (x)
+                                     (ivy-rich-switch-buffer-shorten-path
+                                      x
+                                      (ivy-rich-minibuffer-width 0.3))))))
+                                        ; return file path relative to project
+                                        ; root or `default-directory' if project
+                                        ; is nil
+                         :predicate
+                         (lambda (cand) (get-buffer cand)))))
+      (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)))))
+      (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)))))
+      (ivy-rich-set-display-transformer)))
+
   ;; Configure `counsel-find-file'
   (ivy-add-actions
    'counsel-find-file

        [remap projectile-switch-project]   #'counsel-projectile-switch-project)
  :config
  ;; no highlighting visited files; slows down the filtering
  (ivy-set-display-transformer #'counsel-projectile-find-file nil))


(def-package! wgrep

   'counsel-ag ; also applies to `counsel-rg' & `counsel-pt'
   '(("O" +ivy-git-grep-other-window-action "open in other window"))))

(def-package! counsel-projectile
  :commands (counsel-projectile-find-file counsel-projectile-find-dir counsel-projectile-switch-to-buffer
             counsel-projectile-grep counsel-projectile-ag counsel-projectile-switch-project)
