Skip to content

Instantly share code, notes, and snippets.

@dmcclintock
Last active August 29, 2015 13:56
Show Gist options
  • Save dmcclintock/9045976 to your computer and use it in GitHub Desktop.
Save dmcclintock/9045976 to your computer and use it in GitHub Desktop.
Sublime Text custom pane layouts (commented with wireframe explaining coordinates for further customization). File should be named and placed in the following location to prevent being overwritten with future updates: "/~/Library/Application Support/Sublime Text 3/Packages/User/Main.sublime-menu".
/* ==========================================================================
Example: 4-cell layout (3 col, bottom-left 2/3 row)
VIEW WIREFRAME: http://go.acc.bz/sublime-layout-3col_1row
========================================================================== */
{
"command": "set_layout",
"caption" : "3 col, bottom-left 2/3 row",
"mnemonic": "C",
"args": {
"cols": [0.0, 0.3, 0.6, 1.0],
"rows": [0.0, 0.75, 1.0],
"cells": [
[0, 0, 1, 1],
[1, 0, 2, 1],
[2, 0, 3, 2],
[0, 1, 2, 2]
]
}
}
/**
* 0-1 values for COL breaks. 0 is left edge, 1 is right edge.
* [LEFT EDGE, CENTER VERTICAL BREAK(S), RIGHT EDGE]
*/
"cols": [0.0, 0.3, 0.6, 1.0],
/**
* 0-1 values for ROW breaks. 0 is top edge, 1 is bottom edge.
* [TOP EDGE, CENTER HORIZONTAL BREAK(S), BOTTOM EDGE]
*/
"rows": [0.0, 0.8, 1.0],
/**
* 0-n values for coordinates of each individual cell (an array of arrays).
* Each array of arrays [x1,y1,x2,y2] defines coordinates for each cell.
* x,y coordinates represent each break's position in relation to the total
* number of break points on that axis.
* The value for "n" can easily be determined as follows:
* - X coord: Number of values in the "cols" array, excluding 0.0
* - Y coord: Number of values in the "rows" array, excluding 0.0
* This example has 3 horizontal break points, and 2 vertical break points.
*/
"cells": [
[0, 0, 1, 1], [1, 0, 2, 1], [2, 0, 3, 2],
[0, 1, 2, 2] //__________]
]
/*===================== Wireframe notating coordinates =====================*/
0.0 0.3 0.6 1.0
+--------------------->+-------------------->+--------------->+
0,0 1,0 2,0 3,0
0.0 +----------------------+---------------------+----------------+
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
v 0,1 1,1 2,1 |
0.8 +----------------------+---------------------+ |
| | | |
| | | |
| | | |
v 0,2 2,2 3,2
1.0 +--------------------------------------------+----------------+
/*
End of example 4-cell layout (3 col, bottom-left 2/3 row)
========================================================================== */
[{
"id": "view",
"children": [{
"id": "layout",
"children": [{
"command": "set_layout",
"caption" : "3 col, bottom-right 2/3 row",
"mnemonic": "C",
"args": {
"cols": [0.0, 0.4, 0.74, 1.0],
"rows": [0.0, 0.75, 1.0],
"cells": [
[0, 0, 1, 2],
[1, 0, 2, 1],
[2, 0, 3, 1],
[1, 1, 3, 2]
]
}
},{
"command": "set_layout",
"caption" : "3 col, bottom-left 2/3 row",
"mnemonic": "C",
"args": {
"cols": [0.0, 0.3, 0.6, 1.0],
"rows": [0.0, 0.75, 1.0],
"cells": [
[0, 0, 1, 1],
[1, 0, 2, 1],
[2, 0, 3, 2],
[0, 1, 2, 2]
]
}
},{
"command": "set_layout",
"caption" : "2 col top, bottom 2/2 row",
"mnemonic": "C",
"args": {
"cols": [0.0, 0.5, 1.0],
"rows": [0.0, 0.75, 1.0],
"cells": [
[0, 0, 1, 1],
[1, 0, 2, 1],
[0, 1, 2, 2]
]
}
}]
}]
}]
@dmcclintock
Copy link
Author

Usage:

Place the code in a new file the file named "Main.sublime-menu" located in the "Packages > User" directory (to avoid being overwritten from SublimeText updates).

Custom A:

Top L. Top R.
Lower Full Width

Custom B:

Upper Full Width
Low L. Low R.

Reference Links:

set_layout method...the coordinates explained | Sublime Forum
Code author's original explanation | Stack Exchange
Plugin: Origami...pane customization & automation | GitHub
Configuring and Mastering Split Windows | TutsPlus

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