new fn: counsel-projectile-find-file-or-buffer

This commit is contained in:
Eric Danan 2016-09-15 09:05:52 +02:00
parent 1f374307bb
commit 9d6018efec

View file

@ -169,6 +169,17 @@ If optional argument VIRTUAL is non-nil, add project files as virtual buffers."
'(("j" counsel-projectile--switch-buffer-other-window-action '(("j" counsel-projectile--switch-buffer-other-window-action
"other window"))) "other window")))
;;; counsel-projectile-find-file-or-buffer
;;;###autoload
(defun counsel-projectile-find-file-or-buffer (&optional arg)
"Visit a project file or buffer.
With a prefix ARG invalidates the cache first."
(interactive)
(projectile-maybe-invalidate-cache arg)
(counsel-projectile-switch-to-buffer t))
;;; counsel-projectile-switch-project ;;; counsel-projectile-switch-project
;;;###autoload ;;;###autoload
@ -235,9 +246,7 @@ With a prefix ARG invokes `projectile-commander' instead of `projectile-switch-p
With a prefix ARG invalidates the cache first." With a prefix ARG invalidates the cache first."
(interactive "P") (interactive "P")
(if (projectile-project-p) (if (projectile-project-p)
(progn (counsel-projectile-find-file-or-buffer arg)
(projectile-maybe-invalidate-cache arg)
(counsel-projectile-switch-to-buffer t))
(counsel-projectile-switch-project))) (counsel-projectile-switch-project)))
;;; key bindings ;;; key bindings