mirror of
https://github.com/vim/vim
synced 2025-07-16 01:01:58 +00:00
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)
This commit is contained in:
8
runtime/autoload/dist/script.vim
vendored
8
runtime/autoload/dist/script.vim
vendored
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user