From 41179a6bc125303d917c78bdc806983ccc5f287f Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Sat, 31 May 2025 01:34:50 +0900 Subject: vim-patch:9.1.1342: Shebang filetype detection can be improved Problem: Shebang filetype detection can be improved Solution: Improve detection logic (Eisuke Kawashima) Vim does not correctly detect filetype from - `#!/usr/bin/env --split-string=awk -f` - `#!/usr/bin/env -S -i awk -f` - `#!/usr/bin/env -S VAR= awk -f` So update the current detection logic to detect those cases. closes: vim/vim#17199 https://github.com/vim/vim/commit/f102f4c2e80f5493a02a7b1130f11615d60b6295 Co-authored-by: Eisuke Kawashima --- runtime/lua/vim/filetype/detect.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'runtime/lua') diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index 6e1f833424..c78945ef04 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -1959,11 +1959,10 @@ local function match_from_hashbang(contents, path, dispatch_extension) -- "#!/usr/bin/bash" to make matching easier. -- Recognize only a few {options} that are commonly used. if matchregex(first_line, [[^#!\s*\S*\