Custom layouts, Sublime text 2

2019-03-08 08:07发布

问题:

I've been working with a 2 column system so far but feel I'm needing a third and that 3 spread across the screen doesn't give much of a view without adjusting the width every time.

It's there a way to get the grid layout but have the bottom half of the screen one file. I know it's a long shot but wondering if anyone knows of anything

Found that you can edit for custom layouts in Packages/default/Main.sublime-menu Having problems saving though error in trying to parse file: expected value in ~/library/application support/sublime text 2/packages/default/Main.sublime-menu:407:21

Edited: for better layout

Found something that is similar, been trying to mod it but don't understand how the cells work

This one is similar

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

which gives

Code http://sublimetext.userecho.com/s/attachments/201110/i_182.png

回答1:

Assuming these are just coordinates with 0,0 at the upper left, something like this should work:

[0, 0, 1, 1],
[1, 0, 2, 1],
[0, 1, 2, 2]


Edit: Just tested, and it does.

Create the file Main.sublime-menu in your Packages > User folder (best to leave the default menu alone) and put the following code in it:

[{
    "id": "view",
    "children": [{
        "id": "layout",
        "children": [{
             "command": "set_layout",
             "caption" : "Custom: 3 Pane",
             "mnemonic": "C",
             "args": {
                "cols": [0.0, 0.5, 1.0],
                "rows": [0.0, 0.5, 1.0],
                "cells": [
                    [0, 0, 1, 1],
                    [1, 0, 2, 1],
                    [0, 1, 2, 2]
                ]
            }
        }]
    }]
}]

You will see Custom: 3 Pane in your layout options. No need to restart Sublime Text.

For anyone interested, here is a gist containing this layout as well as a flipped version.



回答2:

This was very helpful for visualizing what points the coordinates are referring to: http://www.sublimetext.com/forum/viewtopic.php?f=6&t=7284&start=0&hilit=set+layout