mirror of
https://github.com/neovim/neovim.git
synced 2026-03-31 12:52:13 +00:00
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.
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user