aboutsummaryrefslogtreecommitdiff
path: root/runtime/plugin/editorconfig.lua
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-01-14 23:13:48 -0700
committerJosh Rahm <joshuarahm@gmail.com>2023-01-14 23:13:48 -0700
commit7a6e249a32f79331bfb5e29bc0cabcf89a026081 (patch)
tree27a7354ec18448e4090ac91581534baa7b537254 /runtime/plugin/editorconfig.lua
parent442d4e54c30b8e193e3f6e4d32b43e96815bccd7 (diff)
parent6134c1e8a39a5e61d0593613343a5923a86e3545 (diff)
downloadrneovim-7a6e249a32f79331bfb5e29bc0cabcf89a026081.tar.gz
rneovim-7a6e249a32f79331bfb5e29bc0cabcf89a026081.tar.bz2
rneovim-7a6e249a32f79331bfb5e29bc0cabcf89a026081.zip
Merge remote-tracking branch 'upstream/master' into usermarks
Diffstat (limited to 'runtime/plugin/editorconfig.lua')
-rw-r--r--runtime/plugin/editorconfig.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/runtime/plugin/editorconfig.lua b/runtime/plugin/editorconfig.lua
new file mode 100644
index 0000000000..54cd0e828e
--- /dev/null
+++ b/runtime/plugin/editorconfig.lua
@@ -0,0 +1,13 @@
+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,
+})