Skip to content

Instantly share code, notes, and snippets.

@al3xandru
Last active November 14, 2023 00:13
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al3xandru/582427b2d804f1e8ffbc to your computer and use it in GitHub Desktop.
Save al3xandru/582427b2d804f1e8ffbc to your computer and use it in GitHub Desktop.

Spacemacs layout and eyebrowse layers

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):

Creating:

  1. spc l <nr> to create a new layout (or spc p l to create a layout from a project)
  2. setup windows and buffers
  3. spc l s save the layout (asks for a name and file)

Opening:

  1. spc l L to load the layout from file
  2. spc l <the-above-layout>
  3. 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.

eyebrowse

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.

@igoralmeida
Copy link

SPC l s will save all your layouts, while SPC 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 and MyFirstClass.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 with SPC l w <tab>.

@poetworrier
Copy link

idk why this was so hard for me to get at first, this helped a ton!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment