patch 9.2.0327: filetype: uv scripts are not detected

Problem:  filetype: uv scripts are not detected
          (Asger Hautop Drewsen)
Solution: Detect uv scripts as python filetype if the shebang line
          contains "uv run"

Reference:
https://docs.astral.sh/uv/guides/scripts/#using-a-shebang-to-create-an-executable-file

fixes: #19941

Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Christian Brabandt
2026-04-09 20:50:01 +00:00
parent f554a7c709
commit 6c16ccaf61
3 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ vim9script
# Invoked from "scripts.vim" in 'runtimepath'
#
# Maintainer: The Vim Project <https://github.com/vim/vim>
# Last Change: 2025 Dec 22
# Last Change: 2026 Apr 09
# Former Maintainer: Bram Moolenaar <Bram@vim.org>
export def DetectFiletype()
@@ -115,7 +115,7 @@ export def Exe2filetype(name: string, line1: string): string
return 'php'
# Python
elseif name =~ 'python'
elseif name =~ 'python' || (name == 'uv' && line1 =~ '\<uv run\>')
return 'python'
# Groovy
+2 -1
View File
@@ -1108,7 +1108,8 @@ def s:GetScriptChecks(): dict<list<list<string>>>
php: [['#!/path/php']],
python: [['#!/path/python'],
['#!/path/python2'],
['#!/path/python3']],
['#!/path/python3'],
['#!/usr/bin/env -S uv run --script']],
groovy: [['#!/path/groovy']],
ruby: [['#!/path/ruby']],
javascript: [['#!/path/node'],
+2
View File
@@ -734,6 +734,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
327,
/**/
326,
/**/