fix(utils): get non-nil filetype
This commit is contained in:
parent
16bcbc0229
commit
1a4f2575d6
@ -895,7 +895,7 @@ function M.get_filetype(filepath)
|
|||||||
-- https://github.com/neovim/neovim/issues/27265
|
-- https://github.com/neovim/neovim/issues/27265
|
||||||
|
|
||||||
local buf = vim.api.nvim_create_buf(false, true)
|
local buf = vim.api.nvim_create_buf(false, true)
|
||||||
local filetype = vim.filetype.match({ filename = filepath, buf = buf })
|
local filetype = vim.filetype.match({ filename = filepath, buf = buf }) or ""
|
||||||
vim.api.nvim_buf_delete(buf, { force = true })
|
vim.api.nvim_buf_delete(buf, { force = true })
|
||||||
|
|
||||||
return filetype
|
return filetype
|
||||||
|
Loading…
x
Reference in New Issue
Block a user