mirror of
https://github.com/neovim/neovim.git
synced 2026-03-28 11:22:03 +00:00
Problem: In autocmd examples, using "args" as the event-object name is vague and may be confused with a user-command. Solution: Use "ev" as the conventional event-object name.
14 lines
407 B
Lua
14 lines
407 B
Lua
local group = vim.api.nvim_create_augroup('nvim.editorconfig', {})
|
|
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead', 'BufFilePost' }, {
|
|
group = group,
|
|
callback = function(ev)
|
|
-- Buffer-local enable has higher priority
|
|
local enable = vim.F.if_nil(vim.b.editorconfig, vim.g.editorconfig, true)
|
|
if not enable then
|
|
return
|
|
end
|
|
|
|
require('editorconfig').config(ev.buf)
|
|
end,
|
|
})
|