Skip to content

Commit ffc75e0

Browse files
justinmkdundargoc
authored andcommitted
docs: move editorconfig.txt into plugins.txt
It helps to have plugins living in one common area, because it signals to users the mechanisms for controlling them, which are typically driven by keymaps and autocmds rather than builtin options. We can always revisit if plugins.txt gets "too big" (for example, we may want to introduce "project.txt" for the project concept, where editorconfig and 'exrc' are relevant), but for now it's rather unusual for editorconfig.txt to have its own dedicated helpfile.
1 parent 84891f6 commit ffc75e0

File tree

4 files changed

+100
-117
lines changed

4 files changed

+100
-117
lines changed

runtime/doc/editorconfig.txt

Lines changed: 0 additions & 93 deletions
This file was deleted.

runtime/doc/plugins.txt

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ Plugins and modules included with Nvim
1111
Nvim includes various Lua and Vim plugins or modules which may provide
1212
commands (such as :TOhtml) or modules that you can optionally require() or
1313
:packadd. The Lua ones are not part of the |lua-stdlib|, that is, they are not
14-
available from the global `vim` module namespace. Some of the plugins are by
15-
default loaded while others require a |:packadd| to be loaded.
14+
available from the global `vim` module namespace. Some of the plugins are
15+
loaded by default while others are not loaded until requested by |:packadd|.
1616

1717
==============================================================================
1818
Standard plugins ~
1919
*standard-plugin-list*
20-
Help-link Loaded Short description
20+
Help-link Loaded Short description ~
2121
|package-cfilter| No Filtering quickfix/location list
2222
|package-justify| No Justify text
2323
|package-nohlsearch| No Automatically run :nohlsearch
2424
|package-termdebug| No Debug inside Nvim with gdb
2525
|matchit| Yes Extended |%| matching
26-
|editorconfig.txt| Yes Detect and internet editorconfig
26+
|editorconfig| Yes Detect and internet editorconfig
2727
|spellfile.vim| Yes Install spellfile if missing
2828
|pi_tutor.txt| Yes Interactive tutorial
2929
|pi_gzip.txt| Yes Reading and writing compressed files
@@ -37,6 +37,91 @@ Help-link Loaded Short description
3737
|pi_spec.txt| Yes Filetype plugin to work with rpm spec files
3838
|tohtml| Yes Convert buffer to html, syntax included
3939

