diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2023-03-21 11:31:46 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2023-03-21 11:34:49 +0100 |
commit | 71bc92324a53ce1c1761353bd9678abccbb746fc (patch) | |
tree | 448f2d89eb5238a378ad01c5f575dd250753af25 | |
parent | e5d6b518c94b17c96968d04a17db810c7d05a1e9 (diff) | |
download | fountainwiki.vim-71bc92324a53ce1c1761353bd9678abccbb746fc.tar.gz |
Also, transitions are not names of characters.
-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. |