Allow users to customise candidate sort order

This commit is contained in:
Basil L. Contovounesios 2018-02-02 17:14:48 +00:00 committed by Eric Danan
parent 9f9b522faf
commit 776ab59b38

View file

@ -305,9 +305,13 @@ With a prefix ARG, invalidate the cache first."
(projectile-current-project-files) (projectile-current-project-files)
:matcher #'counsel--find-file-matcher :matcher #'counsel--find-file-matcher
:require-match t :require-match t
:sort t
:action counsel-projectile-find-file-action :action counsel-projectile-find-file-action
:caller 'counsel-projectile-find-file)) :caller 'counsel-projectile-find-file))
(unless (assq #'counsel-projectile-find-file ivy-sort-functions-alist)
(push (list #'counsel-projectile-find-file) ivy-sort-functions-alist))
(ivy-set-display-transformer (ivy-set-display-transformer
'counsel-projectile-find-file 'counsel-projectile-find-file
'counsel-projectile-find-file-transformer) 'counsel-projectile-find-file-transformer)
@ -354,9 +358,13 @@ With a prefix ARG, invalidate the cache first."
(ivy-read (projectile-prepend-project-name "Find dir: ") (ivy-read (projectile-prepend-project-name "Find dir: ")
(counsel-projectile--project-directories) (counsel-projectile--project-directories)
:require-match t :require-match t
:sort t
:action counsel-projectile-find-dir-action :action counsel-projectile-find-dir-action
:caller 'counsel-projectile-find-dir)) :caller 'counsel-projectile-find-dir))
(unless (assq #'counsel-projectile-find-dir ivy-sort-functions-alist)
(push (list #'counsel-projectile-find-dir) ivy-sort-functions-alist))
;;;; counsel-projectile-switch-to-buffer ;;;; counsel-projectile-switch-to-buffer
(defcustom counsel-projectile-remove-current-buffer nil (defcustom counsel-projectile-remove-current-buffer nil
@ -412,9 +420,13 @@ names as in `ivy--buffer-list', and remove current buffer if
(counsel-projectile--project-buffers) (counsel-projectile--project-buffers)
:matcher #'ivy--switch-buffer-matcher :matcher #'ivy--switch-buffer-matcher
:require-match t :require-match t
:sort t
:action counsel-projectile-switch-to-buffer-action :action counsel-projectile-switch-to-buffer-action
:caller 'counsel-projectile-switch-to-buffer)) :caller 'counsel-projectile-switch-to-buffer))
(unless (assq #'counsel-projectile-switch-to-buffer ivy-sort-functions-alist)
(push (list #'counsel-projectile-switch-to-buffer) ivy-sort-functions-alist))
(ivy-set-display-transformer (ivy-set-display-transformer
'counsel-projectile-switch-to-buffer 'counsel-projectile-switch-to-buffer
'ivy-switch-buffer-transformer) 'ivy-switch-buffer-transformer)
@ -1008,8 +1020,12 @@ action."
(abbreviate-file-name (projectile-project-root))) (abbreviate-file-name (projectile-project-root)))
:action counsel-projectile-switch-project-action :action counsel-projectile-switch-project-action
:require-match t :require-match t
:sort t
:caller 'counsel-projectile-switch-project)) :caller 'counsel-projectile-switch-project))
(unless (assq #'counsel-projectile-switch-project ivy-sort-functions-alist)
(push (list #'counsel-projectile-switch-project) ivy-sort-functions-alist))
;;;; counsel-projectile ;;;; counsel-projectile
(counsel-projectile--defcustom-action (counsel-projectile--defcustom-action
@ -1109,9 +1125,13 @@ If not inside a project, call `counsel-projectile-switch-project'."
(counsel-projectile--project-buffers-and-files) (counsel-projectile--project-buffers-and-files)
:matcher #'counsel-projectile--matcher :matcher #'counsel-projectile--matcher
:require-match t :require-match t
:sort t
:action counsel-projectile-action :action counsel-projectile-action
:caller 'counsel-projectile))) :caller 'counsel-projectile)))
(unless (assq #'counsel-projectile ivy-sort-functions-alist)
(push (list #'counsel-projectile) ivy-sort-functions-alist))
(ivy-set-display-transformer (ivy-set-display-transformer
'counsel-projectile 'counsel-projectile
'counsel-projectile-transformer) 'counsel-projectile-transformer)