Sublime Forum

How can I create a custom layout in my editor?

#1

Hi all,

I would like to create a 2 column layout where column 2 is split into 2 rows but havent really had any joy trying to find out how this can be done. I know that this layout gets added to Main.sublime-menu so I duplicated one of the layouts and called it Custom 1, not sure what I have to add in as the key/value pairs or array though. Could anyone possibly help me with this?

here is what im working with so far:

{ "caption": "Custom 1", "command": "set_layout", "args": { "cols": [0.0, 0.5, 1.0], "rows": [0.0, 0.5, 1.0], "cells": [0, 0, 1, 1], [0, 1, 1, 2], [0, 2, 1, 3]] } }

0 Likes

#2

“Cols” and “Rows” specify the coordinates in x and y. Cells create cells by indexing the rows and cols array in the order [startx, starty, endx, endy].

So if you want 4 views you’ll need 4 groups of 4 coordinates each, probably something like this: (untested)

"args": { "cols": [0.0, 0.5, 1.0], "rows": [0.0, 0.5, 1.0], "cells": [0, 0, 1, 1], // (0.0, 0.0) -> (0.5, 0.5) [0, 1, 1, 2], // (0.0, 0.5) -> (0.5, 1.0) [1, 0, 2, 1], // (0.5, 0.0) -> (1.0, 0.5) [1, 1, 2, 2] // (0.5, 0.5) -> (1.0, 1.0) ] }

0 Likes

#3

Ah, saw you wanted column 2 split into two, not 2 by 2. Then it would be something like:

"args": { "cols": [0.0, 0.5, 1.0], "rows": [0.0, 0.5, 1.0], "cells": [0, 0, 1, 2], // (0.0, 0.0) -> (0.5, 1.0) [1, 0, 2, 1], // (0.5, 0.0) -> (1.0, 0.5) [1, 1, 2, 2] // (0.5, 0.5) -> (1.0, 1.0) ] }

0 Likes

#4

Hey, thanks a lot for this!!

Kyle

0 Likes