Add ivy-persp-switch-project

This commit is contained in:
Alexandr Skurikhin 2016-01-03 01:14:34 +03:00 committed by syl20bnr
parent b0ee301845
commit c7008108f5
2 changed files with 21 additions and 7 deletions

View file

@ -809,13 +809,11 @@ Example: (evil-map visual \"<\" \"<gv\")"
"pT" 'projectile-find-test-file
"py" 'projectile-find-tag)
(when (configuration-layer/package-usedp 'persp-mode)
(if (configuration-layer/layer-usedp 'spacemacs-helm)
(spacemacs/set-leader-keys
"pl" 'spacemacs/helm-persp-switch-project)
(spacemacs/set-leader-keys
"pl" 'spacemacs/ivy-persp-switch-project)
)
))
(if (configuration-layer/layer-usedp 'spacemacs-helm)
((spacemacs/set-leader-keys
"pl" 'spacemacs/helm-persp-switch-project)
(spacemacs/set-leader-keys
"pl" 'spacemacs/ivy-persp-switch-project)))))
:config
(progn
(projectile-global-mode)

View file

@ -118,6 +118,22 @@ perspectives does."
(projectile-switch-project-by-name project)))))))
:buffer "*Projectile Layouts*"))
(defun spacemacs/ivy-persp-switch-project (arg)
(interactive "P")
(ivy-read "Switch to Project Perspective:"
(if (projectile-project-p)
(cons (abbreviate-file-name (projectile-project-root))
(projectile-relevant-known-projects))
projectile-known-projects)
:action (lambda (project)
(let ((persp-reset-windows-on-nil-window-conf t))
(persp-switch project)
(let ((projectile-completion-system 'ivy))
(projectile-switch-project-by-name project))))
)
)
;; Autosave ----------------------------------------------------------------
(defun spacemacs//layout-autosave ()