patch 9.0.1620: Nix files are not recognized from the hashbang line
Problem: Nix files are not recognized from the hashbang line.
Solution: Add a hashbang check. (issue #12507)
diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim
index b55fab3..0079f4b 100644
--- a/runtime/autoload/dist/script.vim
+++ b/runtime/autoload/dist/script.vim
@@ -4,7 +4,7 @@
# Invoked from "scripts.vim" in 'runtimepath'
#
# Maintainer: Bram Moolenaar <Bram@vim.org>
-# Last Change: 2023 May 06
+# Last Change: 2023 Jun 08
export def DetectFiletype()
var line1 = getline(1)
@@ -44,7 +44,7 @@
elseif line1 =~ '^#!\s*[^/\\ ]*\>\([^/\\]\|$\)'
name = substitute(line1, '^#!\s*\([^/\\ ]*\>\).*', '\1', '')
else
- name = substitute(line1, '^#!\s*\S*[/\\]\(\i\+\).*', '\1', '')
+ name = substitute(line1, '^#!\s*\S*[/\\]\(\f\+\).*', '\1', '')
endif
# tcl scripts may have #!/bin/sh in the first line and "exec wish" in the
@@ -197,6 +197,10 @@
elseif name =~ 'guile'
setl ft=scheme
+ # Nix
+ elseif name =~ 'nix-shell'
+ setl ft=nix
+
endif
enddef