From 70c62530ee0b6fba28816ca4454557baf1f2e440 Mon Sep 17 00:00:00 2001 From: ath3 Date: Fri, 3 Dec 2021 16:13:24 +0100 Subject: Support env flags in shebang (#1224) --- helix-core/src/syntax.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'helix-core/src') diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs index 142265a8..ba78adaa 100644 --- a/helix-core/src/syntax.rs +++ b/helix-core/src/syntax.rs @@ -310,8 +310,9 @@ impl Loader { pub fn language_config_for_shebang(&self, source: &Rope) -> Option> { let line = Cow::from(source.line(0)); - static SHEBANG_REGEX: Lazy = - Lazy::new(|| Regex::new(r"^#!\s*(?:\S*[/\\](?:env\s+)?)?([^\s\.\d]+)").unwrap()); + static SHEBANG_REGEX: Lazy = Lazy::new(|| { + Regex::new(r"^#!\s*(?:\S*[/\\](?:env\s+(?:\-\S+\s+)*)?)?([^\s\.\d]+)").unwrap() + }); let configuration_id = SHEBANG_REGEX .captures(&line) .and_then(|cap| self.language_config_ids_by_shebang.get(&cap[1])); -- cgit v1.2.3-70-g09d2