spacemacs layouts and workspaces tweaks

- add `l` to workspace transient state to go back to layout transient
  state
- remove erroneous `l` and `h` keys on layouts transient state
- unique documentation toggle for layouts and workspaces
- reformat and sort transient states documentation
This commit is contained in:
syl20bnr 2016-03-30 14:29:55 -04:00
parent 91eeccc7a5
commit c4d9ca8fba
3 changed files with 28 additions and 42 deletions

View file

@ -21,11 +21,8 @@
(defvar layouts-autosave-delay 900
"Delay in seconds between each layouts auto-save.")
(defvar spacemacs--layouts-ts-full-hint-toggle 0
"Display a short doc when nil, full doc otherwise.")
(defvar spacemacs--workspaces-ts-full-hint-toggle 0
"Display a short doc when nil, full doc otherwise.")
(defvar spacemacs--ts-full-hint-toggle 0
"Toggle display of transient states documentations.")
(defvar spacemacs--last-selected-layout dotspacemacs-default-layout-name
"Previously selected layout.")

View file

@ -61,8 +61,8 @@ current perspective."
(defun spacemacs//layouts-ts-toggle-hint ()
"Toggle the full hint docstring for the layouts transient-state."
(interactive)
(setq spacemacs--layouts-ts-full-hint-toggle
(logxor spacemacs--layouts-ts-full-hint-toggle 1)))
(setq spacemacs--ts-full-hint-toggle
(logxor spacemacs--ts-full-hint-toggle 1)))
(defun spacemacs//layout-format-name (name pos)
"Format the layout name given by NAME for display in mode-line."
@ -89,7 +89,7 @@ current perspective."
persp-list " | "))))
(concat
formatted-persp-list
(if (equal 1 spacemacs--layouts-ts-full-hint-toggle)
(if (equal 1 spacemacs--ts-full-hint-toggle)
spacemacs--layouts-ts-full-hint
(concat " (["
(propertize "?" 'face 'hydra-face-red)
@ -456,8 +456,8 @@ STATE is a window-state object as returned by `window-state-get'."
(defun spacemacs//workspaces-ts-toggle-hint ()
"Toggle the full hint docstring for the workspaces transient-state."
(interactive)
(setq spacemacs--workspaces-ts-full-hint-toggle
(logxor spacemacs--workspaces-ts-full-hint-toggle 1)))
(setq spacemacs--ts-full-hint-toggle
(logxor spacemacs--ts-full-hint-toggle 1)))
(defun spacemacs/workspaces-ts-rename ()
"Rename a workspace and get back to transient-state."
@ -483,7 +483,7 @@ STATE is a window-state object as returned by `window-state-get'."
" "
(mapconcat 'spacemacs//workspace-format-name
(eyebrowse--get 'window-configs) " | ")
(if (equal 1 spacemacs--workspaces-ts-full-hint-toggle)
(if (equal 1 spacemacs--ts-full-hint-toggle)
spacemacs--workspaces-ts-full-hint
(concat " (["
(propertize "?" 'face 'hydra-face-red)
@ -531,10 +531,3 @@ FRAME defaults to the current frame."
'eyebrowse-current-slot (eyebrowse--get 'current-slot frame) persp)
(set-persp-parameter
'eyebrowse-last-slot (eyebrowse--get 'last-slot frame) persp)))
(defun spacemacs/layout-workspaces-transient-state ()
"Launches the workspaces transient state, if defined."
(interactive)
(if (fboundp 'spacemacs/workspaces-transient-state/body)
(call-interactively 'spacemacs/workspaces-transient-state/body)
(message "You need the eyebrowse layer to use this feature.")))

View file

@ -32,13 +32,14 @@
(spacemacs|transient-state-format-hint workspaces
spacemacs--workspaces-ts-full-hint
"\n\n
Go to^^^^^^ Remove/Rename...^^
--^-^--^^^^----------------------- --^-^---------------------------
Go to^^^^^^ Actions^^
^^^^^^ ^^
[_0_,_9_]^^ nth/new workspace [_d_] close current workspace
[_C-0_,_C-9_]^^ nth/new workspace [_R_] rename current workspace
[_<tab>_]^^^^ last workspace [_?_] toggle help\n
[_l_]^^^^ layouts
[_n_/_C-l_]^^ next workspace
[_N_/_p_/_C-h_] prev workspace
[_<tab>_]^^^^ last workspace\n")
[_N_/_p_/_C-h_] prev workspace\n")
(spacemacs|define-transient-state workspaces
:title "Workspaces Transient State"
@ -71,8 +72,7 @@
("C-i" eyebrowse-last-window-config)
("C-l" eyebrowse-next-window-config)
("d" eyebrowse-close-window-config)
("h" eyebrowse-prev-window-config)
("l" eyebrowse-next-window-config)
("l" spacemacs/layouts-transient-state/body :exit t)
("n" eyebrowse-next-window-config)
("N" eyebrowse-prev-window-config)
("p" eyebrowse-prev-window-config)
@ -118,23 +118,19 @@
(spacemacs|transient-state-format-hint layouts
spacemacs--layouts-ts-full-hint
"\n\n
Go to^^^^^^ Add/Remove/Rename...^^
--^-^--^^^^----------------------- --^-^---------------------------
[_b_]^^^^ buffer in layout [_a_] add buffer
[_h_]^^^^ default layout [_A_] add all from layout
[_o_]^^^^ custom layout [_r_] remove current buffer
[_l_]^^^^ layout w/helm/ivy [_d_] close current layout
[_L_]^^^^ layouts in file [_D_] close other layout
[_0_,_9_]^^ nth/new layout [_x_] kill current w/buffers
[_C-0_,_C-9_]^^ nth/new layout [_X_] kill other w/buffers
[_n_/_C-l_]^^ next layout [_R_] rename current layout
[_N_/_p_/_C-h_] prev layout
[_<tab>_]^^^^ last layout
--^^^^^^^^----------------------------------------------------------
[_s_/_S_] save all layouts/save by names
[_t_]^^ show a buffer without adding it to current layout
[_w_]^^ workspaces micro-state (requires eyebrowse layer)
[_?_]^^ toggle help\n")
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")
(spacemacs|define-transient-state layouts
:title "Layouts Transient State"
@ -184,7 +180,7 @@
("s" persp-save-state-to-file :exit t)
("S" persp-save-to-file-by-names :exit t)
("t" persp-temporarily-display-buffer :exit t)
("w" spacemacs/layout-workspaces-transient-state :exit t)
("w" spacemacs/workspaces-transient-state/body :exit t)
("x" spacemacs/layouts-ts-kill)
("X" spacemacs/layouts-ts-kill-other :exit t))
(spacemacs/set-leader-keys "l" 'spacemacs/layouts-transient-state/body)