40+
==============================================================================
41+
Builtin plugin: editorconfig *editorconfig*
42+
43+
Nvim supports EditorConfig. When a file is opened, after running |ftplugin|s
44+
and |FileType| autocommands, Nvim searches all parent directories of that file
45+
for ".editorconfig" files, parses them, and applies any properties that match
46+
the opened file. Think of it like 'modeline' for an entire (recursive)
47+
directory. For more information see https://editorconfig.org/.
48+
49+
*g:editorconfig* *b:editorconfig*
50+
51+
EditorConfig is enabled by default. To disable it, add to your config: >lua
52+
vim.g.editorconfig = false
53+
<
54+
55+
(Vimscript: `let g:editorconfig = v:false`). It can also be disabled
56+
per-buffer by setting the |b:editorconfig| buffer-local variable to `false`.
57+
58+
Nvim stores the applied properties in |b:editorconfig| if it is not `false`.
59+
60+
*editorconfig-custom-properties*
61+
62+
New properties can be added by adding a new entry to the "properties" table.
63+
The table key is a property name and the value is a callback function which
64+
accepts the number of the buffer to be modified, the value of the property in
65+
the `.editorconfig` file, and (optionally) a table containing all of the other
66+
properties and their values (useful for properties which depend on other
67+
properties). The value is always a string and must be coerced if necessary.
68+
Example: >lua
69+
70+
require('editorconfig').properties.foo = function(bufnr, val, opts)
71+
if opts.charset and opts.charset ~= "utf-8" then
72+
error("foo can only be set when charset is utf-8", 0)
73+
end
74+
vim.b[bufnr].foo = val
75+
end
76+
<
77+
78+
*editorconfig-properties*
79+
80+
The following properties are supported by default:
81+
82+
83+
charset *editorconfig.charset*
84+
One of `"utf-8"`, `"utf-8-bom"`, `"latin1"`, `"utf-16be"`, or
85+
`"utf-16le"`. Sets the 'fileencoding' and 'bomb' options.
86+
87+
end_of_line *editorconfig.end_of_line*
88+
One of `"lf"`, `"crlf"`, or `"cr"`. These correspond to setting
89+
'fileformat' to "unix", "dos", or "mac", respectively.
90+
91+
indent_size *editorconfig.indent_size*
92+
A number indicating the size of a single indent. Alternatively, use the
93+
value "tab" to use the value of the tab_width property. Sets the
94+
'shiftwidth' and 'softtabstop' options. If this value is not "tab" and the
95+
tab_width property is not set, 'tabstop' is also set to this value.
96+
97+
indent_style *editorconfig.indent_style*
98+
One of `"tab"` or `"space"`. Sets the 'expandtab' option.
99+
100+
insert_final_newline *editorconfig.insert_final_newline*
101+
`"true"` or `"false"` to ensure the file always has a trailing newline as
102+
its last byte. Sets the 'fixendofline' and 'endofline' options.
103+
104+
max_line_length *editorconfig.max_line_length*
105+
A number indicating the maximum length of a single line. Sets the
106+
'textwidth' option.
107+
108+
root *editorconfig.root*
109+
If "true", then stop searching for `.editorconfig` files in parent
110+
directories. This property must be at the top-level of the `.editorconfig`
111+
file (i.e. it must not be within a glob section).
112+
113+
spelling_language *editorconfig.spelling_language*
114+
A code of the format ss or ss-TT, where ss is an ISO 639 language code and
115+
TT is an ISO 3166 territory identifier. Sets the 'spelllang' option.
116+
117+
tab_width *editorconfig.tab_width*
118+
The display size of a single tab character. Sets the 'tabstop' option.
119+
120+
trim_trailing_whitespace *editorconfig.trim_trailing_whitespace*
121+
When `"true"`, trailing whitespace is automatically removed when the
122+
buffer is written.
123+
124+
40125
==============================================================================
41126
Builtin plugin: tohtml *tohtml*
42127

src/gen/gen_help_html.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,11 @@ local new_layout = {
8989

9090
-- Map of new:old pages, to redirect renamed pages.
9191
local redirects = {
92+
['api-ui-events'] = 'ui',
9293
['credits'] = 'backers',
94+
['plugins'] = 'editorconfig',
9395
['terminal'] = 'nvim_terminal_emulator',
9496
['tui'] = 'term',
95-
['api-ui-events'] = 'ui',
9697
}
9798

9899
-- TODO: These known invalid |links| require an update to the relevant docs.

src/gen/gen_vimdoc.lua

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -384,25 +384,6 @@ local config = {
384384
return 'treesitter-' .. name:lower()
385385
end,
386386
},
387-
editorconfig = {
388-
filename = 'editorconfig.txt',
389-
files = {
390-
'runtime/lua/editorconfig.lua',
391-
},
392-
section_order = {
393-
'editorconfig.lua',
394-
},
395-
section_fmt = function(_name)
396-
return 'EditorConfig integration'
397-
end,
398-
helptag_fmt = function(name)
399-
return name:lower()
400-
end,
401-
fn_xform = function(fun)
402-
fun.table = true
403-
fun.name = vim.split(fun.name, '.', { plain = true })[2]
404-
end,
405-
},
406387
health = {
407388
filename = 'health.txt',
408389
files = {
@@ -432,11 +413,20 @@ local config = {
432413
plugins = {
433414
filename = 'plugins.txt',
434415
section_order = {
416+
'editorconfig.lua',
435417
'tohtml.lua',
436418
},
437419
files = {
420+
'runtime/lua/editorconfig.lua',
438421
'runtime/lua/tohtml.lua',
439422
},
423+
fn_xform = function(fun)
424+
if fun.module == 'editorconfig' then
425+
-- Example: "editorconfig.properties.root()" => "editorconfig.root"
426+
fun.table = true
427+
fun.name = vim.split(fun.name, '.', { plain = true })[2] or fun.name
428+
end
429+
end,
440430
section_fmt = function(name)
441431
return 'Builtin plugin: ' .. name:lower()
442432
end,

0 commit comments

Comments
 (0)