Command-B to run program doesn't work on non-main.lua files

I’m noting Command-B seems to be the shortcut to run the project and get the simulator running.   

Can this be made to work from any file you happened to have open? (e.g. just any of your lua files)  Or is there another keyboard shortcut available that will run your latest version on the simulator (or if simulator is running than re-launch it).  

Basically after same timesavings as textmate’s Command-R

Super+B or Build (Cmd+B on the Mac, Ctrl+B on Windows) will run the Simulator with the main.lua from the current directory (same directory as the file open in the editor) unless you have a Sublime Text project defined in which case it will find the main.lua in the top-level directory of the project.  If you have multiple directories in your project you should look into Sublime Text’s projects as they can help a lot.  I hope to make Super+B smarter when used without projects in the future.

Hi Perry,

What do you mean by “unless you have a Sublime Text project”?    

I note that if I open a lua file in the bottom right is says  “Lua” not “Corona SDK Lua” which I have to enable via running the “Set Syntax”.   Not sure if this is what you’re referring to…  Should I be changing a preference somewhere to ensure I get “Corona SDK Lua” by default, or does this really matter?

PS.  I must admit without a way to have a single shortcut to trigger a relaunch of the simulator from anywhere within the project is a showstopper for me.  That is in terms of switching back to Textmate with the Corona bundle (i.e. I’m trying to use Sublime instead of Textmate at the moment).  

Sublime Text projects are described here: http://www.sublimetext.com/docs/3/projects.html

If you’ve defined such a project for your app then the “build” hotkey can find the main.lua no matter what directory structure you have (and there are other benefits to projects as described above though I think it should be easier to declare any directory a “project” have it do the default thing).

An upcoming (hopefully the next) release of Corona Editor will do a better job of locating main.lua even if you don’t define a project.

greg,

  1. there are a few quirks but for now the best practice is to save a SublimeText3 project file in the same directory as your code. It’s a small, harmless file that basically acts as a desktop memory; by opening a ST3 project file in the future it will open whatever files you had open in it previously.

Defining the project should also let it know where your main.lua is, which in turn means you can probably compile to simulator from anything within it.

  1. You don’t get all of the neat autocomplete and handling stuff unless you select “Corona SDK Lua” from the language list. I think defining a project helps set this in stone but I’m still new to ST3 (as opposed to ST2). 

thanks - this solved it

I store my project file in a dedicated folder where I store all project files (and on dropbox).  I prefer not to store it in the project folder.  But that’s preference.

Super+B or Build (Cmd+B on the Mac, Ctrl+B on Windows) will run the Simulator with the main.lua from the current directory (same directory as the file open in the editor) unless you have a Sublime Text project defined in which case it will find the main.lua in the top-level directory of the project.  If you have multiple directories in your project you should look into Sublime Text’s projects as they can help a lot.  I hope to make Super+B smarter when used without projects in the future.

Hi Perry,

What do you mean by “unless you have a Sublime Text project”?    

I note that if I open a lua file in the bottom right is says  “Lua” not “Corona SDK Lua” which I have to enable via running the “Set Syntax”.   Not sure if this is what you’re referring to…  Should I be changing a preference somewhere to ensure I get “Corona SDK Lua” by default, or does this really matter?

PS.  I must admit without a way to have a single shortcut to trigger a relaunch of the simulator from anywhere within the project is a showstopper for me.  That is in terms of switching back to Textmate with the Corona bundle (i.e. I’m trying to use Sublime instead of Textmate at the moment).  

Sublime Text projects are described here: http://www.sublimetext.com/docs/3/projects.html

If you’ve defined such a project for your app then the “build” hotkey can find the main.lua no matter what directory structure you have (and there are other benefits to projects as described above though I think it should be easier to declare any directory a “project” have it do the default thing).

An upcoming (hopefully the next) release of Corona Editor will do a better job of locating main.lua even if you don’t define a project.

greg,

  1. there are a few quirks but for now the best practice is to save a SublimeText3 project file in the same directory as your code. It’s a small, harmless file that basically acts as a desktop memory; by opening a ST3 project file in the future it will open whatever files you had open in it previously.

Defining the project should also let it know where your main.lua is, which in turn means you can probably compile to simulator from anything within it.

  1. You don’t get all of the neat autocomplete and handling stuff unless you select “Corona SDK Lua” from the language list. I think defining a project helps set this in stone but I’m still new to ST3 (as opposed to ST2). 

thanks - this solved it

I store my project file in a dedicated folder where I store all project files (and on dropbox).  I prefer not to store it in the project folder.  But that’s preference.