diff options
-rw-r--r-- | plugin/fountainwiki.vim | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/plugin/fountainwiki.vim b/plugin/fountainwiki.vim index 80beeda..c0c0116 100644 --- a/plugin/fountainwiki.vim +++ b/plugin/fountainwiki.vim @@ -23,9 +23,9 @@ endif if !exists('FountainWiki_Parenthetical_Indent') let FountainWiki_Parenthetical_Indent = '\t' endif -if !exists('FountainWiki_Transition_Indent') - let FountainWiki_Transition_Indent = '\t\t\t\t\t\t' -endif +" if !exists('FountainWiki_Transition_Indent') +" let FountainWiki_Transition_Indent = '\t\t\t\t\t\t' +" endif if !exists('FountainWiki_Centered_Indent') let FountainWiki_Centered_Indent = '\t\t\t\t' endif @@ -66,11 +66,19 @@ function FountainWikiIndent() let g:Safety = "'t,$" " We bookmark our current location, then bookmark the first blank " line. - exe g:Safety.'s/^\s*\(\L*\)$/'.g:FountainWiki_Character_Indent.'\1/ge' - exe g:Safety.'s/^\s*\(.*\) TO:$/'.g:FountainWiki_Transition_Indent.'\1 TO:/ge' - exe g:Safety.'s/^\s*> \(.*\)$/'.g:FountainWiki_Transition_Indent.'> \1/ge' - exe g:Safety.'s/^\s*>\(.*\)</'.g:FountainWiki_Centered_Indent.'>\1</ge' - exe g:Safety.'s/^\s*(\(.*\))$/'.g:FountainWiki_Parenthetical_Indent.'(\1)/ge' + if strlen(g:FountainWiki_Transition_Indent) > 0 + exe g:Safety.'s/^\s*\(.*\) TO:$/'.g:FountainWiki_Transition_Indent.'\1 TO:/ge' + exe g:Safety.'s/^\s*> \(.*\)$/'.g:FountainWiki_Transition_Indent.'> \1/ge' + endif + if strlen(g:FountainWiki_Character_Indent) > 0 + exe g:Safety.'s/^\s*\([A-Z]\+\)$/'.g:FountainWiki_Character_Indent.'\1/ge' + endif + if strlen(g:FountainWiki_Centered_Indent) > 0 + exe g:Safety.'s/^\s*>\(.*\)</'.g:FountainWiki_Centered_Indent.'>\1</ge' + endif + if strlen(g:FountainWiki_Parenthetical_Indent) > 0 + exe g:Safety.'s/^\s*(\(.*\))$/'.g:FountainWiki_Parenthetical_Indent.'(\1)/ge' + endif " The range 't,$ protects the Fountain title page block; if there is " no title page block, the first line will probably be a header that " doesn't need to be indented anyway. |