News for hackers. Stuff that matters.
Re:A List of Sublime Text 2 Hotkeys by mercuryrising on Tuesday February 12, 2013 @11:00PM (#5211308)
It would be really nice if there was a way to configure a key command in ST2 to run a specific script depending on the language you're writing.

I don't usually write C unless I'm writing stuff for Arduinos. The Arduino IDE isn't very nice, but they have the magical commands "Control+U" and "Control+Shift+U" that upload code either through the FTDI board or a programmer. If I had that in ST2, I would be in heaven (right now I write in ST2, copy, paste into Arduino IDE, then upload).

Re:A List of Sublime Text 2 Hotkeys by castles on Tuesday February 12, 2013 @11:34PM (#5211408)
You can set a `context` on key bindings to trigger only in specific language scopes or per project by referencing the `settings` key in the sublime-project file. In fact, you can even write a python plugin to create your own contexts that you declare in the sublime-keymap json. Check out G's docs: https://sublime-text-unofficial-documentation.readthedocs.or...
Re:A List of Sublime Text 2 Hotkeys by tomhenderson on Wednesday February 13, 2013 @01:57AM (#5211805)
If you can do it from a terminal you should be able to add a build command and run the script with cmd+B.

This site has a pretty good run down of how they work: http://addyosmani.com/blog/custom-sublime-text-build-systems...

Re:A List of Sublime Text 2 Hotkeys by bpatrianakos on Tuesday February 12, 2013 @11:56PM (#5211481)
Write a plugin for yourself complete with the key bindings you want. ST2 plugins are just Python scripts. Granted you have to know Python but I assume since you're writing C and mesing with Arduino you either already know it or can pick it up with no problem.
Re:A List of Sublime Text 2 Hotkeys by CJefferson on Wednesday February 13, 2013 @02:22AM (#5211866)
While I know they are in python, I have never been able to find any documentation about how to build plugins, and what they can do. Could you point me to such a thing?
Re:A List of Sublime Text 2 Hotkeys by bpatrianakos on Wednesday February 13, 2013 @01:43PM (#5214833)
Yeah, definitely! Here are the two I used - fair warning, one is a Nettuts article. It's not the best tutorial ever but I had never written any Python before reading it and I was able to pull out the useful bits and apply them to my own plugin.

http://net.tutsplus.com/tutorials/python-tutorials/how-to-cr... - If nothing else, this will at least teach you how a Sublime plugin works (like where it lives and how you add it to the editor and such)

After that, the Sublime API will take it from there - http://www.sublimetext.com/docs/2/api_reference.html

I took bits about how ST2 plugins are structured from the first article, then looked for 'how to do X n Sublime' in the second and once I got those down it was just a matter of Googling for "how to do Y in Python".

The basic gist of it is that a plugin for Sublime is just a Python script that lives in Sublime's packages directory (~/Library/Application Support/Sublime Text 2/Packages on a Mac). Create a folder named after your plugin, drop the python script in there, and then use Python + the Sublime API methods to interact with the browser.

Re:A List of Sublime Text 2 Hotkeys by guavaroo on Tuesday February 12, 2013 @11:39PM (#5211420)
You can select "Use external editor" in Arduino preferences, this will save you the copy and paste. Once done editing in SublimeText you just tab over to the Arduino IDE and "CMD+U" to upload.