Add better support for persp-projectile

This commit is contained in:
Diego Berrocal 2015-03-13 20:06:56 -04:00 committed by syl20bnr
parent 17c2ddf943
commit c2afa9dc3e
2 changed files with 34 additions and 4 deletions

View file

@ -0,0 +1,9 @@
;;; config.el --- Git Layer configuration File for Spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; Variables
(defvar perspective-use-persp-projectile nil
"If non nil the helm-projectile-swtich-project command will create a new perspective for each new project.")

View file

@ -16,8 +16,8 @@ which require an initialization must be listed explicitly in the list.")
persp-set-buffer
persp-kill
persp-remove-buffer
persp-cycle-next
persp-cycle-prev
;; persp-cycle-next
;; persp-cycle-prev
persp-rename
persp-switch
projectile-persp-bridge
@ -65,11 +65,15 @@ which require an initialization must be listed explicitly in the list.")
(persp-switch ,name)
(when initialize ,@body)
(setq persp-last current-perspective)))
(add-hook 'after-init-hook '(lambda ()
(persp-rename "@spacemacs")))
;; Jump to last perspective
;; taken from Magnar Sveen
(defun custom-persp-last ()
(interactive)
(persp-switch (persp-name persp-last)))
;; (defun persp-cycle-next ()
;; "Cycle throught the available perspectives."
;; (interactive)
@ -86,7 +90,24 @@ which require an initialization must be listed explicitly in the list.")
;; (cond ((eq 1 list-size) (persp-switch nil))
;; ((< next-pos 0) (persp-switch (nth (- list-size 1) (persp-all-names))))
;; (t (persp-prev)))))
(eval-after-load 'persp-projectile
'(projectile-persp-bridge helm-projectile))
)
))
(defun perspectives/init-persp-projectile ()
(use-package persp-projectile
:config
(when perspective-use-persp-projectile
(projectile-persp-bridge helm-projectile-switch-project)
(evil-leader/set-key
"ps" 'spacemacs/persp-switch-project)
(defun spacemacs/persp-switch-project ()
(interactive)
(evil-leader/set-key
"ps" 'helm-projectile-persp-switch-project)
(find-file "~/.spacemacs")
(helm-projectile-switch-project)
(persp-add-buffer "*spacemacs*")
(persp-kill "@spacemacs")))
))