aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Anders <greg@gpanders.com>2023-01-03 11:08:58 -0700
committerGregory Anders <greg@gpanders.com>2023-01-03 11:36:38 -0700
commitc951236d638af242626ffc1bc23df5a57549c0f5 (patch)
tree7534bd6652a0fb4910a6d6b1e9df9e61a3f408b8
parente88cdc9a0f9ecfa2636b04f41354f234251dd57e (diff)
downloadrneovim-c951236d638af242626ffc1bc23df5a57549c0f5.tar.gz
rneovim-c951236d638af242626ffc1bc23df5a57549c0f5.tar.bz2
rneovim-c951236d638af242626ffc1bc23df5a57549c0f5.zip
docs(editorconfig): add editorconfig.txt
-rw-r--r--runtime/doc/editorconfig.txt89
-rw-r--r--runtime/doc/news.txt2
2 files changed, 90 insertions, 1 deletions
diff --git a/runtime/doc/editorconfig.txt b/runtime/doc/editorconfig.txt
new file mode 100644
index 0000000000..e93713e5ff
--- /dev/null
+++ b/runtime/doc/editorconfig.txt
@@ -0,0 +1,89 @@
+*editorconfig.txt* Nvim
+
+
+ NVIM REFERENCE MANUAL
+
+
+EditorConfig integration *editorconfig*
+
+Nvim natively supports EditorConfig. When a file is opened, Nvim searches
+upward through all of the parent directories of that file looking for
+".editorconfig" files. Each of these is parsed and any properties that match
+the opened file are applied.
+
+For more information on EditorConfig, see https://editorconfig.org/.
+
+ *g:editorconfig_enable*
+EditorConfig integration can be disabled by adding >lua
+
+ vim.g.editorconfig_enable = false
+<
+to the user's |init.lua| file (or the Vimscript equivalent to |init.vim|).
+
+ *b:editorconfig*
+When Nvim finds a valid .editorconfig file it will store the applied
+properties in the buffer variable |b:editorconfig|.
+
+ *editorconfig-properties*
+The following properties are supported by default:
+
+ *editorconfig_root*
+root If "true", then stop searching for .editorconfig files
+ in parent directories. This property must be at the
+ top-level of the .editorconfig file (i.e. it must not
+ be within a glob section).
+
+ *editorconfig_charset*
+charset One of "utf-8", "utf-8-bom", "latin1", "utf-16be", or
+ "utf-16le". Sets the 'fileencoding' and 'bomb'
+ options.
+
+ *editorconfig_end_of_line*
+end_of_line One of "lf", "crlf", or "cr". These correspond to
+ setting 'fileformat' to "unix", "dos", or "mac",
+ respectively.
+
+ *editorconfig_indent_style*
+indent_style One of "tab" or "space". Sets the 'expandtab' option.
+
+ *editorconfig_indent_size*
+indent_size A number indicating the size of a single indent.
+ Alternatively, use the value "tab" to use the value of
+ the tab_width property. Sets the 'shiftwidth' and
+ 'softtabstop'.
+
+ *editorconfig_insert_final_newline*
+insert_final_newline "true" or "false" to ensure the file always has a
+ trailing newline as its last byte. Sets the
+ 'fixendofline' and 'endofline' options.
+
+ *editorconfig_max_line_length*
+max_line_length A number indicating the maximum length of a single
+ line. Sets the 'textwidth' option.
+
+ *editorconfig_tab_width*
+tab_width The display size of a single tab character. Sets the
+ 'tabstop' option.
+
+ *editorconfig_trim_trailing_whitespace*
+trim_trailing_whitespace
+ When "true", trailing whitespace is automatically
+ removed when the buffer is written.
+
+ *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
+<
+ vim:tw=78:ts=8:noet:ft=help:norl:
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index e5d65b55dd..03bbf1567b 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -51,7 +51,7 @@ NEW FEATURES *news-features*
The following new APIs or features were added.
• EditorConfig support is now builtin. This is enabled by default and happens
- automatically. To disable it, users should add >vim
+ automatically. To disable it, users should add >lua
vim.g.editorconfig_enable = false
<