# Invoked from "scripts.vim" in 'runtimepath'
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
-# Last Change: 2025 Jan 20
+# Last Change: 2025 Apr 24
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
export def DetectFiletype()
# "#!/usr/bin/bash" to make matching easier.
# Recognize only a few {options} that are commonly used.
if line1 =~ '^#!\s*\S*\<env\s'
- line1 = substitute(line1, '\S\+=\S\+', '', 'g')
- line1 = substitute(line1, '\(-[iS]\|--ignore-environment\|--split-string\)', '', '')
+ line1 = substitute(line1, '\s\zs--split-string[ \t=]', '', '')
+ line1 = substitute(line1, '\s\zs[A-Za-z0-9_]\+=\S*\ze\s', '', 'g')
+ line1 = substitute(line1, '\s\zs\%(-[iS]\+\|--ignore-environment\)\ze\s', '', 'g')
line1 = substitute(line1, '\<env\s\+', '', '')
endif
return {
perl: [['#!/usr/bin/env VAR=val perl']],
scala: [['#!/usr/bin/env VAR=val VVAR=vval scala']],
- awk: [['#!/usr/bin/env VAR=val -i awk']],
+ awk: [['#!/usr/bin/env --split-string=VAR= awk -vFS="," -f']],
execline: [['#!/usr/bin/env execlineb']],
scheme: [['#!/usr/bin/env VAR=val --ignore-environment scheme']],
- python: [['#!/usr/bin/env VAR=val -S python -w -T']],
+ python: [['#!/usr/bin/env -S -i VAR=val python -B -u']],
wml: [['#!/usr/bin/env VAR=val --split-string wml']],
nix: [['#!/usr/bin/env nix-shell']],
}