STProjectMaker – Sublime Text 2 Plugin for creating new projects

Note: I changed the name of the plugin from “SublimeProjectMaker” to “STProjectMaker”. The github address is also different now because of that change.

I love Sublime Text 2. But one thing I’ve always felt was missing was the ability to easily create a new project. I understand the difficulties involved. Sublime handles many different languages and projects of all different types. Each type of project in each language could have a completely different setup. There is no one single project type that could possibly work for everything.

Unfortunately, that means that to create, say, a simple HTML project, you need to open Sublime, close whatever project is currently open, then do a “save project”, saving the non-project as a new project, creating a directory and also naming a project file. Then you have to add that folder to the project. Finally, you have to create the actual project files – .html, .js, .css, etc. and hook them all up to each other. I’m not even talking a complex project, you have to do all that for a simple hello world type program.

Luckily, its creators made Sublime Text 2 incredibly extendable with a plugin architecture allowing you to write your own plugins that tie into the core UI of the editor. For quite a while I’ve had the idea of creating a plugin that would simplify the creation of a project. My first stab at it can be found here. That, of course, wasn’t a plugin, but an Ant build file that copied files over to a new directory and created the project file. It worked, but required Ant to be installed, and you still had to create a directory and copy a bunch of files into it and then open a command line and run the build file. And creating a new project type would have been a major pain. Even I stopped using it after a while.

Finally, at the end of last week and over the weekend I got around to working on my plugin idea. Sublime’s extensibility layer is based on Python. I broke out my old Python books and got to work. A major challenge beyond that was the fact that large portions of the plugin API are not at all documented. Throughout the documentation you will see suggestions to look at existing plugins and commands to see what low level commands are available and how to use them. That made it quite a bit of a struggle at times, but it was a fun challenge, seeing bits and pieces of functionality come together.

And so I present STProjectMaker. It is a full fledged plugin that lives within Sublime Text 2. When you call it up, you are presented with a list of templates. You choose one and then choose a location for your project. The template is scanned for any replaceable tokens and if any are found, you are prompted to provide values for them. Finally, the folder containing your new project is opened with the system file explorer application.

Templates are merely folders of files. At the moment there is only a bare bones HTML/Canvas template, but you can create your own very easily. I’ll be creating more and it’s my hope that others will contribute some as well.

There you have it. Hoping it’s useful.

This entry was posted in Extensibility, General, Technology. Bookmark the permalink.

7 Responses to STProjectMaker – Sublime Text 2 Plugin for creating new projects

  1. I just switched from Textmate to SublimeText2, in Textmate it was super easy to create huge templates to start with I even had a haXe / pureMVC template. It generated lots of files.

    I love SublimeText2 and it seems it can import lots of the snippets from Textmate but if they ever considering doing new projects templates they should look at how Textmate handle it.

  2. This is a cool idea, thanks for the plugin! Maybe this will help me stop being lazy and actually use more than one or two project files (I’m usually far too lazy to create those ^^).

    You should get this added to Package Control: http://wbond.net/sublime_packages/package_control/package_developers

  3. E.Bababalim says:

    I’m so sory; it says “Feel free to contact me at kp at bit-101 dot com. I try to answer very general Flash questions” in your kp but there is no any contact form or contact information there. So i tought, if I would wrote my question here you can maybe answer.

    this is my 2nd game developmet. Thanks to ur book , i able to fallow a car with a camera from a distance like that:

    camera.x = car.x + Math.sin(car.angle) * distance ;
    camera.y = car.y + Math.sin(car.angle) * distance ;

    but for 2nd game i want to build in 3d. But i can’t fallow my aircraft with camera from a distance and height. i tryed :

    var distance:Number = 100;
    var deepht:Number = 50;

    var sinX:Number = Math.sin(vehicle.rotationX);
    var sinY:Number = Math.sin(vehicle.rotationY);
    var sinZ:Number = Math.sin(vehicle.rotationZ);
    var cosX:Number = Math.cos(vehicle.rotationX);
    var cosY:Number = Math.cos(vehicle.rotationY);
    var cosZ:Number = Math.cos(vehicle.rotationZ);

    camera.x = (vehicle.x + (sinY * distance)) + (sinZ * deepht);
    camera.y = (vehicle.y + (sinX * distance)) – (cosZ * deepht);
    camera.z = vehicle.z – (cosY * distance) + (cosX * distance);
    camera.lookAt(vehicle.position);

    result is : i can’t even see where is my vehicle and cammera turns around like crazy. i’m trying to slowe this for more than 3 months. I hope you can answer me.

  4. Rob Dodson says:

    Hey Keith,

    This project looks AWESOME but I can’t seem to get token replacement working on OSX. I logged an issue on Github here: https://github.com/bit101/STProjectMaker/issues/7

    Any thoughts?

Leave a Reply