Sublime Forum

Groups, 5 or more and their Verticalness

#1

Is there anyway to keep more than 4 groups organised vertically, like you can with 4 or less?

Cheers

Ps Also, if I revert to 4 groups, by closing an empty one, I’m still stuck with one veritcal group and three horizontal groups. Drat and double drat !

The answer to that ps is goto Layout `

in

` View and sort there, but there’s no 5 column option… single Drat !

0 Likes

#2

What do you mean by “organized vertically” here? It’s possible out of the box to have the layout go as high as 5 columns with the current options before it starts adding rows:

For anything more than that, you can customize the maximum number of columns to be anything you like:

Similarly, you can also customize the built in layout options if you have a particular layout that you like to use:

Perhaps if you can provide some more information on your use case and what it is you’re trying to lay out we can advise you on the best way to achieve that (or something close to it at a minimum).

0 Likes

#3

Sorry, apologies for lack of info.

Firstly I’m guessing you’re not using ST3, otherwise you’re completely correct in your assumptions.

I’m using ST3 version 3.2.2, it doesn’t have the functionality you’ve shown above…

Lozminda :slightly_smiling_face: :unicorn:

Ps

What do you mean by “organized vertically” here? It’s possible out of the box to have the layout go as high as 5 columns with the current options before it starts adding rows:

if that’s so with my version, could you show me how, as I’ve not been able to go above 4 columns, thanks…

0 Likes

#4

Indeed that wasn’t ST3, but this functionality is unchanged in ST4 and behaves the same way as previous versions.

image

The option you want to tweak here (or rather, what I did above) is in View > Groups, where you can select how many columns the internal layout engine will use before it starts splitting the last group into rows:

That menu is just executing a command to change the internal setting for this, so you can add your own keybinding to execute the command with any value you want, or add an item to the command palette, or even have a plugin invoke the command automatically when a new window is created.

>>> sublime.log_commands(True)
command: set_max_columns {"columns": 5}

In the shot above, I set it to 20 (though I didn’t create that many columns).

1 Like

#5

Thank you very much.

In my usual suave style, I was looking at Layout and not Groups for a start, doh !
However the command to set max_columns will come in useful, just what I was looking for !

@OdatNurd, if you’re not paid, you should be ! :wink:

Ps Although not quite yet :grin:

0 Likes

#6

How do I do this ? I’ve tired typing the above command into the control panel with and without the word command and got various errors. (I can’t copy those errors because I’m logging commands and everytime I do something of course that comes up, but basically it’s a syntax error…)
I’m not sure I’ve got room for a keybinding as I’ve already got a few clashes and am running out of keys, but if I can’t get it running how would I use it in a keybinding pls ?

I’ve tried

	{ "keys": ["ctrl+shift+v"], "command": "set_max_columns" {"columns": 10}},

but get a few syntax errors

Error trying to parse file: Unexpected character, expected a comma or closing bracket in Packages/User/Default (Linux).sublime-keymap:20:59

for example…

Cheers

0 Likes

#7

You can use sublime.log_commands(False) to turn off the logging, so you can select and copy text without the drag_select commands getting all up in your business.

The output of the log shows you the command and the arguments (if any), where the arguments are the items in the { } braces.

In a key binding, menu entry or command palette entry, the command goes in the "command" key and the the arguments go in the "args" key (if there are any).

So, your binding was mostly correct but it was angry because you missed the "args": part out, which makes the JSON object invalid since it expects "key": value, pairs.

    { 
        "keys": ["ctrl+shift+v"], 
        "command": "set_max_columns", 
        "args": {"columns": 10}
    },
0 Likes

#8

Awesome ! And how would I use (if I can) that command in the control panel pls?

(also, and I kno this is off piste, can one run a plugin from the control panel and if so how so, or do I have to open another question ? BTW i goggled “run a command from control panel Sublime Text 3” and got everything not pertaining to that)

0 Likes

#9

There are three ways to do that, view.run_command(), window.run_command() and sublime.run_command(). All of them take the same arguments, first the name of the command, and second the arguments:

window.run_command("set_max_columns", {"columns": 10})

Without going into a ton of details, you generally want view.run_command() if you’re going to run a command that modifies a specific tab (aka view) somehow (like altering or adding text, moving the cursor, etc) and window.run_command() for everything else.

window.run_command() can run any command, including the commands that view.run_command() can run, but for an command that’s view specific it will automatically select the currently active view and ask it to run the command, which won’t do what you expect if you do it from the console because all places where you can type text in Sublime are views, including the input area in the console.

For example, compare the results of the following two things and see what happens:

view.run_command('insert', {'characters': 'Hello, World!'})
window.run_command('insert', {'characters': 'Hello, World!'})
1 Like

#10

Awesome reply, I’ll have a go in a bit, just having a break! :+1: :clap: :unicorn:

0 Likes