aboutsummaryrefslogtreecommitdiff
path: root/runtime/plugin/editorconfig.lua
blob: 8de304631e4be091e90fd87e9c3178d617d7311a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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.nonnil(vim.b.editorconfig, vim.g.editorconfig, true)
    if not enable then
      return
    end

    require('editorconfig').config(ev.buf)
  end,
})