mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Allow " ex:" to match at beginning of file
Although unlikely to be valid syntax in most programming languages, such a modeline is valid syntax in Vim, and will trigger any filetype modes.
This commit is contained in:
@@ -10,7 +10,7 @@ module Linguist
|
||||
vi
|
||||
(?:m[<=>]?\d+|m)? # Version-specific modeline
|
||||
|
|
||||
(?!^)\s
|
||||
[\t\x20] # `ex:` requires whitespace, because "ex:" might be short for "example:"
|
||||
ex
|
||||
)
|
||||
|
||||
|
||||
3
test/fixtures/Data/Modelines/ruby10
vendored
Normal file
3
test/fixtures/Data/Modelines/ruby10
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
ex: noexpandtab: ft=ruby
|
||||
|
||||
# Still Ruby
|
||||
@@ -17,6 +17,7 @@ class TestModelines < Minitest::Test
|
||||
assert_modeline Language["Ruby"], fixture_blob("Data/Modelines/ruby7")
|
||||
assert_modeline Language["Ruby"], fixture_blob("Data/Modelines/ruby8")
|
||||
assert_modeline Language["Ruby"], fixture_blob("Data/Modelines/ruby9")
|
||||
assert_modeline Language["Ruby"], fixture_blob("Data/Modelines/ruby10")
|
||||
assert_modeline Language["C++"], fixture_blob("Data/Modelines/seeplusplus")
|
||||
assert_modeline Language["C++"], fixture_blob("Data/Modelines/seeplusplusEmacs1")
|
||||
assert_modeline Language["C++"], fixture_blob("Data/Modelines/seeplusplusEmacs2")
|
||||
|
||||
Reference in New Issue
Block a user