I am curious to see if it would be possible to write a vim fold expression for fountain.io files. Fountain files are plaintext files used by screenwriters. A good start would be to fold along two different terms that occur commonly in screenplays (INT. and EXT.), obviously I'd like to drill down into blocks of dialogue etc. down the road. But for now I'd like to start with INT. and EXT.
I use a folding expression for markdown as follows:
function! MarkdownFolds()
let thisline = getline(v:lnum)
if match(thisline, '^#') >= 0
return ">1"
else
return "="
endif
endfunction
setlocal foldmethod=expr
setlocal foldexpr=MarkdownFolds()
function! MarkdownFoldText()
let foldsize = (v:foldend-v:foldstart)
return getline(v:foldstart).' ('.foldsize.' lines)'
endfunction
setlocal foldtext=MarkdownFoldText()
" SOURCE
" https://gist.github.com/anonymous/4149842
I'm thinking there is a way to modify something like this to do what I want to. Anyone have any ideas, I would greatly appreciate it. If we get this fleshed out, I'll make sure to get this in front of whoever uses vim and fountain in conjunction.
Thanks in advance.