2017-04-25 15:42:58 +00:00
|
|
|
#+TITLE: spacemacs-layouts layer
|
|
|
|
|
2019-05-28 14:41:10 +00:00
|
|
|
#+TAGS: layer|misc|spacemacs
|
2019-05-05 17:26:40 +00:00
|
|
|
|
2019-05-07 20:05:06 +00:00
|
|
|
* Table of Contents :TOC_5_gh:noexport:
|
2017-05-22 14:16:12 +00:00
|
|
|
- [[#description][Description]]
|
2018-02-17 22:58:59 +00:00
|
|
|
- [[#features][Features:]]
|
2020-04-03 15:55:27 +00:00
|
|
|
- [[#install][Install]]
|
2020-04-01 13:00:30 +00:00
|
|
|
- [[#restrict-functions-to-the-current-layouts-buffers][Restrict functions to the current layout's buffers]]
|
|
|
|
- [[#restrict-spc-tab-to-the-current-layouts-buffers][Restrict SPC-TAB to the current layout's buffers]]
|
|
|
|
- [[#kill-buffers-when-killing-current-layout][Kill buffers when killing current layout]]
|
|
|
|
- [[#usage][Usage]]
|
2020-04-03 15:55:27 +00:00
|
|
|
- [[#key-bindings][Key bindings]]
|
2017-04-25 15:42:58 +00:00
|
|
|
|
|
|
|
* Description
|
2018-02-17 22:58:59 +00:00
|
|
|
This layer adds support for distinct layouts/workspaces to Spacemacs.
|
|
|
|
|
2020-04-01 13:00:30 +00:00
|
|
|
Layouts provide an easy way to group buffers for a project or any arbitrary
|
2020-04-03 15:55:27 +00:00
|
|
|
buffer grouping you wish. Layouts also restrict actions to the buffers in
|
2020-04-01 13:00:30 +00:00
|
|
|
the current layout.
|
|
|
|
|
2018-02-17 22:58:59 +00:00
|
|
|
** Features:
|
|
|
|
- Support for distinct layouts via =eyebrowse=
|
|
|
|
- Integration with =helm= and =ivy= to search for buffers within layouts
|
2019-12-26 15:00:35 +00:00
|
|
|
|
2020-04-03 15:55:27 +00:00
|
|
|
* Install
|
2020-04-01 13:00:30 +00:00
|
|
|
The =spacemacs-layouts= layer is included by default in the Spacemacs distribution.
|
|
|
|
|
|
|
|
To set configuration layer variables, add =spacemacs-layouts= to the existing
|
|
|
|
=dotspacemacs-configuration-layers= list in your =~/.spacemacs= file.
|
|
|
|
|
|
|
|
** Restrict functions to the current layout's buffers
|
2019-12-26 15:00:35 +00:00
|
|
|
Besides =helm-mini= and =ivy-switch-buffer= that are aware of a layout's
|
2020-04-01 13:00:30 +00:00
|
|
|
buffers. This layer also provides a =spacemacs-layouts-restricted-functions=
|
2019-12-26 15:00:35 +00:00
|
|
|
variable that holds a list of functions that will be restricted to the current
|
|
|
|
layout's buffers.
|
|
|
|
|
2020-04-01 13:00:30 +00:00
|
|
|
Default value of =spacemacs-layouts-restricted-functions= is:
|
2019-12-27 10:27:09 +00:00
|
|
|
|
|
|
|
#+BEGIN_EXAMPLE
|
|
|
|
'(spacemacs/window-split-double-columns
|
|
|
|
spacemacs/window-split-triple-columns
|
|
|
|
spacemacs/window-split-grid)
|
|
|
|
#+END_EXAMPLE
|
2019-12-26 15:00:35 +00:00
|
|
|
|
2020-04-01 13:00:30 +00:00
|
|
|
The list can be edited in the =dotspacemacs-configuration-layers= variable near
|
|
|
|
the top of =.spacemacs= like this:
|
2019-12-26 15:00:35 +00:00
|
|
|
|
2019-12-27 10:27:09 +00:00
|
|
|
#+BEGIN_EXAMPLE
|
|
|
|
(spacemacs-layouts :variables
|
|
|
|
spacemacs-layouts-restricted-functions
|
|
|
|
'(spacemacs/window-split-double-columns
|
|
|
|
spacemacs/window-split-triple-columns
|
|
|
|
spacemacs/window-split-grid))
|
|
|
|
#+END_EXAMPLE
|
2019-12-26 15:00:35 +00:00
|
|
|
|
2020-04-01 13:00:30 +00:00
|
|
|
Note that =spacemacs-layouts-restricted-functions= can only be changed in the
|
|
|
|
=dotspacemacs-configuration-layers= variable. They can't be edited during the
|
2019-12-26 15:00:35 +00:00
|
|
|
current Emacs session. A restart is required.
|
|
|
|
|
2020-04-01 13:00:30 +00:00
|
|
|
** Restrict SPC-TAB to the current layout's buffers
|
|
|
|
When the =spacemacs-layouts-restrict-spc-tab= variable is set to =t=, then
|
|
|
|
~SPC-TAB~ (=spacemacs/alternate-buffer=) will be restricted to only switch
|
2019-12-26 15:00:35 +00:00
|
|
|
between the current layout's buffers.
|
|
|
|
|
2020-04-01 13:00:30 +00:00
|
|
|
Default value of =spacemacs-layouts-restrict-spc-tab= is =nil=.
|
2019-12-26 15:00:35 +00:00
|
|
|
|
2020-04-01 13:00:30 +00:00
|
|
|
It can be enabled in the =dotspacemacs-configuration-layers= variable near the
|
|
|
|
top of =.spacemacs= like this:
|
2019-12-26 15:00:35 +00:00
|
|
|
|
2019-12-27 10:27:09 +00:00
|
|
|
#+BEGIN_EXAMPLE
|
2020-04-01 13:00:30 +00:00
|
|
|
(spacemacs-layouts :variables
|
|
|
|
spacemacs-layouts-restrict-spc-tab t)
|
2019-12-27 10:27:09 +00:00
|
|
|
#+END_EXAMPLE
|
2019-12-26 15:00:35 +00:00
|
|
|
|
2020-04-01 13:00:30 +00:00
|
|
|
Note that =spacemacs-layouts-restrict-spc-tab= also can be toggle on the fly by
|
2019-12-26 15:00:35 +00:00
|
|
|
evaluating it like this:
|
|
|
|
|
2019-12-27 10:27:09 +00:00
|
|
|
#+BEGIN_EXAMPLE
|
|
|
|
(setq spacemacs-layouts-restrict-spc-tab t)
|
|
|
|
#+END_EXAMPLE
|
2020-04-01 13:00:30 +00:00
|
|
|
|
|
|
|
** Kill buffers when killing current layout
|
|
|
|
~SPC l x~ kills the current layout and the buffers stay open by default.
|
|
|
|
=persp-autokill-buffer-on-remove= controls what happens when a layout is killed
|
|
|
|
=nil= keeps all buffers
|
|
|
|
=kill-weak= kills a buffer if it is not in any other layout except default
|
|
|
|
=t= will kill all buffers in the current layout
|
|
|
|
|
|
|
|
#+BEGIN_EXAMPLE
|
|
|
|
(spacemacs-layouts :variables
|
|
|
|
persp-autokill-buffer-on-remove 'kill-weak)
|
|
|
|
#+END_EXAMPLE
|
|
|
|
|
|
|
|
If this variable is not set, then ~SPC l x~ kills the current layout, the buffers
|
|
|
|
remain open and listed in the default layout.
|
|
|
|
|
|
|
|
* Usage
|
|
|
|
Layout 1 is the default layout and has global scope, so ~SPC b b~ lists all open
|
2020-04-03 15:55:27 +00:00
|
|
|
buffers. All other layouts only show the buffers associated with that layout.
|
2020-04-01 13:00:30 +00:00
|
|
|
|
|
|
|
~SPC l~ to select from the current layouts by number or navigate with ~n~ / ~p~
|
|
|
|
~?~ will display the help menu.
|
|
|
|
|
|
|
|
~SPC l l~ to select or create a layout by typing the layout name.
|
|
|
|
|
|
|
|
~SPC l d~ to close the current layout, ~SPC l x~ to kill the current layout.
|
|
|
|
|
2020-04-03 15:55:27 +00:00
|
|
|
See key bindings for more layout commands.
|
2020-04-01 13:00:30 +00:00
|
|
|
|
2020-04-03 15:55:27 +00:00
|
|
|
* Key bindings
|
2020-04-01 13:00:30 +00:00
|
|
|
|
|
|
|
| Key binding | Description |
|
|
|
|
|-------------+-------------------------------------------|
|
|
|
|
| ~SPC l ?~ | toggle hint in layouts transient state |
|
|
|
|
| ~SPC l 1~ | switch to layout 1 |
|
|
|
|
| ~SPC l 2~ | switch to layout 2 |
|
|
|
|
| ~SPC l 3~ | switch to layout 3 |
|
|
|
|
| ~SPC l 4~ | switch to layout 4 |
|
|
|
|
| ~SPC l 5~ | switch to layout 5 |
|
|
|
|
| ~SPC l 6~ | switch to layout 6 |
|
|
|
|
| ~SPC l 7~ | switch to layout 7 |
|
|
|
|
| ~SPC l 8~ | switch to layout 8 |
|
|
|
|
| ~SPC l 9~ | switch to layout 9 |
|
|
|
|
| ~SPC l 0~ | switch to layout 0 |
|
|
|
|
| ~SPC l C-1~ | switch to layout 11 |
|
|
|
|
| ~SPC l C-2~ | switch to layout 12 |
|
|
|
|
| ~SPC l C-3~ | switch to layout 13 |
|
|
|
|
| ~SPC l C-4~ | switch to layout 14 |
|
|
|
|
| ~SPC l C-5~ | switch to layout 15 |
|
|
|
|
| ~SPC l C-6~ | switch to layout 16 |
|
|
|
|
| ~SPC l C-7~ | switch to layout 17 |
|
|
|
|
| ~SPC l C-8~ | switch to layout 18 |
|
|
|
|
| ~SPC l C-9~ | switch to layout 19 |
|
|
|
|
| ~SPC l C-0~ | switch to layout 20 |
|
|
|
|
| ~SPC l TAB~ | jump to last layout |
|
|
|
|
| ~SPC l RET~ | exit layout transient state |
|
|
|
|
| ~SPC l C-h~ | previous layout |
|
|
|
|
| ~SPC l C-l~ | next layout |
|
|
|
|
| ~SPC l <~ | move current layout left |
|
|
|
|
| ~SPC l >~ | move current layout right |
|
|
|
|
| ~SPC l a~ | add buffer to layout |
|
|
|
|
| ~SPC l A~ | import buffers |
|
|
|
|
| ~SPC l b~ | list buffers open in layout |
|
|
|
|
| ~SPC l d~ | close current layout (keeps buffers open) |
|
|
|
|
| ~SPC l e~ | switch to/create layout at position |
|
|
|
|
| ~SPC l D~ | close-other layout |
|
|
|
|
| ~SPC l h~ | Switch to default layout |
|
|
|
|
| ~SPC l L~ | Load saved layouts from a file |
|
|
|
|
| ~SPC l l~ | select or create a layout by name |
|
|
|
|
| ~SPC l n~ | next layout |
|
|
|
|
| ~SPC l N~ | previous layout |
|
|
|
|
| ~SPC l o~ | select custom layout |
|
|
|
|
| ~SPC l p~ | persp-prev |
|
|
|
|
| ~SPC l r~ | remove buffer from layout |
|
|
|
|
| ~SPC l R~ | rename layout |
|
|
|
|
| ~SPC l s~ | save current layouts to file |
|
|
|
|
| ~SPC l S~ | save current layouts to file by names |
|
|
|
|
| ~SPC l t~ | temporarily display buffer |
|
|
|
|
| ~SPC l w~ | workspaces transient state |
|
|
|
|
| ~SPC l x~ | kill current layout |
|
|
|
|
| ~SPC l X~ | kill other layout |
|