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
159
159
" Functions: {{{1
160
160
" EnableEmbedsforCodeblocksWithLang {{{2
161
161
function ! EnableEmbedsforCodeblocksWithLang (entry)
162
+ " prevent embedded language syntaxes from changing 'foldmethod'
163
+ if has (' folding' )
164
+ let s: foldmethod = &l: foldmethod
165
+ endif
166
+
162
167
try
163
168
let s: langname = matchstr (a: entry , ' ^[^=]*' )
164
169
let s: langsyntaxfile = matchstr (a: entry , ' [^=]*$' )
@@ -174,6 +179,10 @@ function! EnableEmbedsforCodeblocksWithLang(entry)
174
179
catch /E484/
175
180
echo " No syntax file found for '" . s: langsyntaxfile . " '"
176
181
endtry
182
+
183
+ if exists (' s:foldmethod' ) && s: foldmethod !=# &l: foldmethod
184
+ let &l: foldmethod = s: foldmethod
185
+ endif
177
186
endfunction
178
187
" }}}2
179
188
@@ -225,6 +234,11 @@ endif
225
234
226
235
" Embeds: {{{2
227
236
237
+ " prevent embedded language syntaxes from changing 'foldmethod'
238
+ if has (' folding' )
239
+ let s: foldmethod = &l: foldmethod
240
+ endif
241
+
228
242
" HTML: {{{3
229
243
" Set embedded HTML highlighting
230
244
syn include @HTML syntax/html.vim
@@ -255,6 +269,10 @@ syn match pandocLaTexSectionCmd /\\\(part\|chapter\|\(sub\)\{,2}section\|\(sub\)
255
269
syn match pandocLaTeXDelimiter / [[\] {}]/ contained containedin=pandocLaTexSection
256
270
" }}}3
257
271
272
+ if exists (' s:foldmethod' ) && s: foldmethod !=# &l: foldmethod
273
+ let &l: foldmethod = s: foldmethod
274
+ endif
275
+
258
276
" }}}2
259
277
260
278
" Titleblock: {{{2
You can’t perform that action at this time.
0 commit comments