docs: misc, editorconfig

fix https://github.com/neovim/neovim/issues/36858
This commit is contained in:
Justin M. Keyes
2025-12-08 01:39:41 -05:00
parent 8165427b4d
commit 31dfecb458
16 changed files with 124 additions and 63 deletions

View File

@@ -282,9 +282,9 @@ nvim_buf_lines_event[{buf}, {changedtick}, {firstline}, {lastline}, {linedata},
part of your request to ensure that no other changes have been made.
{firstline} integer line number of the first line that was replaced.
Zero-indexed: if line 1 was replaced then {firstline} will be 0, not
1. {firstline} is always less than or equal to the number of lines
that were in the buffer before the lines were replaced.
Zero-indexed: if line 1 was replaced then {firstline} will be zero,
not one. {firstline} is always less than or equal to the number of
lines that were in the buffer before the lines were replaced.
{lastline} integer line number of the first line that was not replaced
(i.e. the range {firstline}, {lastline} is end-exclusive).
@@ -745,22 +745,33 @@ nvim_eval_statusline({str}, {opts}) *nvim_eval_statusline()*
priority last).
nvim_exec_lua({code}, {args}) *nvim_exec_lua()*
Execute Lua code. Parameters (if any) are available as `...` inside the
chunk. The chunk can return a value.
Executes Lua code. Arguments are available as `...` inside the chunk. The
chunk can return a value.
Only statements are executed. To evaluate an expression, prefix it with
`return`: return my_function(...)
"return": `return my_function(...)`
Example: >lua
local peer = vim.fn.jobstart({ vim.v.progpath, '--clean', '--embed' }, { rpc=true })
vim.print(vim.rpcrequest(peer, 'nvim_exec_lua', [[
local a, b = ...
return ('result: %s'):format(a + b)
]],
{ 1, 3 }
)
)
<
Attributes: ~
|RPC| only
Since: 0.5.0
Parameters: ~
• {code} (`string`) Lua code to execute
• {args} (`any[]`) Arguments to the code
• {code} (`string`) Lua code to execute.
• {args} (`any[]`) Arguments to the Lua code.
Return: ~
(`any`) Return value of Lua code if present or NIL.
(`any`) Value returned by the Lua code (if any), or NIL.
nvim_feedkeys({keys}, {mode}, {escape_ks}) *nvim_feedkeys()*
Sends input-keys to Nvim, subject to various quirks controlled by `mode`

View File

@@ -703,11 +703,12 @@ vim.rpcnotify({channel}, {method}, {...}) *vim.rpcnotify()*
• {...} (`any?`)
vim.rpcrequest({channel}, {method}, {...}) *vim.rpcrequest()*
Sends a request to {channel} to invoke {method} via |RPC| and blocks until
a response is received.
Invokes |RPC| `method` on `channel` and blocks until a response is
received.
Note: NIL values as part of the return value is represented as |vim.NIL|
special value
Note: Msgpack NIL values in the response are represented as |vim.NIL|.
Example: see |nvim_exec_lua()|
Parameters: ~
• {channel} (`integer`)
@@ -2091,6 +2092,9 @@ vim.tbl_get({o}, {...}) *vim.tbl_get()*
Return: ~
(`any`) Nested value indexed by key (if it exists), else nil
See also: ~
• |unpack()|
vim.tbl_isempty({t}) *vim.tbl_isempty()*
Checks if a table is empty.

View File

@@ -3947,7 +3947,7 @@ package.path *package.path*
files `./foo.lua`, `./foo.lc`, and `/usr/local/foo/init.lua`, in that
order.
package.preload *package.preload()*
package.preload *package.preload*
A table to store loaders for specific modules (see |require()|).
package.seeall({module}) *package.seeall()*

View File

@@ -345,10 +345,10 @@ For starters, read chapter 27 of the user manual |usr_27.txt|.
*/branch* */\&*
2. A branch is one or more concats, separated by "\&". It matches the last
concat, but only if all the preceding concats also match at the same
position. Examples:
position. Examples: >
"foobeep\&..." matches "foo" in "foobeep".
".*Peter\&.*Bob" matches in a line containing both "Peter" and "Bob"
<
branch ::= concat
or concat \& concat
or concat \& concat \& concat
@@ -609,13 +609,13 @@ overview.
*/star* */\star*
* (use \* when 'magic' is not set)
Matches 0 or more of the preceding atom, as many as possible.
Example 'nomagic' matches ~
Example 'nomagic' matches >
a* a\* "", "a", "aa", "aaa", etc.
.* \.\* anything, also an empty string, no end-of-line
\_.* \_.\* everything up to the end of the buffer
\_.*END \_.\*END everything up to and including the last "END"
in the buffer
<
Exception: When "*" is used at the start of the pattern or just after
"^" it matches the star character.

