fix(filetype): use :setf instead of nvim_buf_set_option (#20334)

This commit is contained in:
zeertzjq
2022-09-25 22:29:25 +08:00
committed by GitHub
parent 91e912f8d4
commit f8a1cadccf
2 changed files with 14 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
local helpers = require('test.functional.helpers')(after_each)
local exec_lua = helpers.exec_lua
local eq = helpers.eq
local meths = helpers.meths
local clear = helpers.clear
local pathroot = helpers.pathroot
local command = helpers.command
@@ -94,3 +95,10 @@ describe('vim.filetype', function()
]])
end)
end)
describe('filetype.lua', function()
it('does not override user autocommands that set filetype #20333', function()
clear({args={'--clean', '--cmd', 'autocmd BufRead *.md set filetype=notmarkdown', 'README.md'}})
eq('notmarkdown', meths.buf_get_option(0, 'filetype'))
end)
end)