mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
fix(filetype): fix filetype patterns
This commit is contained in:
@ -13,7 +13,13 @@ vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
|
||||
group = 'filetypedetect',
|
||||
callback = function(args)
|
||||
local ft, on_detect = vim.filetype.match({ buf = args.buf })
|
||||
if ft then
|
||||
if not ft then
|
||||
-- Generic configuration file used as fallback
|
||||
ft = require('vim.filetype.detect').conf(args.file, args.buf)
|
||||
if ft then
|
||||
vim.api.nvim_cmd({ cmd = 'setf', args = { 'FALLBACK', ft } }, {})
|
||||
end
|
||||
else
|
||||
vim.api.nvim_buf_set_option(args.buf, 'filetype', ft)
|
||||
if on_detect then
|
||||
on_detect(args.buf)
|
||||
|
Reference in New Issue
Block a user