File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -159,6 +159,11 @@ endif
159159" Functions: {{{1
160160" EnableEmbedsforCodeblocksWithLang {{{2
161161function ! EnableEmbedsforCodeblocksWithLang (entry)
162+ " prevent embedded language syntaxes from changing 'foldmethod'
163+ if has (' folding' )
164+ let s: foldmethod = &l: foldmethod
165+ endif
166+
162167 try
163168 let s: langname = matchstr (a: entry , ' ^[^=]*' )
164169 let s: langsyntaxfile = matchstr (a: entry , ' [^=]*$' )
@@ -174,6 +179,10 @@ function! EnableEmbedsforCodeblocksWithLang(entry)
174179 catch /E484/
175180 echo " No syntax file found for '" . s: langsyntaxfile . " '"
176181 endtry
182+
183+ if exists (' s:foldmethod' ) && s: foldmethod !=# &l: foldmethod
184+ let &l: foldmethod = s: foldmethod
185+ endif
177186endfunction
178187" }}}2
179188
@@ -225,6 +234,11 @@ endif
225234
226235" Embeds: {{{2
227236
237+ " prevent embedded language syntaxes from changing 'foldmethod'
238+ if has (' folding' )
239+ let s: foldmethod = &l: foldmethod
240+ endif
241+
228242" HTML: {{{3
229243" Set embedded HTML highlighting
230244syn include @HTML syntax/html.vim
@@ -255,6 +269,10 @@ syn match pandocLaTexSectionCmd /\\\(part\|chapter\|\(sub\)\{,2}section\|\(sub\)
255269syn match pandocLaTeXDelimiter / [[\] {}]/ contained containedin=pandocLaTexSection
256270" }}}3
257271
272+ if exists (' s:foldmethod' ) && s: foldmethod !=# &l: foldmethod
273+ let &l: foldmethod = s: foldmethod
274+ endif
275+
258276" }}}2
259277
260278" Titleblock: {{{2
You can’t perform that action at this time.
0 commit comments