Skip to content

Commit c936563

Browse files
liskinjbodah
authored andcommitted
syntax: Prevent syntax/html.vim from overriding our syn sync
When including other syntax types it's necessary to declare that we're the main syntax, otherwise they will apply their own syn sync settings. Here, by including html.vim in 7e00da6, we end up with syn sync minlines=10 maxlines=100 and we sync using html.vim syncing rules, which isn't at all what we want. Try opening large_file.ex in the middle, syntax will be incorrect.
1 parent 30e764f commit c936563

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

syntax/elixir.vim

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
if exists("b:current_syntax")
2-
finish
1+
if !exists("main_syntax")
2+
if exists("b:current_syntax")
3+
finish
4+
endif
5+
let main_syntax = "elixir"
36
endif
47

58
let s:cpo_save = &cpo
@@ -230,5 +233,9 @@ hi def link elixirPrivateRecordDeclaration elixirRecordDeclaration
230233

231234
let b:current_syntax = "elixir"
232235

236+
if main_syntax == "elixir"
237+
unlet main_syntax
238+
endif
239+
233240
let &cpo = s:cpo_save
234241
unlet s:cpo_save

0 commit comments

Comments
 (0)