Home Download Buy Blog Forum Support

Build on save

Build on save

Postby ceej on Mon Jul 25, 2011 8:06 pm

Hi,

Is it possible to build on save?

Many thanks
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Build on save

Postby ceej on Thu Aug 04, 2011 2:39 pm

any ideas?
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Build on save

Postby iamntz on Thu Aug 04, 2011 2:53 pm

I don't know how build works (even if i know is there, in menus :D ), but i guess you can set a macro to save & build. Then you set up the ctrl(cmd) + s to run that macro. Like so:

Code: Select all
[
    {"command": "save"},
    {"command": "build"}
]


Doesn't work?
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Build on save

Postby ceej on Thu Aug 04, 2011 5:24 pm

you mean make a key mapping like:

Code: Select all
  { "keys": ["super+s"], "command": [
    {"command": "save"},
    {"command": "build"}
]}
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Build on save

Postby iamntz on Thu Aug 04, 2011 5:27 pm

No, i mean macro. Check out the Packages/Default folder and you will see there few macro examples.
iamntz
 
Posts: 915
Joined: Fri Apr 29, 2011 8:52 am
Location: Romania

Re: Build on save

Postby ceej on Thu Aug 04, 2011 5:55 pm

I see the macros in that folder.... so I'd bind the key press to call that macro? If you could give me a full example that would be amazing.

Many thanks
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Build on save

Postby charlesroper on Thu Aug 04, 2011 6:11 pm

Yes, you'd bind a key press (e.g., Ctrl-s or Super-s or whatever) to your macro. So if you wanted to run the Delete to Hard EOL macro found in Packages/Default, you'd add this to your user keybindings (Preferences > Key Bindings - User)

Code: Select all
{ "keys": ["super+s"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }


To put that in context, here's the complete content of my user keybindings with that macro binding added to the end:

Code: Select all
[
   { "keys": ["alt+shift+v"], "command": "validate" },
   { "keys": ["alt+ctrl+2"], "command": "toggle_quotes" },
   { "keys": ["super+j"], "command": "code_intel_auto_complete" },
   { "keys": ["super+f3"], "command": "goto_python_definition" },
   { "keys": ["alt+c"], "command": "web_colors" },
   { "keys": ["alt+enter"], "command": "move_to", "args": {"to": "hardeol"}},
   { "keys": ["super+s"], "command": "run_macro_file", "args": {"file": "Packages/Default/Delete to Hard EOL.sublime-macro"} }

]
charlesroper
 
Posts: 107
Joined: Thu Feb 18, 2010 7:30 am

Re: Build on save

Postby ceej on Thu Aug 04, 2011 6:20 pm

Thank you for your reply.

so I did exactly that making a new macro file and then adding

Code: Select all
[
    {"command": "save"},
    {"command": "build"}
]


to the file and now when I press super+s (apple+s) nothing happens.... it doesn't save, build or anything....
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Re: Build on save

Postby charlesroper on Thu Aug 04, 2011 6:25 pm

Hmm, seems like you're doing everything right. Where is your macro saved? Have you tried a different keybind?
charlesroper
 
Posts: 107
Joined: Thu Feb 18, 2010 7:30 am

Re: Build on save

Postby ceej on Thu Aug 04, 2011 6:31 pm

it's saved in Packages/Default/Save and Build.sublime-macro, ye tried another key binding like ctrl + s and nothing.... I'm using the latest dev version
ceej
 
Posts: 81
Joined: Tue Jun 21, 2011 5:37 pm

Next

Return to Technical Support

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 24 guests