The “layout” layer is quite confusing. It is basically meant to offer an option to isolate a set of buffers and configure a set of windows.
This is the workflow I have that seems to work for me (nb: I'm using most of the time projects in their own frame):
spc l <nr>
to create a new layout (orspc p l
to create a layout from a project)- setup windows and buffers
spc l s
save the layout (asks for a name and file)
spc l L
to load the layout from filespc l <the-above-layout>
spc l L
to load the layout from file
Note: it's not yet clear to me why I need to load the layout from file twice, but it looks like the first time it only "initializes" the layer and it's only the 2nd time when it restores the windows and buffers.
It’s some sort of “tab” system per frame which allows each tab to use a different window setup. As of now, I’m not very clear how I could use it, except maybe when working on a larger project and having to maintain in parallel multiple investigation paths.
If you got to this Gist and haven't seen Spacemacs ABC (7), I'm strongly encouraging you to watch this video. It's been the only material I could find that set me on the right path.
SPC l s
will save all your layouts, whileSPC l S
will save only the layouts you choose. That way, you can e.g. save individual layouts and open them on-demand. I rarely use this, though.But you should not need to go through that dance to load layouts. You could have a 'base' set of layouts in one file, por example, and then load others individually (if they are saved that way, of course) as the need comes. Personally, I use
SPC p l
for this use-case.I think of the workspaces feature (that you can find in
SPC l w ?
) as a way to organize the buffers in each layout in several ways (indeed, tabs, but still isolated from other layouts).So in a layout for a C++ project, for example, you could have one workspace with a vertical split for files
MyFirstClass.h
andMyFirstClass.cc
, while another workspace would be showing, say, the main entry point and a terminal. And you could have this in another frame, but you don't have to, since you can alternate between them withSPC l w <tab>
.