diff options
author | Christian Clason <c.clason@uni-graz.at> | 2023-06-09 08:59:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-09 08:59:28 +0200 |
commit | f31dba93f921891159eb707b185517648df00d6b (patch) | |
tree | ebe77fda13f05fc82759a0164eecf129e67daeda /runtime/lua | |
parent | be539f5fa8e2d7ad73f7f69941bd6ff13354e89c (diff) | |
download | rneovim-f31dba93f921891159eb707b185517648df00d6b.tar.gz rneovim-f31dba93f921891159eb707b185517648df00d6b.tar.bz2 rneovim-f31dba93f921891159eb707b185517648df00d6b.zip |
vim-patch:9.0.1620: Nix files are not recognized from the hashbang line (#23961)
Problem: Nix files are not recognized from the hashbang line.
Solution: Add a hashbang check. (issue vim/vim#12507)
https://github.com/vim/vim/commit/19548c6a742d954ecd0b50b0680c37cc6ced7473
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'runtime/lua')
-rw-r--r-- | runtime/lua/vim/filetype/detect.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua index b347215895..4e18ed190a 100644 --- a/runtime/lua/vim/filetype/detect.lua +++ b/runtime/lua/vim/filetype/detect.lua @@ -1459,6 +1459,7 @@ local patterns_hashbang = { ['gforth\\>'] = { 'forth', { vim_regex = true } }, ['icon\\>'] = { 'icon', { vim_regex = true } }, guile = 'scheme', + ['nix%-shell'] = 'nix', } ---@private @@ -1491,7 +1492,7 @@ local function match_from_hashbang(contents, path, dispatch_extension) elseif matchregex(first_line, [[^#!\s*[^/\\ ]*\>\([^/\\]\|$\)]]) then name = vim.fn.substitute(first_line, [[^#!\s*\([^/\\ ]*\>\).*]], '\\1', '') else - name = vim.fn.substitute(first_line, [[^#!\s*\S*[/\\]\(\i\+\).*]], '\\1', '') + name = vim.fn.substitute(first_line, [[^#!\s*\S*[/\\]\(\f\+\).*]], '\\1', '') end -- tcl scripts may have #!/bin/sh in the first line and "exec wish" in the |