A Neovim plugin that provides a live HTML preview of Fountain screenplays in your browser, with real-time updates and synchronized scrolling as you edit.
- Live preview — renders your screenplay in a browser as you type
- Real-time sync — browser scrolls to follow your cursor position in the editor
- Full Fountain support — title pages, scene headings, action, dialogue, parentheticals, transitions, dual-column dialogue, centered text, sections, page breaks, and inline formatting
- Auto-opens browser — optionally launches the browser when preview starts
- No external dependencies — pure Lua using Neovim's built-in APIs and libuv
- Neovim 0.7+
- A web browser
Using lazy.nvim:
{
"pypp/fountain-preview.nvim",
}Using packer.nvim:
use "pypp/fountain-preview.nvim"Open a .fountain file and run:
:FountainPreview
The browser will open at http://localhost:8765 with a live preview. Edit your screenplay and the preview updates automatically.
| Command | Description |
|---|---|
:FountainPreview |
Start the preview server |
:FountainPreview [port] |
Start on a specific port |
:FountainPreview stop |
Stop the preview server |
:FountainPreview update |
Force an immediate re-render |
Pass options to setup() to override defaults:
require("fountain_preview").setup({
port = 8765, -- Port for the preview server
auto_open = true, -- Auto-open browser on start
debounce_ms = 300, -- Delay (ms) before re-rendering after edits
update_events = { -- Neovim events that trigger a preview update
"TextChanged",
"TextChangedI",
"BufWritePost",
},
})| Element | Syntax |
|---|---|
| Scene heading | INT. LOCATION - DAY or .SCENE TEXT |
| Action | Plain paragraph |
| Character | CHARACTER NAME (all caps) |
| Dialogue | Line following a character cue |
| Parenthetical | (beat) |
| Transition | CUT TO: or uppercase ending in TO: |
| Dual dialogue | Append ^ to second character name |
| Centered text | > TEXT < |
| Page break | ===== |
| Section | # Heading, ## Sub, etc. |
| Bold | **text** |
| Italic | *text* |
| Underline | _text_ |
- A lightweight HTTP server starts on the configured port using Neovim's libuv event loop
- The browser connects and keeps an open Server-Sent Events stream
- On each edit, the Fountain buffer is parsed to HTML and pushed to the browser via SSE
- Cursor movement sends scroll-only events so the browser viewport stays in sync with the editor