View File

@@ -15,8 +15,8 @@ available from the global `vim` module namespace. Some of the plugins are
loaded by default while others are not loaded until requested by |:packadd|.
==============================================================================
Standard plugins ~
*standard-plugin-list*
Standard plugins *standard-plugin-list*
Help-link Loaded Short description ~
|difftool| No Compares two directories or files side-by-side
|editorconfig| Yes Detect and interpret editorconfig
@@ -84,11 +84,26 @@ open({left}, {right}, {opt}) *difftool.open()*
==============================================================================
Builtin plugin: editorconfig *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/.
EditorConfig is like 'modeline' for an entire (recursive) directory. When a
file is opened, after running |ftplugin|s and |FileType| autocommands, the
EditorConfig feature searches all parent directories of that file for
`.editorconfig` files, parses them, and applies their properties. For more
information see https://editorconfig.org/.
Example `.editorconfig` file: >ini
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
max_line_length = 42
trim_trailing_whitespace = true
[*.{diff,md}]
trim_trailing_whitespace = false
<
*g:editorconfig* *b:editorconfig*

View File

@@ -481,7 +481,7 @@ break.
This will match at a line that ends in "one" and the next line starts with
"two". To match "one two" as well, you need to match a space or a line
break. The item to use for it is "\_s": >
break. The item to use for it is `\_s`: >
/one\_stwo
@@ -501,10 +501,10 @@ Many other items can be made to match a line break by prepending "\_". For
example: "\_." matches any character or a line break.
Note:
"\_.*" matches everything until the end of the file. Be careful with
`\_.*` matches everything until the end of the file. Be careful with
this, it can make a search command very slow.
Another example is "\_[]", a character range that includes a line break: >
Another example is `\_[]`, a character range that includes a line break: >
/"\_[^"]*"

View File

@@ -1,9 +1,24 @@
--- @brief
--- 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/.
--- EditorConfig is like 'modeline' for an entire (recursive) directory. When a file is opened,
--- after running |ftplugin|s and |FileType| autocommands, the EditorConfig feature searches all
--- parent directories of that file for `.editorconfig` files, parses them, and applies their
--- properties. For more information see https://editorconfig.org/.
---
--- Example `.editorconfig` file:
--- ```ini
--- root = true
---
--- [*]
--- charset = utf-8
--- end_of_line = lf
--- indent_size = 4
--- indent_style = space
--- max_line_length = 42
--- trim_trailing_whitespace = true
---
--- [*.{diff,md}]
--- trim_trailing_whitespace = false
--- ```
--- @brief [g:editorconfig]() [b:editorconfig]()
---

View File

@@ -94,11 +94,12 @@ function vim.empty_dict() end
--- @param ...? any
function vim.rpcnotify(channel, method, ...) end
--- Sends a request to {channel} to invoke {method} via |RPC| and blocks until
--- a response is received.
--- Invokes |RPC| `method` on `channel` and blocks until a response is received.
---
--- Note: Msgpack NIL values in the response are represented as |vim.NIL|.
---
--- Example: see [nvim_exec_lua()]
---
--- Note: NIL values as part of the return value is represented as |vim.NIL|
--- special value
--- @param channel integer
--- @param method string
--- @param ...? any

View File

@@ -249,7 +249,9 @@ local function check_enabled_configs()
ipairs(v --[[@as string[] ]])
do
if not vim.list_contains(valid_filetypes, filetype) then
report_warn(("Unknown filetype '%s'."):format(filetype))
report_warn(
("Unknown filetype '%s' (Hint: filename extension != filetype)."):format(filetype)
)
end
end
end

View File

@@ -717,6 +717,7 @@ end
--- vim.tbl_get({ key = { nested_key = true }}, 'key', 'nested_key') == true
--- vim.tbl_get({ key = {}}, 'key', 'nested_key') == nil
--- ```
---@see |unpack()|
---
---@param o table Table to index
---@param ... any Optional keys (0 or more, variadic) via which to index the table