So, recently a few of us made the switch from TextMate and VIM over to Sublime (hey, don’t judge, we like trying new things). For the most part, it’s been a pretty smooth transition. Those of us who made the switch, mainly Chris and Kyle, are happy about the new resource, but it does have a couple short comings. Here, we’re going to try and help minimize one of those short comings.

WTF is Sublime Text?!

Sublime Text 2 is a pretty sophiscated text editor for code, HTML, and prose (to steal snippets from their site). Currently it’s in continous development, usully new releases going out about once every week or two. It handles loads of file types, and even allows you to add your own filters, plugins, and packages in a pretty easy manner.

Get On With It!!!

Okay, okay… jeez…

So, first, find yourself your favorite Markdown editor or viewer. Here are a few to choose from:

If you’re a Windows user, your experience and application choice will differ.

Next, open up your Sublime Text 2 User Packages directory.

/Users/username/Library/Application Support/Sublime Text 2/Packages/User

Make yourself a file called “Appname.sublime-build”, for example, if you use Mou it would be “Mou.sublime-build”. This is more for reference than anything, you could name it ButtSniff.sublime-build and it’ll work…

After that, open up Appname.sublime-build in your favorite text editor, which should be Sublime Text 2 at this time.

Inside, we’ll be using a very small piece of JSON.

{
    "osx": {
        "cmd": ["open", "-a", "Appname", "$file"]
    },
    "selector": "text.html.markdown"
}

Again, Appname would be changed to the name of the application you are using, so if you are using Mou, your code would look like: "cmd": ["open", "-a", "Mou", "$file"]

Once you have made this edit, save the file, and open up your markdown or rdoc file (may require a restart). Once you have the file open, just hit CMD+B and it will load up your chosen application to render out the HTML.

Also, I have only used Mou using the method, but if I update the file in Mou it will automatically update it in Sublime Text 2 as well.

Hope this helps! - Kyle