diff options
author | Bram Moolenaar <Bram@vim.org> | 2023-06-08 21:27:13 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-06-08 21:27:13 +0100 |
commit | 19548c6a742d954ecd0b50b0680c37cc6ced7473 (patch) | |
tree | 0efd88f128a3b88ac0c164dda297ec25a2752cb2 /runtime/autoload | |
parent | 85ef2df075a189da8b767d7554caaed8077de868 (diff) |
patch 9.0.1620: Nix files are not recognized from the hashbang linev9.0.1620
Problem: Nix files are not recognized from the hashbang line.
Solution: Add a hashbang check. (issue #12507)
Diffstat (limited to 'runtime/autoload')
-rw-r--r-- | runtime/autoload/dist/script.vim | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/runtime/autoload/dist/script.vim b/runtime/autoload/dist/script.vim index b55fab354f..0079f4b4e2 100644 --- a/runtime/autoload/dist/script.vim +++ b/runtime/autoload/dist/script.vim @@ -4,7 +4,7 @@ vim9script # 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 @@ def DetectFromHashBang(firstline: string) 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 @@ def DetectFromHashBang(firstline: string) elseif name =~ 'guile' setl ft=scheme + # Nix + elseif name =~ 'nix-shell' + setl ft=nix + endif enddef |