From 71bc92324a53ce1c1761353bd9678abccbb746fc Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Tue, 21 Mar 2023 11:31:46 +0100 Subject: Switch off intending of individual elements when set to empty string. Also, transitions are not names of characters. --- plugin/fountainwiki.vim | 24 ++++++++++++++++-------- 1 file 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*>\(.*\)\1 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*>\(.*\)\1 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. -- cgit