cp-switch-to-buffer: rewrite actions
This commit is contained in:
parent
48817f369f
commit
6946882e99
1 changed files with 5 additions and 20 deletions
|
|
@ -171,23 +171,9 @@ names as in `ivy--buffer-list'."
|
|||
(lambda (x)
|
||||
(member (car x) buffer-names)))))
|
||||
|
||||
(defun counsel-projectile-action-switch-buffer (buffer &optional other-window)
|
||||
"Switch to BUFFER.
|
||||
|
||||
BUFFER may be a string or nil."
|
||||
(cond
|
||||
((zerop (length buffer))
|
||||
(switch-to-buffer ivy-text nil 'force-same-window))
|
||||
(other-window
|
||||
(switch-to-buffer-other-window buffer))
|
||||
(t
|
||||
(switch-to-buffer buffer nil 'force-same-window))))
|
||||
|
||||
(defun counsel-projectile-action-switch-buffer-other-window (buffer)
|
||||
"Switch to BUFFER in other window.
|
||||
|
||||
BUFFER may be a string or nil."
|
||||
(counsel-projectile-action-switch-buffer buffer t))
|
||||
(defun counsel-projectile-switch-to-buffer-action (buffer)
|
||||
"Switch to BUFFER."
|
||||
(switch-to-buffer buffer nil 'force-same-window))
|
||||
|
||||
;;;###autoload
|
||||
(defun counsel-projectile-switch-to-buffer ()
|
||||
|
|
@ -198,11 +184,11 @@ BUFFER may be a string or nil."
|
|||
:matcher #'ivy--switch-buffer-matcher
|
||||
:require-match t
|
||||
:keymap counsel-projectile-map
|
||||
:action #'counsel-projectile-action-switch-buffer
|
||||
:action #'counsel-projectile-switch-to-buffer-action
|
||||
:caller 'counsel-projectile-switch-to-buffer))
|
||||
|
||||
(defvar counsel-projectile-switch-to-buffer-actions
|
||||
'(("j" counsel-projectile-action-switch-buffer-other-window
|
||||
'(("j" switch-to-buffer-other-window
|
||||
"other window"))
|
||||
"List of actions for `counsel-projecile-switch-to-buffer'. If
|
||||
you modify this variable after loading counsel-projectile, then
|
||||
|
|
@ -292,7 +278,6 @@ hitting \"M-n\" in the minibuffer.")
|
|||
(projectile-prepend-project-name "rg")))
|
||||
(user-error "You're not in a project")))
|
||||
|
||||
|
||||
;;; counsel-projectile-switch-project
|
||||
|
||||
(defun counsel-projectile-switch-project-by-name (project-to-switch)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue