Ad blocker interference detected!
Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers
Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.
Use completion for character namesEdit
Vim's built-in completion is very handy for repeating character names and other repetitive words. Type RATATOUILLE once in the script; from then on, you can type RA<Ctrl-N>. Get Supertab in order to use RA<tab> instead, even easier!
Indenting Fountain with regexEdit
Fountain allows (but doesn't require) screenplay-like indentation. Although that makes Fountain a perfect candidate for a Vim indentation file, I have no idea how to write one!
Until there is a proper indentation file, you might want to use a weaker alternative. The following uses regex, and you may need to tweak it for your circumstances, since it is a very incomplete solution. This indents character, parentheticals, and transitions; dialogue remains flush left (breaks would have to be inserted in order to properly align blocks of indented text, and that's a job for a more advanced script).
command FountainIndent 13,$s/^\s*//ge | 13,$s/^\([ 0-9A-Z()\.\#\^]*\)$/\t\t\1/ge | 13,$s/^(\(.*\))$/\t(\1)/ge | 13,$s/\(.*\) TO:$/\t\t\t\t\t\t\t\t\t\t\t\t\1 TO:/ge | 13,$s/^> \(.*\)$/\t\t\t\t\t\t\t\t\t\t\t\t> \1/ge | 13,$s/^\s*>\(.*\)</\t\t\t\t\t\t>\1</ge | 13,$s/^\s*\(EXT\.\|INT\.\|\.\)/\1/ge | 13,$s/^\s*$//ge | set nohlsearch noremap <leader>fi <Esc>:FountainIndent<CR>
If you're really brave, you can make this automatic with something like this in your VIMRC. Use with caution, this will automatically indent your screenplay file upon saving:
au BufWrite *.fountain FountainIndent
Here is how to tweak: the first regex clears all leading spaces and tabs in order to clear the deck. Note that every regex is set to '13,$'; the idea is to protect your title page info; bump that number accordingly if you use more or less lines for your title pages. Since headers aren't indented, you have some margin for error.
CAUTION: let's be clear, this regex clears all previous indents below the title page. If you have a manually indented section, you'll lose it. Possible solution: change the first regex from '\s' to '\t', and use spaces to manually indent. I *think* that will work.
The second regex tabs character names twice; edit the section that begins '0-9A-Z' if you need special characters. For example, if you have a character named BJÖRN, you'll want something like '0-9A-ZÖ'. (The syntax file's already got you covered in this case.)
The third regex tabs parentheticals once. I don't think there's any reason to change this bit, it simply indents any line that begins and ends with parentheses.
Add more tabs (\t) to either if you want a more dramatic look.
The fourth and fifth regex push the transition line (a line that ends with 'TO:' or begins with '>') to the right side of the page. Remove or add tabs as desired.
The sixth regex has been added to address centered text ('> centered <'), which otherwise becomes confused with forced transitions. Again, adjust the number of tabs as desired. The best we can do is suggest a centered position.
The seventh regex provides for forced scene headers (lines that begin with a period), and as a corrective for scene headers that get mistaken for character names. The regex here assumes your scene header begins with EXT. or INT., and you'll want to change that if you use one of the allowed variations. The last regex is a final cleanup, to remove any orphaned tabs.
(In addition, at the very end I turn off search highlighting, because the last search tends to leave an annoying highlight residue. This is entirely optional)
This solution doesn't come close to covering all of Fountain's syntax, but should serve most normal use.
Keep in mind that this indentation has no effect on final output: Fountain indentation is entirely a matter of personal aesthetics, and is ignored by Fountain processing tools like Screenplain.