diff options
-rw-r--r-- | tag-emacs/emacs.d/init.org | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/tag-emacs/emacs.d/init.org b/tag-emacs/emacs.d/init.org index 53b8f0c..c6f638d 100644 --- a/tag-emacs/emacs.d/init.org +++ b/tag-emacs/emacs.d/init.org @@ -1383,7 +1383,7 @@ replace helm and ido. ("<menu>" . counsel-M-x) ("C-c M-x" . execute-extended-command) ("C-x C-f" . counsel-find-file) - ("C-x b" . counsel-switch-to-projectile-buffer)) + ("C-x b" . counsel-switch-to-persp-buffer)) :config (progn (defadvice counsel-find-file (after find-file-sudo activate) "Find file as root if necessary." @@ -1391,16 +1391,14 @@ replace helm and ido. (not (file-writable-p buffer-file-name))) (message "File not writable %s" buffer-file-name) (find-alternate-file (concat "/sudo::" buffer-file-name)))) - (defun counsel-switch-to-projectile-buffer (arg) - "Forward to `projectile-switch-to-buffer'." + (defun counsel-switch-to-persp-buffer (arg) + "Forward to `persp-switch-to-buffer'." (interactive "P") - (if (projectile-project-p) - (ivy-read (format "Switch to buffer [%s]: " (projectile-project-name)) - (projectile-project-buffer-names) - :preselect (buffer-name (other-buffer (current-buffer))) - :action #'ivy--switch-buffer-action - :keymap ivy-switch-buffer-map) - (call-interactively #'ivy-switch-buffer))))) + (ivy-read (format "Switch to buffer [%s]: " (persp-name persp-curr)) + (remq nil (mapcar #'buffer-name (persp-buffers persp-curr))) + :preselect (buffer-name (other-buffer (current-buffer))) + :action #'ivy--switch-buffer-action + :keymap ivy-switch-buffer-map)))) #+END_SRC |