Introducing Fountain for Sublime Text

Update November 26, 2012: Fountain for Sublime Text Gets New Themes, Package Control and More - The latest and greatest awaits.

Preamble

You remember Fountain, the plain text screenwriting syntax, don’t you? Of course you do. Quick refresher:

Fountain is a simple markup syntax for writing, editing and sharing screenplays in plain, human-readable text. Fountain allows you to work on your screenplay anywhere, on any computer or tablet, using any software that edits text files.

It’s been a year and a month since Stu Maschwitz’s original Screenplay Markdown proposal that set off the great plain text screenwriting craze of 2011-2012. Fountain is now supported by a growing list of apps, including on iOS and Android.

I played my part with Fountain for Marked1, which allows you to preview your Fountain screenplays in Marked. To date Fountain for Marked has been downloaded nearly 600 times, which seems like a lot given the niche crowd: nerdy screenwriters with Macs who also own Marked and aren’t afraid to mess with their ~/Library directory.

Anyway, let me introduce you to a new member of the Fountain family, Fountain for Sublime Text.

Some Backstory

One of the most important tools for understanding any syntax, in my opinion, is syntax highlighting. Here’s Wikipedia:

Syntax highlighting is a feature of some text editors that display text—–especially source code—–in different colors and fonts according to the category of terms. This feature eases writing in a structured language such as a programming language or a markup language as both structures and syntax errors are visually distinct.

A screenplay and its many parts are not so unlike any other kind of code. And so I have been drawn to using code editors for working with Fountain.

The now deprecated Screenbundle was, for a time, my favorite option for writing plain text screenplays in TextMate. It offered robust syntax highlighting and text re-formatting, but it relied on a custom syntax. A while ago I tried to modify Screenbundle to work with Fountain within TextMate, but it proved more difficult than I could handle at the time.

I recently went searching for a way to get Fountain working in Sublime Text 2, which I’ve been using lately. I found this forum post from Sublime Text user “nick.” He coded the basis for a .tmlanguage file, which is what tells the app how to highlight different elements. It was a start, so I installed it and started messing around.

As I dove into “nick’s” .tmlaguage file, I started finding small things I could fix. I added some code I found in Sublime Text’s plain text parser that tells the app to wrap to words instead of characters and added the lowercase versions of slug indicators (int., ext., i/e) so that writers can type sluglines however they prefer.

I really like (and use) Brett Terpstra’s MarkdownEditing package for Sublime Text. I basically borrowed its structure (thanks, Brett) to customize the way Fountain files look when loaded. I cobbled these disparate strands together and uploaded them to GitHub. You can go and play with the package right now, or fork it and fill in the significant gaps that I have left.

Installation & Download

  1. Download and unzip the current version.
  2. Rename folder to Fountain and move to ~/Library/Application Support/Sublime Text 2/Packages.
  3. Restart Sublime Text 2.
  4. Write the next Chinatown.

Notes

  • Feel free to delete the img folder and README.md once you’re up and running.
  • Alternatively, you could clone the GitHub repo to the same location listed above. If you’re new to Git, I recommend “git - the simple guide.”

What Does it Do?

Fountain for Sublime Text adds syntax highlighting when editing .fountain documents. Currently supported highlight elements:

  • Title Page
  • Scene Headings
  • Characters
  • Parentheticals
  • Transitions

Note that Fountain.tmlanguage supports more of the syntax, but Fountain Classic.tmTheme only calls on the elements listed above using their custom scopes.

What’s in the Box?

  • Fountain.tmlanguage - Grammar and syntax for Fountain.
  • Fountain Classic.tmTheme - Basic theme using colors from the “Mac Theme.”
    • Note: The syntax currently uses custom scopes, which means themes will need to be edited to account for these new scopes. This theme incorporates only the custom scopes.
  • Fountain.sublime-settings - All of the customizations live here. Start here if you want to make any changes.
  • Title Page.sublime-snippet - Snippet for Fountain title page formatting.
    • Type ⌘⇧P then search for “Snippet: Title Page” and hit return. You can tab through lines as you fill in your information.
  • Save the Cat.sublime-snippet - Snippet that loads the Save the Cat beat sheet as detailed by Stu Maschwitz in this post.
    • Type ⌘⇧P then search for “Snippet: Save the Cat” and hit return. The outline will appear as Markdown headers.

Customizations

The Fountain.sublime-settings files contains a number of customizations to make Sublime Text 2 a bit more writer friendly. To customize to your liking, such as changing the font used for Fountain editing, simply open this file and edit.

Here’s what it looks like (with explanations for most):

{
    "extensions":
    [
    "fountain"  // Indicates will only load for .fountain files
    ],
    "font_face": "Courier Final Draft", // Defaults to "Courier Final Draft" Comment (//) this line to switch to defaut font 
    // "font_face": "Courier New", // Uncomment to switch to "Courier New"
    // "font_face": "Courier", // Same here. Customize with different Font by placing fontname in quotes.
    "font_size": 15,
    "color_scheme": "Packages/Fountain/Fountain Classic.tmTheme",
    "word_wrap": true,
    "wrap_width": 70,  // "Page" width. Delete and text will wrap to the whole window.
    "line_padding_top": 5, // Just adds some breathing room for text.
    "draw_centered": true, // Delete if you'd prefer your text to lock to the left.
    "indent_subsequent_lines": false,
    "trim_automatic_white_space": true,
    "line_numbers": false, // Change to true to see line numbers again
    "translate_tabs_to_spaces": true // Turns tabs to spaces to keep highlighting working on indented lines.

What Doesn’t Work?

  • Tab indentations
    • Tab indents will not trigger the syntax highlighting.
    • Space indents work fine, and Fountain.sublime-settings contains a line that turns tabs to spaces.
    • You can try this plugin to convert tabs to spaces on save for legacy scripts.
    • This has no effect when converting your document with other software, such as Highland.
  • Non-Screenplay Elements
    • Outlining, notes, synopses, etc. are not currently fully supported in the syntax highlighting.

Help, Please

I will continue fiddling with this project, but if you know what’s causing some of the current problems or ways to make this load cleaner, I’d appreciate it very much. Specifically, I’d like this to work with any color scheme, not customized ones. Also, if character and scene completions could be implemented, this would be a much better solution for nerdy screenwriters.

What’s it Look Like?

Basically like this:

Fountain for Sublime Text Screenshot


  1. Stu, Martin Vilcans and Brett Terpstra deserve a lot of the credit for that. ↩︎