ByteNoise

Vim tips

Automatically update the date in Fountain screenplays

You can automatically update the date when editing Fountain screenplays in Vim, by placing the following in your ~/.vimrc:

augroup filetypedetect
au BufRead *.fountain %s/^Draft date: .*$/\=strftime("Draft date: %m\/%d\/%Y")/
augroup End

Extract dialogue

If you're converting a story into a screenplay, these Vim commands may help:

:g!/"/d
:%s/^[^"]*"//
:%s/"[^"]*$//
:%s/,$/./
:%s/"[^"]*"/\r/g

In order, these commands: remove all lines without a quote; remove everything before the first quote of each line; remove everything after the last quote of each line; replace ending commas with ending full stops; change all other between-quotes bits to newlines.

Working these out certainly saved me a lot of typing. I hope they're of use to someone else too!