*editorconfig.txt* Nvim
NVIM REFERENCE MANUAL
Type |gO| to see the table of contents.
==============================================================================
EditorConfig integration *editorconfig*
Nvim supports EditorConfig. When a file is opened, after running |ftplugin|s
and |FileType| autocommands, Nvim searches all parent directories of that file
for ".editorconfig" files, parses them, and applies any properties that match
the opened file. Think of it like 'modeline' for an entire (recursive)
directory. For more information see https://editorconfig.org/.
*g:editorconfig* *b:editorconfig*
EditorConfig is enabled by default. To disable it, add to your config: >lua
vim.g.editorconfig = false
<
(Vimscript: `let g:editorconfig = v:false`). It can also be disabled
per-buffer by setting the |b:editorconfig| buffer-local variable to `false`.
Nvim stores the applied properties in |b:editorconfig| if it is not `false`.
*editorconfig-custom-properties*
New properties can be added by adding a new entry to the "properties" table.
The table key is a property name and the value is a callback function which
accepts the number of the buffer to be modified, the value of the property in
the `.editorconfig` file, and (optionally) a table containing all of the other
properties and their values (useful for properties which depend on other
properties). The value is always a string and must be coerced if necessary.
Example: >lua
require('editorconfig').properties.foo = function(bufnr, val, opts)
if opts.charset and opts.charset ~= "utf-8" then
error("foo can only be set when charset is utf-8", 0)
end
vim.b[bufnr].foo = val
end
<
*editorconfig-properties*
The following properties are supported by default:
charset *editorconfig.charset*
One of `"utf-8"`,