editorconfig.lua 420 B

1234567891011121314
  1. local group = vim.api.nvim_create_augroup('editorconfig', {})
  2. vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead', 'BufFilePost' }, {
  3. group = group,
  4. callback = function(args)
  5. -- Buffer-local enable has higher priority
  6. local enable = vim.F.if_nil(vim.b.editorconfig, vim.F.if_nil(vim.g.editorconfig, true))
  7. if not enable then
  8. return
  9. end
  10. require('editorconfig').config(args.buf)
  11. end,
  12. })