From ad0436dce205a646d63aff21a1fbb774e90a7497 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Tue, 4 Jan 2022 23:29:39 +0100 Subject: Add filetype.lua with the detection of fountain file. --- README | 34 ++++++++++++++++++++++++++ ftdetect/filetype.lua | 5 ++++ ftdetect/fountain.vim | 1 + syntax/fountain.vim | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 107 insertions(+) create mode 100644 README create mode 100644 ftdetect/filetype.lua create mode 100644 ftdetect/fountain.vim create mode 100644 syntax/fountain.vim diff --git a/README b/README new file mode 100644 index 0000000..a8bf882 --- /dev/null +++ b/README @@ -0,0 +1,34 @@ +This is a mirror of http://www.vim.org/scripts/script.php?script_id=3880 + +Fountain is a plain text markup language for screenwriting. + +Previously SPMD (screenplay markdown), Fountain is very official, now, and getting to be something of a Big Deal, as it merges two similar screenwriting projects into one. The format can be converted into Final Draft files (FDX) and HTML, and can be imported by Final Draft and Movie Magic. Scrippets (less powerful conversion) is available for WordPress, BBEdit, and other web standards. + +http://fountain.io/ + +Fountain is much like SPMD, with some important changes. Atx headers are now supported in order to create sections, and this makes Fountain compatible with the Voom outliner (vimscript #2657) in Markdown mode. + +Commenting has been changed; and an important feature called Boneyard is introduced, allowing for flexible striking of deleted material. + +Known issues in the current version: text emphasis only renders in 'normal' text (action, not dialogue), and adding eol double-spaces does not have the intended corrective effect (this should be fixed in an update). + +The official Fountain site contains a great deal of helpful material, including sample scripts and apps. In brief, Fountain allows you to type a screenplay in plain text. Here is an excerpt from Big Fish by John August, one of the screenwriters behind Fountain, and note that the text can be flush or tabbed as desired. + +EDWARD +(whispering) +Turn off your flashlights! She'll see 'em. + +MOVING UP behind the kids, we find ourselves at the gates of... + +EXT. A CREEPY OLD HOUSE - NIGHT + +ADULT EDWARD (V.O.) +Now, it's common knowledge that most towns of a certain size have a witch, if only to eat misbehaving children and the occasional puppy who wanders into her yard. Witches use those bones to cast spells and curses that make the land infertile. + + ==== + +The following image previews the syntax in a few different colorschemes: + +http://elflife.net/vim/FountainRenderedColorschemes.png + +Happy screenwriting! diff --git a/ftdetect/filetype.lua b/ftdetect/filetype.lua new file mode 100644 index 0000000..28123b6 --- /dev/null +++ b/ftdetect/filetype.lua @@ -0,0 +1,5 @@ +vim.filetype.add({ + extension = { + fountain = "fountain", + }, +}) diff --git a/ftdetect/fountain.vim b/ftdetect/fountain.vim new file mode 100644 index 0000000..ba0aa12 --- /dev/null +++ b/ftdetect/fountain.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.fountain set filetype=fountain diff --git a/syntax/fountain.vim b/syntax/fountain.vim new file mode 100644 index 0000000..fc08043 --- /dev/null +++ b/syntax/fountain.vim @@ -0,0 +1,67 @@ +" Vim syntax file +" Language: Fountain screenplay +" File: .fountain, .spmd, .txt +" Reference: http://fountain.io/ +" Maintainer: Carson Fire +" Last Change: February 20, 2012 +" Version: 2.02 + +if exists("b:current_syntax") + finish +endif +syn sync minlines=200 + +syn match fountainSection1 "^\s*# \(\_[^#]\)" fold transparent contains=ALL +syn region fountainTitlePage start="\%^\(.*\):" end="^$" contains=fountainBoneyard,fountainNotes +syn match fountainCharacter "^\(\L\)*$" +syn region fountainDialogue matchgroup=fountainCharacter start="^\(\L\)*$" end="^\s*$" contains=fountainCharacter,fountainParenthetical,fountainBoneyard,fountainNotes,fountainEmphasis +syn match fountainParenthetical "^\s*\((.*)\)$" contained contains=fountainBoneyard,fountainNotes +syn match fountainTransition "^\(\L\)* TO:$" contains=fountainBoneyard,fountainNotes +syn match fountainTransitionForced "^\s*>\(.*\)" contains=fountainBoneyard,fountainNotes +syn match fountainCentered "^\s*>\(.*\)<" contains=fountainBoneyard,fountainNotes +syn match fountainUnderlined "_[^_]*_" +syn match fountainItalic "\*[^\*]*\*" +syn match fountainBold "\*\*[^\*]*\*\*" +syn match fountainBoldItalic "\*\*\*[^\*]*\*\*\*" +syn match fountainPagebreak "^===[=]*$" +syn region fountainNotes start="\[\[" end="\]\]" contains=xLineContinue,fountainTodo +syn region fountainHeader1 start="^\s*# " end="$" contains=fountainBoneyard,fountainNotes +syn region fountainHeader2 start="^\s*## " end="$" contains=fountainBoneyard,fountainNotes +syn region fountainHeader3 start="^\s*### " end="$" contains=fountainBoneyard,fountainNotes +syn region fountainHeader4 start="^\s*#### " end="$" contains=fountainBoneyard,fountainNotes +syn region fountainHeader5 start="^\s*##### " end="$" contains=fountainBoneyard,fountainNotes +syn region fountainHeader6 start="^\s*###### " end="$" contains=fountainBoneyard,fountainNotes +syn region fountainSynopses start="^\s*= " end="$" contains=fountainBoneyard,fountainNotes +syn region fountainSceneHeading start="^\s*\(\.[^\.]\|INT\. \|EXT\. \|INT\./EXT\. \|INT/EXT\. \|INT \|EXT \|INT/EXT \|I/E \|EST\. \|int\. \|ext\. \|int\./ext\. \|int/ext\. \|int \|ext \|int/ext \|i/e \|est\. \)" end="$" contains=fountainSceneNumber,fountainBoneyard,fountainNotes +syn region fountainBoneyard start="/\*" end="\*\/" contains=xLineContinue +syn match xLineContinue "\\$" contained +syn region fountainSceneNumber start="#" end="#" contained +syn keyword fountainTodo contained FIXME TODO XXX NOTE + +hi def link fountainTodo Todo +hi def link fountainTitlePage title +hi def link fountainSceneHeading title +hi def link fountainCharacter identifier +hi def link fountainDialogue statement +hi def link fountainParenthetical function +hi def link fountainTransition todo +hi def link fountainTransitionForced todo +hi def link fountainCentered character +hi fountainUnderlined gui=underline +hi fountainItalic gui=italic cterm=italic +hi fountainBold gui=bold cterm=bold +hi fountainBoldItalic gui=bold,italic cterm=bold,italic +hi def link fountainPagebreak conditional +hi def link fountainActionForced normal +hi def link fountainNotes comment +hi def link fountainBoneyard nontext +hi def link fountainHeader1 htmlH1 +hi def link fountainHeader2 htmlH2 +hi def link fountainHeader3 htmlH3 +hi def link fountainHeader4 htmlH4 +hi def link fountainHeader5 htmlH5 +hi def link fountainHeader6 htmlH6 +hi def link fountainSynopses number +hi def link fountainSceneNumber number + +let b:current_syntax = "fountain" -- cgit