neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 8af28ab9cb9aef5249b74589b2850a51adaa277f
parent 70697417c4b6f70b1e25cde4d56ca4fc243347a0
Author: phanium <91544758+phanen@users.noreply.github.com>
Date:   Tue, 27 May 2025 21:56:29 +0800

fix(filetype): error when `vim.filetype.match{buf=fn.bufadd('a.sh')}` #34155

Problem: Error when `vim.filetype.match` a buffer with suffix `sh`.

Solution: fallback to an empty string as buffer content.
Diffstat:
Mruntime/lua/vim/filetype/detect.lua | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/runtime/lua/vim/filetype/detect.lua b/runtime/lua/vim/filetype/detect.lua @@ -1536,7 +1536,7 @@ local function sh(path, contents, name) end -- Get the name from the first line if not specified - name = name or contents[1] + name = name or contents[1] or '' if name:find('^csh$') or matchregex(name, [[^#!.\{-2,}\<csh\>]]) then -- Some .sh scripts contain #!/bin/csh. return M.shell(path, contents, 'csh')