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, [[\]]) 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. diff --git a/test/old/testdir/test_filetype.vim b/test/old/testdir/test_filetype.vim index 5d42d65e43..ae2afec370 100644 --- a/test/old/testdir/test_filetype.vim +++ b/test/old/testdir/test_filetype.vim @@ -1106,7 +1106,8 @@ func s:GetScriptChecks() abort \ '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'],