2016-03-21 01:48:06 +00:00
|
|
|
|
;;; packages.el --- Spacemacs Layouts Layer packages File for Spacemacs
|
|
|
|
|
;;
|
|
|
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
|
|
|
|
;;
|
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
|
;;
|
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
|
;;
|
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
|
|
(setq spacemacs-layouts-packages
|
|
|
|
|
'(eyebrowse
|
|
|
|
|
helm
|
2016-10-02 07:29:55 +00:00
|
|
|
|
ivy
|
2016-04-13 02:05:24 +00:00
|
|
|
|
persp-mode
|
2016-03-21 01:48:06 +00:00
|
|
|
|
spaceline
|
|
|
|
|
swiper))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-layouts/init-eyebrowse ()
|
|
|
|
|
(use-package eyebrowse
|
|
|
|
|
:init
|
|
|
|
|
(progn
|
2016-03-25 14:37:03 +00:00
|
|
|
|
(setq eyebrowse-wrap-around t)
|
2016-03-21 01:48:06 +00:00
|
|
|
|
(eyebrowse-mode)
|
|
|
|
|
;; transient state
|
|
|
|
|
(spacemacs|transient-state-format-hint workspaces
|
|
|
|
|
spacemacs--workspaces-ts-full-hint
|
|
|
|
|
"\n\n
|
2016-03-30 18:29:55 +00:00
|
|
|
|
Go to^^^^^^ Actions^^
|
|
|
|
|
─────^^^^^^─────────────────────── ───────^^──────────────────────
|
2016-03-21 01:48:06 +00:00
|
|
|
|
[_0_,_9_]^^ nth/new workspace [_d_] close current workspace
|
|
|
|
|
[_C-0_,_C-9_]^^ nth/new workspace [_R_] rename current workspace
|
2016-03-30 18:29:55 +00:00
|
|
|
|
[_<tab>_]^^^^ last workspace [_?_] toggle help\n
|
|
|
|
|
[_l_]^^^^ layouts
|
2016-03-21 01:48:06 +00:00
|
|
|
|
[_n_/_C-l_]^^ next workspace
|
2016-03-30 18:29:55 +00:00
|
|
|
|
[_N_/_p_/_C-h_] prev workspace\n")
|
2016-03-21 01:48:06 +00:00
|
|
|
|
|
|
|
|
|
(spacemacs|define-transient-state workspaces
|
|
|
|
|
:title "Workspaces Transient State"
|
|
|
|
|
:hint-is-doc t
|
|
|
|
|
:dynamic-hint (spacemacs//workspaces-ts-hint)
|
|
|
|
|
:bindings
|
|
|
|
|
("?" spacemacs//workspaces-ts-toggle-hint)
|
|
|
|
|
("0" eyebrowse-switch-to-window-config-0 :exit t)
|
|
|
|
|
("1" eyebrowse-switch-to-window-config-1 :exit t)
|
|
|
|
|
("2" eyebrowse-switch-to-window-config-2 :exit t)
|
|
|
|
|
("3" eyebrowse-switch-to-window-config-3 :exit t)
|
|
|
|
|
("4" eyebrowse-switch-to-window-config-4 :exit t)
|
|
|
|
|
("5" eyebrowse-switch-to-window-config-5 :exit t)
|
|
|
|
|
("6" eyebrowse-switch-to-window-config-6 :exit t)
|
|
|
|
|
("7" eyebrowse-switch-to-window-config-7 :exit t)
|
|
|
|
|
("8" eyebrowse-switch-to-window-config-8 :exit t)
|
|
|
|
|
("9" eyebrowse-switch-to-window-config-9 :exit t)
|
|
|
|
|
("C-0" eyebrowse-switch-to-window-config-0)
|
|
|
|
|
("C-1" eyebrowse-switch-to-window-config-1)
|
|
|
|
|
("C-2" eyebrowse-switch-to-window-config-2)
|
|
|
|
|
("C-3" eyebrowse-switch-to-window-config-3)
|
|
|
|
|
("C-4" eyebrowse-switch-to-window-config-4)
|
|
|
|
|
("C-5" eyebrowse-switch-to-window-config-5)
|
|
|
|
|
("C-6" eyebrowse-switch-to-window-config-6)
|
|
|
|
|
("C-7" eyebrowse-switch-to-window-config-7)
|
|
|
|
|
("C-8" eyebrowse-switch-to-window-config-8)
|
|
|
|
|
("C-9" eyebrowse-switch-to-window-config-9)
|
|
|
|
|
("<tab>" eyebrowse-last-window-config)
|
|
|
|
|
("C-h" eyebrowse-prev-window-config)
|
|
|
|
|
("C-i" eyebrowse-last-window-config)
|
|
|
|
|
("C-l" eyebrowse-next-window-config)
|
|
|
|
|
("d" eyebrowse-close-window-config)
|
2016-03-30 18:29:55 +00:00
|
|
|
|
("l" spacemacs/layouts-transient-state/body :exit t)
|
2016-03-21 01:48:06 +00:00
|
|
|
|
("n" eyebrowse-next-window-config)
|
|
|
|
|
("N" eyebrowse-prev-window-config)
|
|
|
|
|
("p" eyebrowse-prev-window-config)
|
|
|
|
|
("R" spacemacs/workspaces-ts-rename :exit t)
|
|
|
|
|
("w" eyebrowse-switch-to-window-config :exit t))
|
2016-03-25 05:12:30 +00:00
|
|
|
|
;; note: we don't need to declare the `SPC l w' binding, it is
|
|
|
|
|
;; declare in the layout transient state
|
|
|
|
|
(spacemacs/set-leader-keys "bW" 'spacemacs/goto-buffer-workspace)
|
2016-03-21 01:48:06 +00:00
|
|
|
|
;; hooks
|
|
|
|
|
(add-hook 'persp-before-switch-functions
|
|
|
|
|
#'spacemacs/update-eyebrowse-for-perspective)
|
|
|
|
|
(add-hook 'eyebrowse-post-window-switch-hook
|
|
|
|
|
#'spacemacs/save-eyebrowse-for-perspective)
|
2016-04-23 08:22:15 +00:00
|
|
|
|
(add-hook 'persp-activated-functions
|
2016-03-21 01:48:06 +00:00
|
|
|
|
#'spacemacs/load-eyebrowse-for-perspective)
|
2016-10-01 08:29:14 +00:00
|
|
|
|
(add-hook 'persp-before-save-state-to-file-functions #'spacemacs/update-eyebrowse-for-perspective)
|
|
|
|
|
(add-hook 'persp-after-load-state-functions #'spacemacs/load-eyebrowse-after-loading-layout)
|
2016-03-21 01:48:06 +00:00
|
|
|
|
;; vim-style tab switching
|
|
|
|
|
(define-key evil-motion-state-map "gt" 'eyebrowse-next-window-config)
|
|
|
|
|
(define-key evil-motion-state-map "gT" 'eyebrowse-prev-window-config))))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-layouts/post-init-helm ()
|
|
|
|
|
(spacemacs/set-leader-keys
|
2016-10-02 07:29:55 +00:00
|
|
|
|
"Bb" 'spacemacs-layouts/non-restricted-buffer-list-helm
|
2016-03-21 01:48:06 +00:00
|
|
|
|
"pl" 'spacemacs/helm-persp-switch-project))
|
|
|
|
|
|
2016-10-02 07:29:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-layouts/post-init-ivy ()
|
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
|
"Bb" 'spacemacs-layouts/non-restricted-buffer-list-ivy))
|
|
|
|
|
|
2016-03-21 01:48:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-layouts/init-persp-mode ()
|
|
|
|
|
(use-package persp-mode
|
|
|
|
|
:diminish persp-mode
|
|
|
|
|
:init
|
|
|
|
|
(progn
|
|
|
|
|
(setq persp-auto-resume-time (if (or dotspacemacs-auto-resume-layouts
|
|
|
|
|
spacemacs-force-resume-layouts)
|
|
|
|
|
1 -1)
|
|
|
|
|
persp-nil-name dotspacemacs-default-layout-name
|
|
|
|
|
persp-reset-windows-on-nil-window-conf nil
|
|
|
|
|
persp-set-last-persp-for-new-frames nil
|
2016-08-20 14:45:56 +00:00
|
|
|
|
persp-save-dir spacemacs-layouts-directory
|
2016-09-19 10:51:57 +00:00
|
|
|
|
persp-set-ido-hooks t)
|
2016-05-02 21:34:39 +00:00
|
|
|
|
|
|
|
|
|
(defun spacemacs//activate-persp-mode ()
|
|
|
|
|
"Always activate persp-mode, unless it is already active.
|
|
|
|
|
(e.g. don't re-activate during `dotspacemacs/sync-configuration-layers' -
|
|
|
|
|
see issues #5925 and #3875)"
|
|
|
|
|
(unless (bound-and-true-p persp-mode)
|
|
|
|
|
(persp-mode)))
|
|
|
|
|
(spacemacs/defer-until-after-user-config #'spacemacs//activate-persp-mode)
|
|
|
|
|
|
2016-03-21 01:48:06 +00:00
|
|
|
|
;; layouts transient state
|
|
|
|
|
(spacemacs|transient-state-format-hint layouts
|
|
|
|
|
spacemacs--layouts-ts-full-hint
|
|
|
|
|
"\n\n
|
2016-03-30 18:29:55 +00:00
|
|
|
|
Go to^^^^^^ Actions^^
|
|
|
|
|
─────^^^^^^────────────────────────────── ───────^^──────────────────────────────────────────────────
|
|
|
|
|
[_0_,_9_]^^ nth/new layout [_a_]^^ add buffer
|
|
|
|
|
[_C-0_,_C-9_]^^ nth/new layout [_A_]^^ add all from layout
|
|
|
|
|
[_<tab>_]^^^^ last layout [_d_]^^ close current layout
|
|
|
|
|
[_b_]^^^^ buffer in layout [_D_]^^ close other layout
|
|
|
|
|
[_h_]^^^^ default layout [_r_]^^ remove current buffer
|
|
|
|
|
[_l_]^^^^ layout w/helm/ivy [_R_]^^ rename current layout
|
|
|
|
|
[_L_]^^^^ layouts in file [_s_/_S_] save all layouts/save by names
|
|
|
|
|
[_n_/_C-l_]^^ next layout [_t_]^^ show a buffer without adding it to current layout
|
|
|
|
|
[_N_/_p_/_C-h_] prev layout [_x_]^^ kill current w/buffers
|
|
|
|
|
[_o_]^^^^ custom layout [_X_]^^ kill other w/buffers
|
|
|
|
|
[_w_]^^^^ workspaces transient state [_?_]^^ toggle help\n")
|
2016-03-21 01:48:06 +00:00
|
|
|
|
|
|
|
|
|
(spacemacs|define-transient-state layouts
|
|
|
|
|
:title "Layouts Transient State"
|
|
|
|
|
:hint-is-doc t
|
|
|
|
|
:dynamic-hint (spacemacs//layouts-ts-hint)
|
|
|
|
|
:bindings
|
|
|
|
|
;; need to exit in case number doesn't exist
|
|
|
|
|
("?" spacemacs//layouts-ts-toggle-hint)
|
|
|
|
|
("1" spacemacs/persp-switch-to-1 :exit t)
|
|
|
|
|
("2" spacemacs/persp-switch-to-2 :exit t)
|
|
|
|
|
("3" spacemacs/persp-switch-to-3 :exit t)
|
|
|
|
|
("4" spacemacs/persp-switch-to-4 :exit t)
|
|
|
|
|
("5" spacemacs/persp-switch-to-5 :exit t)
|
|
|
|
|
("6" spacemacs/persp-switch-to-6 :exit t)
|
|
|
|
|
("7" spacemacs/persp-switch-to-7 :exit t)
|
|
|
|
|
("8" spacemacs/persp-switch-to-8 :exit t)
|
|
|
|
|
("9" spacemacs/persp-switch-to-9 :exit t)
|
|
|
|
|
("0" spacemacs/persp-switch-to-0 :exit t)
|
|
|
|
|
("C-1" spacemacs/persp-switch-to-1)
|
|
|
|
|
("C-2" spacemacs/persp-switch-to-2)
|
|
|
|
|
("C-3" spacemacs/persp-switch-to-3)
|
|
|
|
|
("C-4" spacemacs/persp-switch-to-4)
|
|
|
|
|
("C-5" spacemacs/persp-switch-to-5)
|
|
|
|
|
("C-6" spacemacs/persp-switch-to-6)
|
|
|
|
|
("C-7" spacemacs/persp-switch-to-7)
|
|
|
|
|
("C-8" spacemacs/persp-switch-to-8)
|
|
|
|
|
("C-9" spacemacs/persp-switch-to-9)
|
|
|
|
|
("C-0" spacemacs/persp-switch-to-0)
|
|
|
|
|
("<tab>" spacemacs/jump-to-last-layout)
|
|
|
|
|
("<return>" nil :exit t)
|
|
|
|
|
("C-h" persp-prev)
|
|
|
|
|
("C-l" persp-next)
|
|
|
|
|
("a" persp-add-buffer :exit t)
|
|
|
|
|
("A" persp-import-buffers :exit t)
|
|
|
|
|
("d" spacemacs/layouts-ts-close)
|
|
|
|
|
("D" spacemacs/layouts-ts-close-other :exit t)
|
|
|
|
|
("h" spacemacs/layout-goto-default :exit t)
|
|
|
|
|
("L" persp-load-state-from-file :exit t)
|
|
|
|
|
("n" persp-next)
|
|
|
|
|
("N" persp-prev)
|
|
|
|
|
("o" spacemacs/select-custom-layout :exit t)
|
|
|
|
|
("p" persp-prev)
|
|
|
|
|
("r" persp-remove-buffer :exit t)
|
|
|
|
|
("R" spacemacs/layouts-ts-rename :exit t)
|
|
|
|
|
("s" persp-save-state-to-file :exit t)
|
|
|
|
|
("S" persp-save-to-file-by-names :exit t)
|
|
|
|
|
("t" persp-temporarily-display-buffer :exit t)
|
2016-03-30 18:29:55 +00:00
|
|
|
|
("w" spacemacs/workspaces-transient-state/body :exit t)
|
2016-03-21 01:48:06 +00:00
|
|
|
|
("x" spacemacs/layouts-ts-kill)
|
|
|
|
|
("X" spacemacs/layouts-ts-kill-other :exit t))
|
|
|
|
|
(spacemacs/set-leader-keys "l" 'spacemacs/layouts-transient-state/body)
|
|
|
|
|
;; custom layouts
|
|
|
|
|
(spacemacs|define-custom-layout "@Spacemacs"
|
|
|
|
|
:binding "e"
|
|
|
|
|
:body
|
|
|
|
|
(spacemacs/find-dotfile)))
|
|
|
|
|
:config
|
|
|
|
|
(progn
|
|
|
|
|
(defadvice persp-activate (before spacemacs//save-toggle-layout activate)
|
|
|
|
|
(setq spacemacs--last-selected-layout persp-last-persp-name))
|
|
|
|
|
(add-hook 'persp-mode-hook 'spacemacs//layout-autosave)
|
|
|
|
|
(spacemacs/declare-prefix "b" "persp-buffers")
|
|
|
|
|
(spacemacs/declare-prefix "B" "global-buffers")
|
|
|
|
|
;; Override SPC TAB to only change buffers in perspective
|
|
|
|
|
(spacemacs/set-leader-keys
|
|
|
|
|
"TAB" 'spacemacs/alternate-buffer-in-persp
|
|
|
|
|
"ba" 'persp-add-buffer
|
2016-10-02 07:29:55 +00:00
|
|
|
|
"br" 'persp-remove-buffer))))
|
2016-03-21 01:48:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-layouts/post-init-spaceline ()
|
|
|
|
|
(setq spaceline-display-default-perspective
|
|
|
|
|
dotspacemacs-display-default-layout))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(defun spacemacs-layouts/post-init-swiper ()
|
|
|
|
|
(spacemacs/set-leader-keys "pl" 'spacemacs/ivy-persp-switch-project))
|