how to create a custom layout in sublime text 2?

两盒软妹~` 提交于 2020-02-27 22:45:27

问题


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]]
                        }
                    }

回答1:


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



回答2:


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)

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] ]
        }
}



回答3:


If you'd like to have a two row layout, where the first row contains one panel (one column) while the second row contains two columns, use this code:

{
    "caption": "1. Full - 2. 2 columns",
    "command": "set_layout",
    "args":
    {
        "cols": [0.0, 0.5, 1.0],
        "rows": [0.0, 0.5, 1.0],
        "cells":
        [
            [0, 0, 2, 1], 
            [0, 1, 1, 2], [1, 1, 2, 2]
        ]
    }
}



回答4:


Try the awesome sublime-SplitScreen plugin.

  • install via package control: Cmd+Shift+P, then install package and search for "SplitScreen".
    • Cmd in Mac, Ctrl otherwise.
  • After installing, Alt+Shift+S to activate the plugin, and enter a ration like 7:3,2:1 to achieve this layout:
--------------------
|             |    |
|             |    |
|             |    |
|             |    |
--------------------
|             |    |
|             |    |
--------------------
  • More examples in the project's readme.


来源:https://stackoverflow.com/questions/10913138/how-to-create-a-custom-layout-in-sublime-text-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!