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: #17199

Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Eisuke Kawashima
2025-04-24 22:03:21 +02:00
committed by Christian Brabandt
parent bcd5995b40
commit f102f4c2e8
3 changed files with 8 additions and 5 deletions

View File

@ -1073,10 +1073,10 @@ def s:GetScriptEnvChecks(): dict<list<list<string>>>
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']],
}

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1342,
/**/
1341,
/**/