Search code examples
pythonsublimetextsublimetext3sublime-text-plugin

Sublime layout split into 3 panel, to create custom layout


Is there any way I can split layout into 3 ? I got this snippet from net

self.window.set_layout({
    "cols": [0, 0.5, 1],
    "rows": [0, 0.5, 1],
    "cells": [[0, 0, 1, 1], [1, 0, 2, 1],
              [0, 1, 1, 2], [1, 1, 2, 2]]
})

But this will split in to two. I want to 3 like this enter image description here

Any ideas ? I tried changing the values but no luck :(


Solution

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

    Sublime View:

    enter image description here

    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    +-------------------------------+-----------------------------+