cp-switch-buffer, cp: Preview buffers

Closes #163
This commit is contained in:
Eric Danan 2020-10-12 14:33:48 +01:00
parent 77392cbbc4
commit 7c0dc3a130

View file

@ -580,17 +580,21 @@ This simply applies the same transformer as in `ivy-switch-buffer', which is `iv
(if (and (eq projectile-require-project-root 'prompt) (if (and (eq projectile-require-project-root 'prompt)
(not (projectile-project-p))) (not (projectile-project-p)))
(counsel-projectile-switch-to-buffer-action-switch-project) (counsel-projectile-switch-to-buffer-action-switch-project)
(ivy-read (projectile-prepend-project-name "Switch to buffer: ") (let ((ivy-update-fns-alist
;; We use a collection function so that it is called each '((counsel-projectile-switch-to-buffer . counsel--switch-buffer-update-fn)))
;; time the `ivy-state' is reset. This is needed for the (ivy-unwind-fns-alist
;; "kill buffer" action. '((counsel-projectile-switch-to-buffer . counsel--switch-buffer-unwind))))
#'counsel-projectile--project-buffers (ivy-read (projectile-prepend-project-name "Switch to buffer: ")
:matcher #'ivy--switch-buffer-matcher ;; We use a collection function so that it is called each
:require-match t ;; time the `ivy-state' is reset. This is needed for the
:sort counsel-projectile-sort-buffers ;; "kill buffer" action.
:action counsel-projectile-switch-to-buffer-action #'counsel-projectile--project-buffers
:keymap counsel-projectile-switch-to-buffer-map :matcher #'ivy--switch-buffer-matcher
:caller 'counsel-projectile-switch-to-buffer))) :require-match t
:sort counsel-projectile-sort-buffers
:action counsel-projectile-switch-to-buffer-action
:keymap counsel-projectile-switch-to-buffer-map
:caller 'counsel-projectile-switch-to-buffer))))
(ivy-configure 'counsel-projectile-switch-to-buffer (ivy-configure 'counsel-projectile-switch-to-buffer
:display-transformer-fn #'counsel-projectile-switch-to-buffer-transformer) :display-transformer-fn #'counsel-projectile-switch-to-buffer-transformer)
@ -1532,17 +1536,21 @@ If not inside a project, call `counsel-projectile-switch-project'."
(if (and (eq projectile-require-project-root 'prompt) (if (and (eq projectile-require-project-root 'prompt)
(not (projectile-project-p))) (not (projectile-project-p)))
(counsel-projectile-action-switch-project) (counsel-projectile-action-switch-project)
(projectile-maybe-invalidate-cache arg) (let ((ivy-update-fns-alist
(ivy-read (projectile-prepend-project-name "Load buffer or file: ") '((counsel-projectile . counsel--switch-buffer-update-fn)))
;; We use a collection function so that it is called each (ivy-unwind-fns-alist
;; time the `ivy-state' is reset. This is needed for the '((counsel-projectile . counsel--switch-buffer-unwind))))
;; "kill buffer" action. (projectile-maybe-invalidate-cache arg)
#'counsel-projectile--project-buffers-and-files (ivy-read (projectile-prepend-project-name "Load buffer or file: ")
:matcher #'counsel-projectile--matcher ;; We use a collection function so that it is called each
:require-match t ;; time the `ivy-state' is reset. This is needed for the
:action counsel-projectile-action ;; "kill buffer" action.
:keymap counsel-projectile-map #'counsel-projectile--project-buffers-and-files
:caller 'counsel-projectile))) :matcher #'counsel-projectile--matcher
:require-match t
:action counsel-projectile-action
:keymap counsel-projectile-map
:caller 'counsel-projectile))))
(ivy-configure 'counsel-projectile (ivy-configure 'counsel-projectile
:display-transformer-fn #'counsel-projectile-transformer) :display-transformer-fn #'counsel-projectile-transformer)