2015-08-01 14:58:51 +00:00
|
|
|
;;; packages.el --- Eyebrowse Layer packages File for Spacemacs
|
2015-04-26 02:59:55 +00:00
|
|
|
;;
|
2016-01-12 02:40:54 +00:00
|
|
|
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
|
2015-04-26 02:59:55 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
|
|
|
|
|
|
|
(setq eyebrowse-packages '(eyebrowse))
|
|
|
|
|
|
|
|
(defun eyebrowse/init-eyebrowse ()
|
|
|
|
(use-package eyebrowse
|
|
|
|
:init
|
|
|
|
(progn
|
2015-04-26 16:48:41 +00:00
|
|
|
(setq eyebrowse-new-workspace #'spacemacs/home
|
|
|
|
eyebrowse-wrap-around t)
|
2015-04-26 02:59:55 +00:00
|
|
|
(eyebrowse-mode)
|
|
|
|
|
2015-08-13 16:25:31 +00:00
|
|
|
;; vim-style tab switching
|
2015-08-14 03:13:51 +00:00
|
|
|
(define-key evil-motion-state-map "gt" 'eyebrowse-next-window-config)
|
|
|
|
(define-key evil-motion-state-map "gT" 'eyebrowse-prev-window-config)
|
2015-08-13 16:25:31 +00:00
|
|
|
|
2015-06-10 00:31:26 +00:00
|
|
|
(defun spacemacs/workspaces-ms-rename ()
|
|
|
|
"Rename a workspace and get back to micro-state."
|
|
|
|
(interactive)
|
2015-12-29 12:50:46 +00:00
|
|
|
(eyebrowse-rename-window-config (eyebrowse--get 'current-slot) nil)
|
2015-06-10 00:31:26 +00:00
|
|
|
(spacemacs/workspaces-micro-state))
|
|
|
|
|
|
|
|
(defun spacemacs//workspaces-ms-get-slot-name (window-config)
|
|
|
|
"Return the name for the given window-config"
|
|
|
|
(let ((slot (car window-config))
|
|
|
|
(caption (eyebrowse-format-slot window-config)))
|
|
|
|
(if (= slot current-slot)
|
|
|
|
(format "[%s]" caption)
|
|
|
|
caption)))
|
|
|
|
|
2015-10-27 08:53:34 +00:00
|
|
|
(defun spacemacs//workspaces-ms-get-window-configs ()
|
2016-01-05 09:13:33 +00:00
|
|
|
"Return the list of window configs."
|
2015-10-27 08:53:34 +00:00
|
|
|
(--sort (if (eq (car other) 0)
|
|
|
|
t
|
|
|
|
(< (car it) (car other)))
|
|
|
|
(eyebrowse--get 'window-configs)))
|
|
|
|
|
2015-04-26 02:59:55 +00:00
|
|
|
(defun spacemacs//workspaces-ms-documentation ()
|
|
|
|
"Return the docstring for the workspaces micro-state."
|
2015-06-10 00:31:26 +00:00
|
|
|
(let* ((current-slot (eyebrowse--get 'current-slot))
|
2015-10-27 08:53:34 +00:00
|
|
|
(window-configs (spacemacs//workspaces-ms-get-window-configs)))
|
2015-04-26 02:59:55 +00:00
|
|
|
(concat
|
2015-06-10 00:31:26 +00:00
|
|
|
"<" (if window-configs
|
|
|
|
(concat
|
|
|
|
(mapconcat 'spacemacs//workspaces-ms-get-slot-name
|
|
|
|
window-configs "> <") ">")
|
|
|
|
(when eyebrowse-display-help
|
|
|
|
(concat
|
|
|
|
"\n[0-9] to create/switch to a workspace, "
|
|
|
|
"[n] next, [p/N] previous, [TAB] back and forth, [c] close, "
|
|
|
|
"[r] rename"))))))
|
2015-04-26 02:59:55 +00:00
|
|
|
|
|
|
|
(spacemacs|define-micro-state workspaces
|
|
|
|
:doc (spacemacs//workspaces-ms-documentation)
|
|
|
|
:use-minibuffer t
|
|
|
|
:bindings
|
|
|
|
("0" eyebrowse-switch-to-window-config-0)
|
|
|
|
("1" eyebrowse-switch-to-window-config-1)
|
|
|
|
("2" eyebrowse-switch-to-window-config-2)
|
|
|
|
("3" eyebrowse-switch-to-window-config-3)
|
|
|
|
("4" eyebrowse-switch-to-window-config-4)
|
|
|
|
("5" eyebrowse-switch-to-window-config-5)
|
|
|
|
("6" eyebrowse-switch-to-window-config-6)
|
|
|
|
("7" eyebrowse-switch-to-window-config-7)
|
|
|
|
("8" eyebrowse-switch-to-window-config-8)
|
|
|
|
("9" eyebrowse-switch-to-window-config-9)
|
|
|
|
("<tab>" eyebrowse-last-window-config)
|
|
|
|
("C-i" eyebrowse-last-window-config)
|
2015-07-31 02:56:47 +00:00
|
|
|
("c" eyebrowse-close-window-config)
|
2015-10-06 13:23:03 +00:00
|
|
|
("h" eyebrowse-prev-window-config)
|
|
|
|
("l" eyebrowse-next-window-config)
|
2015-04-26 02:59:55 +00:00
|
|
|
("n" eyebrowse-next-window-config)
|
|
|
|
("N" eyebrowse-prev-window-config)
|
|
|
|
("p" eyebrowse-prev-window-config)
|
2015-07-31 02:56:47 +00:00
|
|
|
("r" spacemacs/workspaces-ms-rename :exit t)
|
2015-12-17 22:58:59 +00:00
|
|
|
("w" eyebrowse-switch-to-window-config :exit t))
|
|
|
|
|
|
|
|
;; The layouts layer defines this keybinding inside a microstate
|
|
|
|
;; thus this is only needed if that layer is not used
|
|
|
|
(unless (configuration-layer/layer-usedp 'spacemacs-layouts)
|
|
|
|
(spacemacs/set-leader-keys "lw" 'spacemacs/workspaces-micro-state)))))
|