Sublime Forum

Set layout then move file to group doesn't work

#1

I want use command to move current file to the new col 2 like this:

{
     "caption": "moveto col",	
     "command": "chain", "args": {
              "commands": [
                         {"command": "set_layout", "args": {"cols": [0.0, 1.0], "rows": [0.0, 0.5, 1.0], "cells": [[0,0,1,1], [0,1,1,2]]}}, 
                         {"command": "move_to_group", "args": {"group": 1}}
               ]
       }
}

It failed every time even if i set focus_group or focus_neighboring_group.
It always exec {“command”: “move_to_group”, “args”: {“group”: 0}, not 1.
Why? Somebody can help me? Very thanks.

0 Likes

#2

I’m assuming this only happens when you start out with a single group.

By design set_layout gives focus to the new group if a new group was created. So in this case there’s no view for move_to_group to operate on.

Adding {"command": "focus_group", "args": { "group": 0 } }, in between the set_layout and move_to_group commands works for me. But it’s a hardcoded solution so you may need to create a custom command for more flexibility.

0 Likes

#3

Thanks for ur reply. It’s still can’t work as well even if i change focus to current view. The bug is move to group {group 1} always been changed to {group 0}. Lastly, i changed it to [“focus_neighboring_group”], [“move_to_neighboring_group”], lucky it succeed.

0 Likes