fix: properly highlight multi filetype code blocks (#1926)

This commit is contained in:
Peter Cardenas
2025-04-30 07:20:40 -07:00
committed by GitHub
parent e8c5f4f13e
commit 59554e1cb0

View File

@@ -1083,7 +1083,8 @@ function M.get_filetype(filepath)
local buf = vim.api.nvim_create_buf(false, true)
local filetype = vim.filetype.match({ filename = filepath, buf = buf }) or ""
vim.api.nvim_buf_delete(buf, { force = true })
-- Parse the first filetype from a multifiltype file
filetype = filetype:gsub("%..*$", "")
return filetype
end