Skip to content

pypp/fountain-preview.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fountain-preview.nvim

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.

hello

Features

  • 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

Requirements

  • Neovim 0.7+
  • A web browser

Installation

Using lazy.nvim:

{
  "pypp/fountain-preview.nvim",
}

Using packer.nvim:

use "pypp/fountain-preview.nvim"

Usage

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.

Commands

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

Configuration

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",
  },
})

Fountain Format Support

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_

How It Works

  1. A lightweight HTTP server starts on the configured port using Neovim's libuv event loop
  2. The browser connects and keeps an open Server-Sent Events stream
  3. On each edit, the Fountain buffer is parsed to HTML and pushed to the browser via SSE
  4. Cursor movement sends scroll-only events so the browser viewport stays in sync with the editor

About

Live HTML preview of Fountain screenplays in your browser, with real-time updates and synchronized scrolling

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors