   ;; This may need to be updated frequently, to meet changes upstream
   ;; counsel-ag, counsel-rg and counsel-pt all use this function
   (advice-add #'counsel-ag-function :override #'+ivy*counsel-ag-function))
+
+
+(def-package! counsel-projectile
+  :commands (counsel-projectile-find-file counsel-projectile-find-dir counsel-projectile-switch-to-buffer
+             counsel-projectile-grep counsel-projectile-ag)
+  :init
+  (map! [remap projectile-find-file]        #'counsel-projectile-find-file
+        [remap projectile-find-dir]         #'counsel-projectile-find-dir
+        [remap projectile-switch-to-buffer] #'counsel-projectile-switch-to-buffer
+        [remap projectile-grep]             #'counsel-projectile-grep
+        [remap projectile-ag]               #'counsel-projectile-ag
+        [remap projectile-switch-project]   #'counsel-projectile-switch-project)
+  :config
+  ;; Highlight entries that have been visited
+  (ivy-set-display-transformer #'counsel-projectile-find-file #'+ivy-projectile-find-file-transformer))
 
 
 ;; Used by `counsel-M-x'



(def-package! counsel
  :requires ivy
  :config
  ;; Dim recentf entries that are not in the current project.
  (ivy-set-display-transformer 'counsel-recentf '+ivy-recentf-transformer)
  ;; Highlight entries that have been visited
  (ivy-set-display-transformer 'counsel-projectile-find-file '+ivy-projectile-find-file-transformer)

  (require 'counsel-projectile)
  (setq counsel-find-file-ignore-regexp "\\(?:^[#.]\\)\\|\\(?:[#~]$\\)\\|\\(?:^Icon?\\)")

  ;; Configure `counsel-rg', `counsel-ag' & `counsel-pt'
  (dolist (cmd '(counsel-ag counsel-rg counsel-pt))

  (after! magit     (setq magit-completing-read-function #'ivy-completing-read))
  (after! yasnippet (push #'+ivy-yas-prompt yas-prompt-functions))

  (map! [remap switch-to-buffer]       #'ivy-switch-buffer
        [remap persp-switch-to-buffer] #'+ivy/switch-workspace-buffer
        [remap imenu-anywhere]         #'ivy-imenu-anywhere)

  (nconc ivy-sort-functions-alist
         '((persp-kill-buffer   . nil)
