aboutsummaryrefslogtreecommitdiff
path: root/runtime/plugin
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2023-01-07 08:20:37 -0700
committerGitHub <noreply@github.com>2023-01-07 08:20:37 -0700
commit363633844903331ae1d6383de2fef329db08b5e3 (patch)
tree6f6ab3d711c26a8d91c7bf51ddc16027cec9d7b0 /runtime/plugin
parent42afa0369a3c01dddd1efef1397bbf46011f391b (diff)
parent6ffa434f0b1c6e82fb6c1445d5d7382e0ef22e07 (diff)
downloadrneovim-363633844903331ae1d6383de2fef329db08b5e3.tar.gz
rneovim-363633844903331ae1d6383de2fef329db08b5e3.tar.bz2
rneovim-363633844903331ae1d6383de2fef329db08b5e3.zip
Merge pull request #21649 from gpanders/editorconfig-enable
feat(editorconfig): allow editorconfig to be toggled dynamically
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,
})