Home Download Buy Blog Forum Support

Multiple commands on one hotkey

Multiple commands on one hotkey

Postby S0und on Mon Nov 19, 2012 9:29 pm

Can i trigger 2 commands with 1 hotkey? i want to achieve something like this:



Code: Select all
   {
      "keys": ["left"],
      "command": "set_layout",
      "args":
      {
         "cols": [0.0, 0.666, 1.0],
         "rows": [0.0, 1.0],
         "cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
      },

      "command": "focus_group",
      "args": { "group": 0 }
   },



   {
      "keys": ["right"],
      "command": "set_layout",
      "args":
      {
         "cols": [0.0, 0.333, 1.0],
         "rows": [0.0, 1.0],
         "cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
      },
      "command": "focus_group",
      "args": { "group": 1 }
   },
S0und
 
Posts: 70
Joined: Wed Oct 28, 2009 4:12 pm

Re: Multiple commands on one hotkey

Postby xeno.by on Mon Nov 19, 2012 10:45 pm

You could probably write your own command that triggers these two in a sequence.
xeno.by
 
Posts: 104
Joined: Mon Jan 30, 2012 10:03 am
Location: Lausanne, Switzerland

Re: Multiple commands on one hotkey

Postby quodlibet on Mon Nov 19, 2012 10:58 pm

You can use macros. Like so:

.sublime-keymap:

Code: Select all
{ "keys": ["left"], "command": "run_macro_file", "args": {"file": "Packages/User/Left Layout.sublime-macro"} },


Packages/User/Left Layout.sublime-macro:

Code: Select all
[
      "command": "set_layout",
      "args":
      {
         "cols": [0.0, 0.666, 1.0],
         "rows": [0.0, 1.0],
         "cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
      },

      "command": "focus_group",
      "args": { "group": 0 }
]


(I didn't test this out, so this may not work out of the box.)

Look in `Packages/Default` for keymaps that utilize macros as well as the macros themselves.

Hope this helps,
Alex
quodlibet
 
Posts: 460
Joined: Sat Jun 18, 2011 5:53 pm


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 29 guests

cron