aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2023-03-21 11:31:46 +0100
committerMatěj Cepl <mcepl@cepl.eu>2023-03-21 11:34:49 +0100
commit71bc92324a53ce1c1761353bd9678abccbb746fc (patch)
tree448f2d89eb5238a378ad01c5f575dd250753af25
parente5d6b518c94b17c96968d04a17db810c7d05a1e9 (diff)
downloadfountainwiki.vim-master.tar.gz
Switch off intending of individual elements when set to empty string.HEADmaster
Also, transitions are not names of characters.
-rw-r--r--plugin/fountainwiki.vim24
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.