aboutsummaryrefslogtreecommitdiff
path: root/runtime/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/plugin')
-rw-r--r--runtime/plugin/editorconfig.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/runtime/plugin/editorconfig.lua b/runtime/plugin/editorconfig.lua
index 60eb861aaa..54cd0e828e 100644
--- a/runtime/plugin/editorconfig.lua
+++ b/runtime/plugin/editorconfig.lua
@@ -1,11 +1,13 @@
-if vim.g.editorconfig_enable == false or vim.g.editorconfig_enable == 0 then
- return
-end
-
local group = vim.api.nvim_create_augroup('editorconfig', {})
vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead', 'BufFilePost' }, {
group = group,
callback = function(args)
+ -- Buffer-local enable has higher priority
+ local enable = vim.F.if_nil(vim.b.editorconfig, vim.F.if_nil(vim.g.editorconfig, true))
+ if not enable then
+ return
+ end
+
require('editorconfig').config(args.buf)
end,
})