mirror of
https://github.com/neovim/neovim.git
synced 2025-12-24 23:29:00 +00:00
docs: misc, editorconfig
fix https://github.com/neovim/neovim/issues/36858
This commit is contained in:
@@ -246,8 +246,8 @@ Multiple Vim versions are tracked in `version.c`, so that `has('patch-x.y.z')`
|
||||
works even if `v:version` is "behind". Whenever we "complete" merging all
|
||||
patches from a Vim `v:version`, the steps to bump `v:version` are:
|
||||
|
||||
1. Remove the fully-merged version from `version.c:Versions`.
|
||||
2. Adjust the regexp in `vim-patch.sh`. For example to remove 8.1:
|
||||
1. Remove the fully-merged version from `vim-patch.sh` by adjusting the regexp.
|
||||
For example, to remove version "8.1":
|
||||
```diff
|
||||
diff --git a/scripts/vim-patch.sh b/scripts/vim-patch.sh
|
||||
index d64f6b6..1d3dcdf 100755
|
||||
@@ -263,7 +263,7 @@ patches from a Vim `v:version`, the steps to bump `v:version` are:
|
||||
git -C "${NVIM_SOURCE_DIR}" log --format="%s%n%b" -E --grep="^[* ]*vim-patch:${patch_pat}" |
|
||||
grep -oE "^[* ]*vim-patch:${patch_pat}" |
|
||||
```
|
||||
3. Run `nvim -l scripts/vimpatch.lua` to regenerate `version.c`. Or wait for the
|
||||
2. Run `nvim -l scripts/vimpatch.lua` to regenerate `version.c`. Or wait for the
|
||||
`vim_patches.yml` CI job to do it.
|
||||
|
||||
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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()*
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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*
|
||||
|
||||
|
||||
@@ -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: >
|
||||
|
||||
/"\_[^"]*"
|
||||
|
||||
|
||||
@@ -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]()
|
||||
---
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1193,7 +1193,7 @@ local function check_language(filename, clean_lines, linenum, error)
|
||||
|
||||
-- Check for MAYBE
|
||||
if maybe_regex:match_str(line) then
|
||||
error(filename, linenum, 'readability/bool', 4, 'Use kNONE from TriState instead of MAYBE.')
|
||||
error(filename, linenum, 'readability/bool', 4, 'Use kNone from TriState instead of MAYBE.')
|
||||
end
|
||||
|
||||
-- Detect preincrement/predecrement at start of line
|
||||
|
||||
@@ -497,18 +497,29 @@ String nvim_replace_termcodes(String str, Boolean from_part, Boolean do_lt, Bool
|
||||
return cstr_as_string(ptr);
|
||||
}
|
||||
|
||||
/// 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(...)
|
||||
/// Only statements are executed. To evaluate an expression, prefix it with "return": `return
|
||||
/// my_function(...)`
|
||||
///
|
||||
/// @param code Lua code to execute
|
||||
/// @param args Arguments to the code
|
||||
/// @param[out] err Details of an error encountered while parsing
|
||||
/// or executing the Lua code.
|
||||
/// 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 }
|
||||
/// )
|
||||
/// )
|
||||
/// ```
|
||||
///
|
||||
/// @return Return value of Lua code if present or NIL.
|
||||
/// @param code Lua code to execute.
|
||||
/// @param args Arguments to the Lua code.
|
||||
/// @param[out] err Lua error raised while parsing or executing the Lua code.
|
||||
///
|
||||
/// @return Value returned by the Lua code (if any), or NIL.
|
||||
Object nvim_exec_lua(String code, Array args, Arena *arena, Error *err)
|
||||
FUNC_API_SINCE(7)
|
||||
FUNC_API_REMOTE_ONLY
|
||||
|
||||
@@ -1668,7 +1668,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, b
|
||||
= !has_foldtext && buf_meta_total(wp->w_buffer, kMTMetaInline) > 0;
|
||||
int virt_line_index = -1;
|
||||
int virt_line_flags = 0;
|
||||
// Repeat for the whole displayed line.
|
||||
|
||||
// Repeat for each cell in the displayed line.
|
||||
while (true) {
|
||||
int has_match_conc = 0; ///< match wants to conceal
|
||||
int decor_conceal = 0;
|
||||
|
||||
@@ -1084,14 +1084,15 @@ void grid_del_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
|
||||
}
|
||||
}
|
||||
|
||||
/// @param overflow Number of cells to skip.
|
||||
static void grid_draw_bordertext(VirtText vt, int col, int winbl, const int *hl_attr,
|
||||
BorderTextType bt, int over_flow)
|
||||
BorderTextType bt, int overflow)
|
||||
{
|
||||
int default_attr = hl_attr[bt == kBorderTextTitle ? HLF_BTITLE : HLF_BFOOTER];
|
||||
if (over_flow > 0) {
|
||||
if (overflow > 0) {
|
||||
grid_line_puts(1, "<", -1, hl_apply_winblend(winbl, default_attr));
|
||||
col += 1;
|
||||
over_flow += 1;
|
||||
overflow += 1;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < kv_size(vt);) {
|
||||
@@ -1104,18 +1105,17 @@ static void grid_draw_bordertext(VirtText vt, int col, int winbl, const int *hl_
|
||||
attr = default_attr;
|
||||
}
|
||||
// Skip characters from the beginning when title overflows available width.
|
||||
// over_flow contains the number of cells to skip.
|
||||
if (over_flow > 0) {
|
||||
if (overflow > 0) {
|
||||
int cells = (int)mb_string2cells(text);
|
||||
// Skip entire chunk if overflow is larger than chunk width.
|
||||
if (over_flow >= cells) {
|
||||
over_flow -= cells;
|
||||
if (overflow >= cells) {
|
||||
overflow -= cells;
|
||||
continue;
|
||||
}
|
||||
// Skip partial characters within the chunk.
|
||||
char *p = text;
|
||||
while (*p && over_flow > 0) {
|
||||
over_flow -= utf_ptr2cells(p);
|
||||
while (*p && overflow > 0) {
|
||||
overflow -= utf_ptr2cells(p);
|
||||
p += utfc_ptr2len(p);
|
||||
}
|
||||
text = p;
|
||||
|
||||
@@ -20,10 +20,10 @@ describe('clint.lua', function()
|
||||
'test/functional/fixtures/clint_test.c:22: Storage class (static, extern, typedef, etc) should be first. [build/storage_class] [5]',
|
||||
'test/functional/fixtures/clint_test.c:25: Use true instead of TRUE. [readability/bool] [4]',
|
||||
'test/functional/fixtures/clint_test.c:26: Use false instead of FALSE. [readability/bool] [4]',
|
||||
'test/functional/fixtures/clint_test.c:27: Use kNONE from TriState instead of MAYBE. [readability/bool] [4]',
|
||||
'test/functional/fixtures/clint_test.c:27: Use kNone from TriState instead of MAYBE. [readability/bool] [4]',
|
||||
'test/functional/fixtures/clint_test.c:31: Use true instead of TRUE. [readability/bool] [4]',
|
||||
'test/functional/fixtures/clint_test.c:32: Use false instead of FALSE. [readability/bool] [4]',
|
||||
'test/functional/fixtures/clint_test.c:35: Use kNONE from TriState instead of MAYBE. [readability/bool] [4]',
|
||||
'test/functional/fixtures/clint_test.c:35: Use kNone from TriState instead of MAYBE. [readability/bool] [4]',
|
||||
'test/functional/fixtures/clint_test.c:41: /*-style comment found, it should be replaced with //-style. /*-style comments are only allowed inside macros. Note that you should not use /*-style comments to document macros itself, use doxygen-style comments for this. [readability/old_style_comment] [5]',
|
||||
'test/functional/fixtures/clint_test.c:54: Do not use preincrement in statements, use postincrement instead [readability/increment] [5]',
|
||||
'test/functional/fixtures/clint_test.c:55: Do not use preincrement in statements, including for(;; action) [readability/increment] [4]',
|
||||
|
||||
Reference in New Issue
Block a user