Can I somehow save window layout (with opened files) in VS Code and then restore it?
I am looking for an alternative for Emacs C-x r w <register> where I can interactively open different saved views.
Example: split the window into 3 views, open the same file in all of them scroll to different locations, save it, open other view where it's only 1 window open and then restore the 3 window view(the one I saved).
As for builtin VS Code features at the time of this writing for window layout, the best you can get is along the lines of the following commands in the command palette (a couple of "hardcoded" presets):
View: Two Rows Editor LayoutView: Two Rows Right Editor LayoutView: Three Rows Editor LayoutView: Single Column Editor LayoutView: Toggle Centered LayoutView: Two Columns Editor LayoutView: Two Columns Bottom Editor LayoutView: Three Columns Editor LayoutView: Grid Editor Layout (2x2)You can also change the keybindings for those things using the following command IDs:
workbench.action.editorLayoutSingle
workbench.action.editorLayoutThreeColumns
workbench.action.editorLayoutThreeRows
workbench.action.editorLayoutTwoByTwoGrid
workbench.action.editorLayoutTwoColumns
workbench.action.editorLayoutTwoColumnsBottom
workbench.action.editorLayoutTwoRows
workbench.action.editorLayoutTwoRowsRight
There have been several requests in the past to get a layout store/recall feature added to VS Code, which are all now closed (I don't think this is an exhaustive list):
As for non-builtin solutions for window layout, you could look for extensions provided related features. I've seen several people mention ctf0.save-editors-layout (I have no affiliation with this extension). I haven't tried it for myself so I'm not necessarily vouching for it- just mentioning it.
As for saving and restoring open editors, see In VS Code, Store a group of file tabs so that I can restore a specific environment in the future.
On Visual Studio Code: File -> Preferences -> Settings. Search for Window Restore Windows -> click the dropdown and select "preserve". This will save Visual Studio Code's window layout for the next time you reopen the program.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With