Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to create a custom layout in sublime text 2?

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]]
                        }
                    }
like image 219
styler Avatar asked Jun 06 '12 11:06

styler


2 Answers

Try this:

{
    "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, 2], [1, 0, 2, 1],
                          [1, 1, 2, 2]
        ]
    }
}

Reference:

  • https://gist.github.com/1320281
like image 67
aanton Avatar answered Sep 26 '22 17:09

aanton


This structure helps you to make yourself any design in Sublime Text.

         0.0                             0.5                           1.0
          +-------------------------------+-----------------------------+

         0,0                             1,0                           2,0
   0.0    +-------------------------------+-----------------------------+
     |    |                               |                             |
     |    |                               |                             |
     |    |                               |                             |
     |    |                               |                             |
     |    |                               |                             |
     |   0,1                              1,1                           2,1
  0.33    |                               +-----------------------------+
     |    |                               |                             |
     |    |                               |                             |
     |    |                               |                             |
     |    |                               |                             |
     |    |                               |                             |
     |   0,2                              1,2                           2,2
  0.66    |                               +-----------------------------+
     |    |                               |                             |
     |    |                               |                             |
     |    |                               |                             |
     |    |                               |                             |
     |    |                               |                             |
     |   0,3                             1,3                           2,3
   1.0    +-------------------------------+-----------------------------+

http://asciiflow.com/#0B0pB9AbvJ9zLcHFZYnp2YTZjNU0


Sublime View: (2 column, 1 column split into 3 row)

enter image description here

Your keymap Setting (Preferences -> Key Binding User -> Add inside brackets)

{ "keys": ["alt+shift+7"],
    "caption": "2 cols (full - 3)",
    "command": "set_layout",
    "args":
        { "cols": [0.0, 0.5, 1.0],
          "rows": [0.0, 0.33, 0.66, 1.0],
          "cells": [ [0, 0, 1, 3], [1, 0, 2, 1], [1, 1, 2, 2], [1, 2, 2, 3] ]
        }
}
like image 35
Jaykumar Patel Avatar answered Sep 25 '22 17:09

Jaykumar Patel