aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2026-04-10 07:28:24 +0800
committerGitHub <noreply@github.com>2026-04-10 07:28:24 +0800
commit93b3ea26ac9b7634104f86af02fb392daa25d491 (patch)
tree7f521a1b32f89dfb0e71e3ff6d0c5ad0c02c9117 /runtime/lua
parentcfbbec6fdaf37ef40dcd7829c2d5b3cd7cf33065 (diff)
downloadrneovim-93b3ea26ac9b7634104f86af02fb392daa25d491.tar.gz
rneovim-93b3ea26ac9b7634104f86af02fb392daa25d491.tar.bz2
rneovim-93b3ea26ac9b7634104f86af02fb392daa25d491.zip
vim-patch:9.2.0327: filetype: uv scripts are not detected (#38920)
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: vim/vim#19941 https://github.com/vim/vim/commit/6c16ccaf6101a5a4fa28df9ca31e0bf871541aa4 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'runtime/lua')
-rw-r--r--runtime/lua/vim/filetype/detect.lua4
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua
index 1b624b7022..1680c316bf 100644
--- a/runtime/lua/vim/filetype/detect.lua
+++ b/runtime/lua/vim/filetype/detect.lua
@@ -2162,6 +2162,10 @@ local function match_from_hashbang(contents, path, dispatch_extension)
end
end
+ if name == 'uv' and matchregex(first_line, [[\<uv run\>]]) then
+ return 'python'
+ end
+
-- If nothing matched, check the extension table. For a hashbang like
-- '#!/bin/env foo', this will set the filetype to 'fooscript' assuming
-- the filetype for the 'foo' extension is 'fooscript' in the extension table.