Thanks to visit codestin.com
Credit goes to github.com

Skip to content

๐Ÿ–‹๏ธ A nvim syntax highlighting plugin for the Fountain screenplay format

Notifications You must be signed in to change notification settings

00msjr/nvim-fountain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

nvim-fountain

A modern Neovim plugin for the Fountain screenplay markup language, forked from Carson Fire's vim-fountain.

Features

  • Syntax highlighting for Fountain screenplay format
  • Navigation between scene headings
  • Keyboard shortcuts for common screenwriting tasks
  • Screenplay statistics (scene count, character appearances, etc.)
  • Export to PDF, HTML, and Final Draft formats
  • Preview in browser
  • Compatible with Neovim and LazyVim

About Fountain

Fountain is a plain text markup language for screenwriting. The format can be converted into Final Draft files (FDX) and HTML, and can be imported by Final Draft and Movie Magic.

The official Fountain website contains helpful material, including sample scripts and apps.

Here is an excerpt from Big Fish by John August, one of the screenwriters behind Fountain:

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.

Installation

Add to your LazyVim config (e.g., in lua/plugins/fountain.lua):

return {
  "00msjr/nvim-fountain",
  ft = "fountain",  -- Lazy-load only for fountain files
  config = function()
    require("nvim-fountain").setup({
      -- Optional configuration
      keymaps = {
        next_scene = "]]",
        prev_scene = "[[",
        uppercase_line = "<S-CR>",
      },
      -- Export configuration
      export = {
        pdf = { options = "--overwrite --font Courier" },
      },
    })
  end,
}
use {
  "00msjr/nvim-fountain",
  ft = "fountain",  -- Lazy-load only for fountain files
  config = function()
    require("nvim-fountain").setup({
      -- Optional configuration
    })
  end
}

Using vim-plug

" In your init.vim
Plug '00msjr/nvim-fountain', {'for': 'fountain'}

" After plug#end(), add:
augroup fountain_setup
  autocmd!
  autocmd FileType fountain lua require('nvim-fountain').setup()
augroup END

Using built-in Neovim package manager

# Clone the repository
mkdir -p ~/.local/share/nvim/site/pack/plugins/start/
git clone https://github.com/00msjr/nvim-fountain.git ~/.local/share/nvim/site/pack/plugins/start/nvim-fountain

Then in your init.lua:

-- Initialize the plugin
require('nvim-fountain').setup()

Configuration

You can customize the plugin by passing options to the setup function. See the examples directory for complete configuration examples.

require("nvim-fountain").setup({
  -- Keyboard mappings
  keymaps = {
    next_scene = "]]",
    prev_scene = "[[",
    uppercase_line = "<S-CR>",
  },

  -- Export settings
  export = {
    -- Default export directory (nil means same as source file)
    output_dir = nil,

    -- PDF export options
    pdf = {
      options = "--overwrite",
    },
  },

  -- Enable treesitter integration if available
  use_treesitter = true,
})

Commands

Editing and Navigation

  • :FountainStats - Display screenplay statistics (scene count, character appearances, etc.)
  • :FountainFormat - Format the current fountain document

Export and Preview

  • :FountainExportPDF [filename] - Export to PDF (optional filename)
  • :FountainPreview - Preview screenplay in browser

Default Keymaps

  • ]] - Navigate to next scene heading
  • [[ - Navigate to previous scene heading
  • <S-CR> - Make current line uppercase and move to next line

Screenplay Statistics

The :FountainStats command provides useful information about your screenplay:

  • Total number of scenes
  • List of characters with number of appearances
  • Dialogue and action line counts
  • Total line count

This can help track your screenplay's structure and character balance.

Export and Preview

The export functionality requires afterwriting to be installed:

npm install -g afterwriting

Once installed, you can use the export commands to convert your Fountain screenplay to PDF:

  • PDF: :FountainExportPDF [optional-filename.pdf]

The preview command (:FountainPreview) generates a temporary HTML file and opens it in your default browser.

Example Files

The plugin includes example files to help you get started:

  • examples/template.fountain: A sample screenplay demonstrating Fountain syntax
  • examples/lazyvim_config.lua: Configuration example for LazyVim users
  • examples/standalone_config.lua: Configuration example for direct use with any Neovim setup

To use the template:

cp examples/template.fountain ~/my-screenplay.fountain
nvim ~/my-screenplay.fountain

Contributing

Contributions are welcome! See the examples/COMMIT_MESSAGE.md file for a summary of the changes made to modernize this plugin.

About

๐Ÿ–‹๏ธ A nvim syntax highlighting plugin for the Fountain screenplay format

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •