From 6320c91c50e4c0ee5c366241f9a413c4edbfdad8 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 26 Jan 2023 09:58:27 +0800 Subject: vim-patch:9.0.1231: completion of :runtime does not handle {where} argument Problem: Completion of :runtime does not handle {where} argument. Solution: Parse the {where} argument. (closes vim/vim#11863) https://github.com/vim/vim/commit/3770f4c9cde7b5fcd10b6fa2e665cd0b69450fb2 --- runtime/doc/builtin.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 4d2c85b134..c20f52967b 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2991,6 +2991,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* messages |:messages| suboptions option options packadd optional package |pack-add| names + runtime runtime file names |:runtime| scriptnames sourced script names |:scriptnames| shellcmd Shell command sign |:sign| suboptions -- cgit From f03f6263bb3eb0b28b759292cb6ef4465a05cafe Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 26 Jan 2023 10:38:53 +0800 Subject: vim-patch:9.0.1238: :runtime completion can be further improved Problem: :runtime completion can be further improved. Solution: Also complete the {where} argument values and adjust the completion for that. (closes vim/vim#11874) https://github.com/vim/vim/commit/5c8771bc5a2be123ab8e6325fa60ed524e8efb09 --- runtime/doc/builtin.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index c20f52967b..c8f5570bae 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2991,7 +2991,7 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* messages |:messages| suboptions option options packadd optional package |pack-add| names - runtime runtime file names |:runtime| + runtime |:runtime| completion scriptnames sourced script names |:scriptnames| shellcmd Shell command sign |:sign| suboptions -- cgit From e02df23b4e24046d99c7bfa6a63b4db16c28a7be Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 26 Jan 2023 19:35:06 +0800 Subject: docs: clarify :runtime behavior without [where] again (#22003) The behavior changed again after #15867, change the docs to describe latest behavior. --- runtime/doc/repeat.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index 1bbd20702b..bf77aacdc0 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -211,9 +211,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. When [!] is included, all found files are sourced. Else only the first found file is sourced. - When [where] is omitted, first 'runtimepath' is - searched, then directories under "start" in 'packpath' - are searched. + When [where] is omitted only 'runtimepath' is used. Other values: START search only under "start" in 'packpath' OPT search only under "opt" in 'packpath' -- cgit From aec4b476c5689f032103ab3e0ca068fc2af8bbba Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 27 Jan 2023 11:24:20 +0000 Subject: docs(api): tweak data arg for nvim_create_autocmd (#22008) Fixes #21964 --- runtime/doc/api.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 0e1cc3c28c..95a929b808 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -3281,7 +3281,7 @@ nvim_create_autocmd({event}, {*opts}) *nvim_create_autocmd()* • match: (string) expanded value of || • buf: (number) expanded value of || • file: (string) expanded value of || - • data: (any) arbitrary data passed to + • data: (any) arbitrary data passed from |nvim_exec_autocmds()| • command (string) optional: Vim command to execute on event. -- cgit From c032e83b22994332dd8769ef34cb817906a63cac Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 26 Jan 2023 09:42:23 +0100 Subject: fix(treesitter): validate language name Problem: Some injections (like markdown) allow specifying arbitrary language names for code blocks, which may be lead to errors when looking for a corresponding parser in runtime path. Solution: Validate that the language name only contains alphanumeric characters and `_` (e.g., for `c_sharp`) and error otherwise. --- runtime/doc/treesitter.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/doc') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 917863eef8..9bfdc0b94e 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -684,6 +684,7 @@ require_language({lang}, {path}, {silent}, {symbol_name}) Parameters: ~ • {lang} (string) Language the parser should parse + (alphanumerical and `_` only) • {path} (string|nil) Optional path the parser is located at • {silent} (boolean|nil) Don't throw an error if language not found -- cgit From d6d6ab3f8e77d54c8030c0c18f17d3c72ac4445c Mon Sep 17 00:00:00 2001 From: bfredl Date: Sat, 26 Feb 2022 15:19:10 +0100 Subject: feat(lua): low-level interpreter mode (nvim -ll) --- runtime/doc/starting.txt | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 179bacdb24..5e0718c3bb 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -239,6 +239,14 @@ argument. Disables |shada| unless |-i| was given. Disables swapfile (like |-n|). + *-ll* +-ll {script} [args] + Execute a lua script, similarly to |-l|, but the editor is not + initialized. This gives a lua enviroment similar to a worker + thread. See |lua-loop-threading|. + + Unlike `-l` no prior arguments are allowed. + *-b* -b Binary mode. File I/O will only recognize to separate lines. The 'expandtab' option will be reset. The 'textwidth' -- cgit From cb97d5425a0b6e77267795607ff45255a4ac1c22 Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Wed, 1 Feb 2023 23:26:26 -0700 Subject: docs: clarify "pipe" mode for sockconnect Make it more clear that on unix the "pipe" mode of sockconnect uses unix local domain sockets, not named pipes (FIFOs) which are not currently supported. See discussion in #22080. Signed-off-by: Thayne McCombs --- runtime/doc/builtin.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index c8f5570bae..2fc7dce7fc 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1959,7 +1959,7 @@ exp({expr}) *exp()* Compute()->exp() expand({string} [, {nosuf} [, {list}]]) *expand()* - Expand wildcards and the following special keywords in + Expand wildcards and the following special keywords in {string}. 'wildignorecase' applies. If {list} is given and it is |TRUE|, a List will be returned. @@ -7569,10 +7569,14 @@ sinh({expr}) *sinh()* sockconnect({mode}, {address} [, {opts}]) *sockconnect()* Connect a socket to an address. If {mode} is "pipe" then - {address} should be the path of a named pipe. If {mode} is - "tcp" then {address} should be of the form "host:port" where - the host should be an ip adderess or host name, and port the - port number. + {address} should be the path of a local domain socket (on + unix) or named pipe (on Windows). If {mode} is "tcp" then + {address} should be of the form "host:port" where the host + should be an ip adderess or host name, and port the port + number. + + For "pipe" mode, see |luv-pipe-handle|. For "tcp" mode, see + |luv-tcp-handle|. Returns a |channel| ID. Close the socket with |chanclose()|. Use |chansend()| to send data over a bytes socket, and -- cgit From 144279ef30a432ac8416746e3491f3120ae9b4e8 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 3 Feb 2023 09:18:18 +0100 Subject: vim-patch:be4e01637e71 (#22103) Update runtime files. https://github.com/vim/vim/commit/be4e01637e71c8d5095c33b9861fd70b41476732 Co-authored-by: Bram Moolenaar --- runtime/doc/diff.txt | 2 +- runtime/doc/fold.txt | 2 +- runtime/doc/options.txt | 8 ++++---- runtime/doc/quickfix.txt | 2 -- 4 files changed, 6 insertions(+), 8 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/diff.txt b/runtime/doc/diff.txt index 382d025d3c..ead68c5f4f 100644 --- a/runtime/doc/diff.txt +++ b/runtime/doc/diff.txt @@ -125,7 +125,7 @@ file for a moment and come back to the same file and be in diff mode again. buffers. The `:diffoff` command resets the relevant options to the values they had when -using `:diffsplit`, `:diffpatch` , `:diffthis`. or starting Vim in diff mode. +using `:diffsplit`, `:diffpatch`, `:diffthis`. or starting Vim in diff mode. When using `:diffoff` twice the last saved values are restored. Otherwise they are set to their default value: diff --git a/runtime/doc/fold.txt b/runtime/doc/fold.txt index 35a3be35fb..859562fae6 100644 --- a/runtime/doc/fold.txt +++ b/runtime/doc/fold.txt @@ -195,7 +195,7 @@ non-matching marker pairs. Example: > /* funcB() {{{2 */ void funcB() {} - +< *{{{* *}}}* A fold starts at a "{{{" marker. The following number specifies the fold level. What happens depends on the difference between the current fold level and the level given by the marker: diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index b1af90a604..1f91b89322 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -3864,8 +3864,8 @@ A jump table for the options with a short description can be found at |Q_op|. are left blank. *lcs-multispace* multispace:c... - One or more characters to use cyclically to show for - multiple consecutive spaces. Overrides the "space" + One or more characters to use cyclically to show for + multiple consecutive spaces. Overrides the "space" setting, except for single spaces. When omitted, the "space" setting is used. For example, `:set listchars=multispace:---+` shows ten consecutive @@ -6205,8 +6205,8 @@ A jump table for the options with a short description can be found at |Q_op|. windows. * - Set highlight group to User{N}, where {N} is taken from the minwid field, e.g. %1*. Restore normal highlight with %* or %0*. - The difference between User{N} and StatusLine will be applied - to StatusLineNC for the statusline of non-current windows. + The difference between User{N} and StatusLine will be applied to + StatusLineNC for the statusline of non-current windows. The number N must be between 1 and 9. See |hl-User1..9| When displaying a flag, Vim removes the leading comma, if any, when diff --git a/runtime/doc/quickfix.txt b/runtime/doc/quickfix.txt index b1f7c927cc..f70dbd0913 100644 --- a/runtime/doc/quickfix.txt +++ b/runtime/doc/quickfix.txt @@ -353,8 +353,6 @@ processing a quickfix or location list command, it will be aborted. If numbers [from] and/or [to] are given, the respective range of errors is listed. A negative number counts from the last error backwards, -1 being the last error. - The 'switchbuf' settings are respected when jumping - to a buffer. The |:filter| command can be used to display only the quickfix entries matching a supplied pattern. The pattern is matched against the filename, module name, -- cgit From 9a5678463c96baf3b39cb3083ddf0da87d39aa23 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Sat, 4 Feb 2023 14:58:38 +0000 Subject: fix(treesitter): fix most diagnostics --- runtime/doc/lua.txt | 3 +- runtime/doc/treesitter.txt | 188 +++++++++++++++++++++++---------------------- 2 files changed, 98 insertions(+), 93 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 47249a484b..0472c11a15 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1362,7 +1362,8 @@ defer_fn({fn}, {timeout}) *vim.defer_fn()* Parameters: ~ • {fn} (function) Callback to call once `timeout` expires - • {timeout} integer Number of milliseconds to wait before calling `fn` + • {timeout} (integer) Number of milliseconds to wait before calling + `fn` Return: ~ (table) timer luv timer object diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 9bfdc0b94e..7bc9f3f9a7 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -66,102 +66,102 @@ See |lua-treesitter-languagetree| for the list of available methods. ============================================================================== TREESITTER TREES *treesitter-tree* - *tstree* + *TSTree* A "treesitter tree" represents the parsed contents of a buffer, which can be used to perform further analysis. It is a |luaref-userdata| reference to an object held by the tree-sitter library. -An instance `tstree` of a treesitter tree supports the following methods. +An instance `TSTree` of a treesitter tree supports the following methods. -tstree:root() *tstree:root()* +TSTree:root() *TSTree:root()* Return the root node of this tree. -tstree:copy() *tstree:copy()* - Returns a copy of the `tstree`. +TSTree:copy() *TSTree:copy()* + Returns a copy of the `TSTree`. ============================================================================== TREESITTER NODES *treesitter-node* - *tsnode* + *TSNode* A "treesitter node" represents one specific element of the parsed contents of a buffer, which can be captured by a |Query| for, e.g., highlighting. It is a |luaref-userdata| reference to an object held by the tree-sitter library. -An instance `tsnode` of a treesitter node supports the following methods. +An instance `TSNode` of a treesitter node supports the following methods. -tsnode:parent() *tsnode:parent()* +TSNode:parent() *TSNode:parent()* Get the node's immediate parent. -tsnode:next_sibling() *tsnode:next_sibling()* +TSNode:next_sibling() *TSNode:next_sibling()* Get the node's next sibling. -tsnode:prev_sibling() *tsnode:prev_sibling()* +TSNode:prev_sibling() *TSNode:prev_sibling()* Get the node's previous sibling. -tsnode:next_named_sibling() *tsnode:next_named_sibling()* +TSNode:next_named_sibling() *TSNode:next_named_sibling()* Get the node's next named sibling. -tsnode:prev_named_sibling() *tsnode:prev_named_sibling()* +TSNode:prev_named_sibling() *TSNode:prev_named_sibling()* Get the node's previous named sibling. -tsnode:iter_children() *tsnode:iter_children()* - Iterates over all the direct children of {tsnode}, regardless of whether +TSNode:iter_children() *TSNode:iter_children()* + Iterates over all the direct children of {TSNode}, regardless of whether they are named or not. Returns the child node plus the eventual field name corresponding to this child node. -tsnode:field({name}) *tsnode:field()* +TSNode:field({name}) *TSNode:field()* Returns a table of the nodes corresponding to the {name} field. -tsnode:child_count() *tsnode:child_count()* +TSNode:child_count() *TSNode:child_count()* Get the node's number of children. -tsnode:child({index}) *tsnode:child()* +TSNode:child({index}) *TSNode:child()* Get the node's child at the given {index}, where zero represents the first child. -tsnode:named_child_count() *tsnode:named_child_count()* +TSNode:named_child_count() *TSNode:named_child_count()* Get the node's number of named children. -tsnode:named_child({index}) *tsnode:named_child()* +TSNode:named_child({index}) *TSNode:named_child()* Get the node's named child at the given {index}, where zero represents the first named child. -tsnode:start() *tsnode:start()* +TSNode:start() *TSNode:start()* Get the node's start position. Return three values: the row, column and total byte count (all zero-based). -tsnode:end_() *tsnode:end_()* +TSNode:end_() *TSNode:end_()* Get the node's end position. Return three values: the row, column and total byte count (all zero-based). -tsnode:range() *tsnode:range()* +TSNode:range() *TSNode:range()* Get the range of the node. Return four values: the row, column of the start position, then the row, column of the end position. -tsnode:type() *tsnode:type()* +TSNode:type() *TSNode:type()* Get the node's type as a string. -tsnode:symbol() *tsnode:symbol()* +TSNode:symbol() *TSNode:symbol()* Get the node's type as a numerical id. -tsnode:named() *tsnode:named()* +TSNode:named() *TSNode:named()* Check if the node is named. Named nodes correspond to named rules in the grammar, whereas anonymous nodes correspond to string literals in the grammar. -tsnode:missing() *tsnode:missing()* +TSNode:missing() *TSNode:missing()* Check if the node is missing. Missing nodes are inserted by the parser in order to recover from certain kinds of syntax errors. -tsnode:has_error() *tsnode:has_error()* +TSNode:has_error() *TSNode:has_error()* Check if the node is a syntax error or contains any syntax errors. -tsnode:sexpr() *tsnode:sexpr()* +TSNode:sexpr() *TSNode:sexpr()* Get an S-expression representing the node as a string. -tsnode:id() *tsnode:id()* +TSNode:id() *TSNode:id()* Get an unique identifier for the node inside its own tree. No guarantees are made about this identifier's internal representation, @@ -171,20 +171,20 @@ tsnode:id() *tsnode:id()* Note: The `id` is not guaranteed to be unique for nodes from different trees. - *tsnode:descendant_for_range()* -tsnode:descendant_for_range({start_row}, {start_col}, {end_row}, {end_col}) + *TSNode:descendant_for_range()* +TSNode:descendant_for_range({start_row}, {start_col}, {end_row}, {end_col}) Get the smallest node within this node that spans the given range of (row, column) positions - *tsnode:named_descendant_for_range()* -tsnode:named_descendant_for_range({start_row}, {start_col}, {end_row}, {end_col}) + *TSNode:named_descendant_for_range()* +TSNode:named_descendant_for_range({start_row}, {start_col}, {end_row}, {end_col}) Get the smallest named node within this node that spans the given range of (row, column) positions ============================================================================== TREESITTER QUERIES *treesitter-query* -Treesitter queries are a way to extract information about a parsed |tstree|, +Treesitter queries are a way to extract information about a parsed |TSTree|, e.g., for the purpose of highlighting. Briefly, a `query` consists of one or more patterns. A `pattern` is defined over node types in the syntax tree. A `match` corresponds to specific elements of the syntax tree which match a @@ -336,7 +336,7 @@ repeated, for example, the following two modeline blocks are both valid: > TREESITTER SYNTAX HIGHLIGHTING *treesitter-highlight* Syntax highlighting is specified through queries named `highlights.scm`, -which match a |tsnode| in the parsed |tstree| to a `capture` that can be +which match a |TSNode| in the parsed |TSTree| to a `capture` that can be assigned a highlight group. For example, the query > (parameters (identifier) @parameter) @@ -486,7 +486,7 @@ get_captures_at_cursor({winnr}) Returns a list of highlight capture names under the cursor Parameters: ~ - • {winnr} (number|nil) Window handle or 0 for current window (default) + • {winnr} (integer|nil) Window handle or 0 for current window (default) Return: ~ string[] List of capture names @@ -500,9 +500,9 @@ get_captures_at_pos({bufnr}, {row}, {col}) if none are defined). Parameters: ~ - • {bufnr} (number) Buffer number (0 for current buffer) - • {row} (number) Position row - • {col} (number) Position column + • {bufnr} (integer) Buffer number (0 for current buffer) + • {row} (integer) Position row + • {col} (integer) Position column Return: ~ table[] List of captures `{ capture = "capture name", metadata = { ... @@ -512,7 +512,7 @@ get_node_at_cursor({winnr}) *vim.treesitter.get_node_at_cursor()* Returns the smallest named node under the cursor Parameters: ~ - • {winnr} (number|nil) Window handle or 0 for current window (default) + • {winnr} (integer|nil) Window handle or 0 for current window (default) Return: ~ (string) Name of node under the cursor @@ -522,25 +522,28 @@ get_node_at_pos({bufnr}, {row}, {col}, {opts}) Returns the smallest named node at the given position Parameters: ~ - • {bufnr} (number) Buffer number (0 for current buffer) - • {row} (number) Position row - • {col} (number) Position column + • {bufnr} (integer) Buffer number (0 for current buffer) + • {row} (integer) Position row + • {col} (integer) Position column • {opts} (table) Optional keyword arguments: • lang string|nil Parser language • ignore_injections boolean Ignore injected languages (default true) Return: ~ - userdata|nil |tsnode| under the cursor + |TSNode||nil under the cursor get_node_range({node_or_range}) *vim.treesitter.get_node_range()* Returns the node's range or an unpacked range table Parameters: ~ - • {node_or_range} (userdata|table) |tsnode| or table of positions + • {node_or_range} (|TSNode||table) Node or table of positions Return: ~ - (table) `{ start_row, start_col, end_row, end_col }` + (integer) start_row + (integer) start_col + (integer) end_row + (integer) end_col get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()* Returns the parser for a specific buffer and filetype and attaches it to @@ -549,14 +552,14 @@ get_parser({bufnr}, {lang}, {opts}) *vim.treesitter.get_parser()* If needed, this will create the parser. Parameters: ~ - • {bufnr} (number|nil) Buffer the parser should be tied to (default: + • {bufnr} (integer|nil) Buffer the parser should be tied to (default: current buffer) • {lang} (string|nil) Filetype of this parser (default: buffer filetype) • {opts} (table|nil) Options to pass to the created language tree Return: ~ - LanguageTree |LanguageTree| object to use for parsing + |LanguageTree| object to use for parsing *vim.treesitter.get_string_parser()* get_string_parser({str}, {lang}, {opts}) @@ -568,14 +571,14 @@ get_string_parser({str}, {lang}, {opts}) • {opts} (table|nil) Options to pass to the created language tree Return: ~ - LanguageTree |LanguageTree| object to use for parsing + |LanguageTree| object to use for parsing is_ancestor({dest}, {source}) *vim.treesitter.is_ancestor()* Determines whether a node is the ancestor of another Parameters: ~ - • {dest} userdata Possible ancestor |tsnode| - • {source} userdata Possible descendant |tsnode| + • {dest} |TSNode| Possible ancestor + • {source} |TSNode| Possible descendant Return: ~ (boolean) True if {dest} is an ancestor of {source} @@ -585,9 +588,9 @@ is_in_node_range({node}, {line}, {col}) Determines whether (line, col) position is in node range Parameters: ~ - • {node} userdata |tsnode| defining the range - • {line} (number) Line (0-based) - • {col} (number) Column (0-based) + • {node} |TSNode| defining the range + • {line} (integer) Line (0-based) + • {col} (integer) Column (0-based) Return: ~ (boolean) True if the position is in node range @@ -596,7 +599,7 @@ node_contains({node}, {range}) *vim.treesitter.node_contains()* Determines if a node contains a range Parameters: ~ - • {node} userdata |tsnode| + • {node} |TSNode| • {range} (table) Return: ~ @@ -615,14 +618,14 @@ show_tree({opts}) *vim.treesitter.show_tree()* keys: • lang (string|nil): The language of the source buffer. If omitted, the filetype of the source buffer is used. - • bufnr (number|nil): Buffer to draw the tree into. If + • bufnr (integer|nil): Buffer to draw the tree into. If omitted, a new buffer is created. - • winid (number|nil): Window id to display the tree buffer in. - If omitted, a new window is created with {command}. + • winid (integer|nil): Window id to display the tree buffer + in. If omitted, a new window is created with {command}. • command (string|nil): Vimscript command to create the window. Default value is "topleft 60vnew". Only used when {winid} is nil. - • title (string|fun(bufnr:number):string|nil): Title of the + • title (string|fun(bufnr:integer):string|nil): Title of the window. If a function, it accepts the buffer number of the source buffer as its only argument and should return a string. @@ -647,7 +650,7 @@ start({bufnr}, {lang}) *vim.treesitter.start()* < Parameters: ~ - • {bufnr} (number|nil) Buffer to be highlighted (default: current + • {bufnr} (integer|nil) Buffer to be highlighted (default: current buffer) • {lang} (string|nil) Language of the parser (default: buffer filetype) @@ -656,7 +659,7 @@ stop({bufnr}) *vim.treesitter.stop()* Stops treesitter highlighting for a buffer Parameters: ~ - • {bufnr} (number|nil) Buffer to stop highlighting (default: current + • {bufnr} (integer|nil) Buffer to stop highlighting (default: current buffer) @@ -709,8 +712,8 @@ add_directive({name}, {handler}, {force}) Parameters: ~ • {name} (string) Name of the directive, without leading # - • {handler} function(match:table, pattern:string, bufnr:number, - predicate:string[], metadata:table) + • {handler} function(match:table, pattern:string, + bufnr:number, predicate:string[], metadata:table) • match: see |treesitter-query| • node-level data are accessible via `match[capture_id]` @@ -718,6 +721,7 @@ add_directive({name}, {handler}, {force}) • predicate: list of strings containing the full directive being called, e.g. `(node (#set! conceal "-"))` would get the predicate `{ "#set!", "conceal", "-" }` + • {force} (boolean) *vim.treesitter.query.add_predicate()* add_predicate({name}, {handler}, {force}) @@ -725,17 +729,18 @@ add_predicate({name}, {handler}, {force}) Parameters: ~ • {name} (string) Name of the predicate, without leading # - • {handler} function(match:table, pattern:string, bufnr:number, - predicate:string[]) + • {handler} function(match:table, pattern:string, + bufnr:number, predicate:string[]) • see |vim.treesitter.query.add_directive()| for argument meanings + • {force} (boolean) *vim.treesitter.query.get_node_text()* get_node_text({node}, {source}, {opts}) Gets the text corresponding to a given node Parameters: ~ - • {node} userdata |tsnode| + • {node} |TSNode| • {source} (number|string) Buffer or string from which the {node} is extracted • {opts} (table|nil) Optional parameters. @@ -743,7 +748,7 @@ get_node_text({node}, {source}, {opts}) true) Return: ~ - (string[]|string) + (string[]|string|nil) get_query({lang}, {query_name}) *vim.treesitter.query.get_query()* Returns the runtime query {query_name} for {lang}. @@ -753,7 +758,7 @@ get_query({lang}, {query_name}) *vim.treesitter.query.get_query()* • {query_name} (string) Name of the query (e.g. "highlights") Return: ~ - Query Parsed query + Query|nil Parsed query *vim.treesitter.query.get_query_files()* get_query_files({lang}, {query_name}, {is_included}) @@ -826,16 +831,15 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop}) < Parameters: ~ - • {node} userdata |tsnode| under which the search will occur - • {source} (number|string) Source buffer or string to extract text from + • {node} |TSNode| under which the search will occur + • {source} (integer|string) Source buffer or string to extract text + from • {start} (number) Starting line for the search • {stop} (number) Stopping line for the search (end-exclusive) • {self} Return: ~ - (number) capture Matching capture id - (table) capture_node Capture for {node} - (table) metadata for the {capture} + (fun(): integer, TSNode, TSMetadata ): capture id, capture node, metadata *Query:iter_matches()* Query:iter_matches({self}, {node}, {source}, {start}, {stop}) @@ -861,16 +865,15 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop}) < Parameters: ~ - • {node} userdata |tsnode| under which the search will occur - • {source} (number|string) Source buffer or string to search - • {start} (number) Starting line for the search - • {stop} (number) Stopping line for the search (end-exclusive) + • {node} |TSNode| under which the search will occur + • {source} (integer|string) Source buffer or string to search + • {start} (integer) Starting line for the search + • {stop} (integer) Stopping line for the search (end-exclusive) • {self} Return: ~ - (number) pattern id - (table) match - (table) metadata + (fun(): integer, table, table): pattern id, match, + metadata *vim.treesitter.query.set_query()* set_query({lang}, {query_name}, {text}) @@ -892,7 +895,7 @@ new({tree}, {opts}) *vim.treesitter.highlighter.new()* Creates a new highlighter using Parameters: ~ - • {tree} LanguageTree |LanguageTree| parser object to use for highlighting + • {tree} |LanguageTree| parser object to use for highlighting • {opts} (table|nil) Configuration of the highlighter: • queries table overwrite queries used by the highlighter @@ -940,9 +943,9 @@ LanguageTree:for_each_child({self}, {fn}, {include_self}) Invokes the callback for each |LanguageTree| and its children recursively Parameters: ~ - • {fn} function(tree: LanguageTree, lang: string) - • {include_self} (boolean) Whether to include the invoking tree in the - results + • {fn} fun(tree: LanguageTree, lang: string) + • {include_self} (boolean|nil) Whether to include the invoking tree in + the results • {self} LanguageTree:for_each_tree({self}, {fn}) *LanguageTree:for_each_tree()* @@ -951,7 +954,7 @@ LanguageTree:for_each_tree({self}, {fn}) *LanguageTree:for_each_tree()* Note: This includes the invoking tree's child trees as well. Parameters: ~ - • {fn} function(tree: TSTree, languageTree: LanguageTree) + • {fn} fun(tree: TSTree, ltree: LanguageTree) • {self} LanguageTree:included_regions({self}) *LanguageTree:included_regions()* @@ -964,6 +967,7 @@ LanguageTree:invalidate({self}, {reload}) *LanguageTree:invalidate()* Invalidates this parser and all its children Parameters: ~ + • {reload} (boolean|nil) • {self} LanguageTree:is_valid({self}) *LanguageTree:is_valid()* @@ -987,7 +991,7 @@ LanguageTree:language_for_range({self}, {range}) • {self} Return: ~ - LanguageTree Managing {range} + |LanguageTree| Managing {range} *LanguageTree:named_node_for_range()* LanguageTree:named_node_for_range({self}, {range}, {opts}) @@ -1001,7 +1005,7 @@ LanguageTree:named_node_for_range({self}, {range}, {opts}) • {self} Return: ~ - userdata|nil Found |tsnode| + |TSNode||nil Found node LanguageTree:parse({self}) *LanguageTree:parse()* Parses all defined regions using a treesitter parser for the language this @@ -1012,8 +1016,8 @@ LanguageTree:parse({self}) *LanguageTree:parse()* • {self} Return: ~ - userdata[] Table of parsed |tstree| - (table) Change list + TSTree[] + (table|nil) Change list LanguageTree:register_cbs({self}, {cbs}) *LanguageTree:register_cbs()* Registers callbacks for the |LanguageTree|. @@ -1050,7 +1054,7 @@ LanguageTree:tree_for_range({self}, {range}, {opts}) • {self} Return: ~ - userdata|nil Contained |tstree| + TSTree|nil LanguageTree:trees({self}) *LanguageTree:trees()* Returns all trees this language tree contains. Does not include child @@ -1065,7 +1069,7 @@ new({source}, {lang}, {opts}) *vim.treesitter.languagetree.new()* may contain child languages themselves, hence the name). Parameters: ~ - • {source} (number|string) Buffer or a string of text to parse + • {source} (integer|string) Buffer or a string of text to parse • {lang} (string) Root language this tree represents • {opts} (table|nil) Optional keyword arguments: • injections table Mapping language to injection query @@ -1074,6 +1078,6 @@ new({source}, {lang}, {opts}) *vim.treesitter.languagetree.new()* per language. Return: ~ - LanguageTree |LanguageTree| parser object + |LanguageTree| parser object vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: -- cgit From bb8845340b1b9c2180fb19f049ff9deff5857d99 Mon Sep 17 00:00:00 2001 From: figsoda Date: Thu, 21 Jul 2022 12:08:37 +0100 Subject: feat(treesitter): allow capture text to be transformed Co-authored-by: Lewis Russell --- runtime/doc/news.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 5c234677ef..7c3f295560 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -151,6 +151,9 @@ The following new APIs or features were added. • |:highlight| now supports an additional attribute "altfont". +• Treesitter captures can now be transformed by directives. This will allow + more complicated dynamic language injections. + ============================================================================== CHANGED FEATURES *news-changes* -- cgit From e1d5ad1cb87d43c3d75619e239312d4ab2029b45 Mon Sep 17 00:00:00 2001 From: figsoda Date: Mon, 26 Dec 2022 16:10:59 -0500 Subject: feat(treesitter): add metadata option for get_node_text --- runtime/doc/news.txt | 3 +++ runtime/doc/treesitter.txt | 3 +++ 2 files changed, 6 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 7c3f295560..b438595b5f 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -154,6 +154,9 @@ The following new APIs or features were added. • Treesitter captures can now be transformed by directives. This will allow more complicated dynamic language injections. +• |vim.treesitter.query.get_node_text()| now accepts a `metadata` option for + writing custom directives using |vim.treesitter.query.add_directive()|. + ============================================================================== CHANGED FEATURES *news-changes* diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 7bc9f3f9a7..693804497d 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -746,6 +746,9 @@ get_node_text({node}, {source}, {opts}) • {opts} (table|nil) Optional parameters. • concat: (boolean) Concatenate result in a string (default true) + • metadata (table) Metadata of a specific capture. This + would be set to `metadata[capture_id]` when using + |vim.treesitter.query.add_directive()|. Return: ~ (string[]|string|nil) -- cgit From e1f03c481a1cf87cead2c5af66b36dbdfbb9a983 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Mon, 6 Feb 2023 10:01:38 +0100 Subject: feat(spell): also source `spell/LANG.lua` when setting `spelllang` (#22111) Problem: only Vimscript files are sourced when setting spelling language Solution: also source Lua files after sourcing Vimscript files Closes #22110 --- runtime/doc/spell.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/spell.txt b/runtime/doc/spell.txt index 98a6af1b8b..c6c4da2dea 100644 --- a/runtime/doc/spell.txt +++ b/runtime/doc/spell.txt @@ -440,9 +440,9 @@ find these functions useful: SETTING 'spellcapcheck' AUTOMATICALLY *set-spc-auto* After the 'spelllang' option has been set successfully, Vim will source the -files "spell/LANG.vim" in 'runtimepath'. "LANG" is the value of 'spelllang' -up to the first comma, dot or underscore. This can be used to set options -specifically for the language, especially 'spellcapcheck'. +files "spell/LANG.vim" and "spell/LANG.lua" in 'runtimepath'. "LANG" is the +value of 'spelllang' up to the first comma, dot or underscore. This can be +used to set options specifically for the language, especially 'spellcapcheck'. The distribution includes a few of these files. Use this command to see what they do: > -- cgit From d0008bd626bb4fc28fedbba77c2c2ecaaac26683 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Wed, 8 Feb 2023 11:28:32 +0100 Subject: docs(luvref): update to version bump --- runtime/doc/luvref.txt | 110 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 99 insertions(+), 11 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt index 859e75e4af..b7ce273f5f 100644 --- a/runtime/doc/luvref.txt +++ b/runtime/doc/luvref.txt @@ -24,7 +24,7 @@ be used in other Lua environments. More information about the core libuv library can be found at the original libuv documentation page (https://docs.libuv.org/). -TCP Echo Server Example~ +TCP Echo Server Example ~ Here is a small example showing a TCP echo server: @@ -51,15 +51,15 @@ Here is a small example showing a TCP echo server: uv.run() -- an explicit run call is necessary outside of luvit < -Module Layout~ +Module Layout ~ The luv library contains a single Lua module referred to hereafter as `uv` for simplicity. This module consists mostly of functions with names corresponding to their original libuv versions. For example, the libuv function -`uv_tcp_bind` has a luv version at |uv.tcp_bind()|. Currently, only one -non-function field exists: `uv.constants`, which is a table. +`uv_tcp_bind` has a luv version at |uv.tcp_bind()|. Currently, only two +non-function fields exists: `uv.constants` and `uv.errno`, which are tables. -Functions vs Methods~ +Functions vs Methods ~ In addition to having simple functions, luv provides an optional method-style API. For example, `uv.tcp_bind(server, host, port)` can alternatively be @@ -67,7 +67,7 @@ called as `server:bind(host, port)` . Note that the first argument `server` becomes the object and `tcp_` is removed from the function name. Method forms are documented below where they exist. -Synchronous vs Asynchronous Functions~ +Synchronous vs Asynchronous Functions ~ Functions that accept a callback are asynchronous. These functions may immediately return results to the caller to indicate their initial status, but @@ -82,7 +82,7 @@ Some (generally FS and DNS) functions can behave either synchronously or asynchronously. If a callback is provided to these functions, they behave asynchronously; if no callback is provided, they behave synchronously. -Pseudo-Types~ +Pseudo-Types ~ Some unique types are defined. These are not actual types in Lua, but they are used here to facilitate documenting consistent behavior: @@ -133,10 +133,10 @@ module. ============================================================================== ERROR HANDLING *luv-error-handling* -In libuv, errors are negative numbered constants; however, these errors and -the functions used to handle them are not exposed to luv users. Instead, if an -internal error is encountered, the luv function will return to the caller an -assertable `nil, err, name` tuple. +In libuv, errors are negative numbered constants; however, while those errors +are exposed through `uv.errno`, the functions used to handle them are not +exposed to luv users. Instead, if an internal error is encountered, the luv +function will return to the caller an assertable `nil, err, name` tuple. - `nil` idiomatically indicates failure - `err` is a string with the format `{name}: {message}` @@ -151,6 +151,94 @@ When a function is called successfully, it will return either a value that is relevant to the operation of the function, or the integer `0` to indicate success, or sometimes nothing at all. These cases are documented below. +`uv.errno` *uv.errno* + +A table value which exposes error constants as a map, where the key is the +error name (without the `UV_` prefix) and its value is a negative number. +See Libuv's "Error constants" page for further details. +(https://docs.libuv.org/en/v1.x/errors.html#error-constants) + +- `E2BIG`: argument list too long. +- `EACCES`: permission denied. +- `EADDRINUSE`: address already in use. +- `EADDRNOTAVAIL`: address not available. +- `EAFNOSUPPORT`: address family not supported. +- `EAGAIN`: resource temporarily unavailable. +- `EAI_ADDRFAMILY`: address family not supported. +- `EAI_AGAIN`: temporary failure. +- `EAI_BADFLAGS`: bad ai_flags value. +- `EAI_BADHINTS`: invalid value for hints. +- `EAI_CANCELED`: request canceled. +- `EAI_FAIL`: permanent failure. +- `EAI_FAMILY`: ai_family not supported. +- `EAI_MEMORY`: out of memory. +- `EAI_NODATA`: no address. +- `EAI_NONAME`: unknown node or service. +- `EAI_OVERFLOW`: argument buffer overflow. +- `EAI_PROTOCOL`: resolved protocol is unknown. +- `EAI_SERVICE`: service not available for socket type. +- `EAI_SOCKTYPE`: socket type not supported. +- `EALREADY`: connection already in progress. +- `EBADF`: bad file descriptor. +- `EBUSY`: resource busy or locked. +- `ECANCELED`: operation canceled. +- `ECHARSET`: invalid Unicode character. +- `ECONNABORTED`: software caused connection abort. +- `ECONNREFUSED`: connection refused. +- `ECONNRESET`: connection reset by peer. +- `EDESTADDRREQ`: destination address required. +- `EEXIST`: file already exists. +- `EFAULT`: bad address in system call argument. +- `EFBIG`: file too large. +- `EHOSTUNREACH`: host is unreachable. +- `EINTR`: interrupted system call. +- `EINVAL`: invalid argument. +- `EIO`: i/o error. +- `EISCONN`: socket is already connected. +- `EISDIR`: illegal operation on a directory. +- `ELOOP`: too many symbolic links encountered. +- `EMFILE`: too many open files. +- `EMSGSIZE`: message too long. +- `ENAMETOOLONG`: name too long. +- `ENETDOWN`: network is down. +- `ENETUNREACH`: network is unreachable. +- `ENFILE`: file table overflow. +- `ENOBUFS`: no buffer space available. +- `ENODEV`: no such device. +- `ENOENT`: no such file or directory. +- `ENOMEM`: not enough memory. +- `ENONET`: machine is not on the network. +- `ENOPROTOOPT`: protocol not available. +- `ENOSPC`: no space left on device. +- `ENOSYS`: function not implemented. +- `ENOTCONN`: socket is not connected. +- `ENOTDIR`: not a directory. +- `ENOTEMPTY`: directory not empty. +- `ENOTSOCK`: socket operation on non-socket. +- `ENOTSUP`: operation not supported on socket. +- `EOVERFLOW`: value too large for defined data type. +- `EPERM`: operation not permitted. +- `EPIPE`: broken pipe. +- `EPROTO`: protocol error. +- `EPROTONOSUPPORT`: protocol not supported. +- `EPROTOTYPE`: protocol wrong type for socket. +- `ERANGE`: result too large. +- `EROFS`: read-only file system. +- `ESHUTDOWN`: cannot send after transport endpoint shutdown. +- `ESPIPE`: invalid seek. +- `ESRCH`: no such process. +- `ETIMEDOUT`: connection timed out. +- `ETXTBSY`: text file is busy. +- `EXDEV`: cross-device link not permitted. +- `UNKNOWN`: unknown error. +- `EOF`: end of file. +- `ENXIO`: no such device or address. +- `EMLINK`: too many links. +- `ENOTTY`: inappropriate ioctl for device. +- `EFTYPE`: inappropriate file type or format. +- `EILSEQ`: illegal byte sequence. +- `ESOCKTNOSUPPORT`: socket type not supported. + ============================================================================== VERSION CHECKING *luv-version-checking* -- cgit From 625e990976540a0e2d2bccb98deb57d0919d1e89 Mon Sep 17 00:00:00 2001 From: bfredl Date: Wed, 8 Feb 2023 16:16:16 +0100 Subject: refactor(ui): cleanup 'redrawdebug', introduce "flush" mode --- runtime/doc/options.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 1f91b89322..17f1c822ff 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4765,7 +4765,7 @@ A jump table for the options with a short description can be found at |Q_op|. Flags to change the way redrawing works, for debugging purposes. Most useful with 'writedelay' set to some reasonable value. Supports the following flags: - compositor Indicate what redraws come from the compositor + compositor Indicate each redraw event handled by the compositor by briefly flashing the redrawn regions in colors indicating the redraw type. These are the highlight groups used (and their default colors): @@ -4777,6 +4777,11 @@ A jump table for the options with a short description can be found at |Q_op|. RedrawDebugRecompose guibg=Red redraw generated by the compositor itself, due to a grid being moved or deleted. + line introduce a delay after each line drawn on the screen. + When using the TUI or another single-grid UI, "compositor" + gives more information and should be preferred (every + line is processed as a separate event by the compositor) + flush introduce a delay after each "flush" event. nothrottle Turn off throttling of the message grid. This is an optimization that joins many small scrolls to one larger scroll when drawing the message area (with @@ -4786,7 +4791,7 @@ A jump table for the options with a short description can be found at |Q_op|. useful when running nvim inside a debugger (and the test suite). nodelta Send all internally redrawn cells to the UI, even if - they are unchanged from the already displayed state. + they are unchanged from the already displayed state. *'redrawtime'* *'rdt'* 'redrawtime' 'rdt' number (default 2000) @@ -7372,8 +7377,7 @@ A jump table for the options with a short description can be found at |Q_op|. *'writedelay'* *'wd'* 'writedelay' 'wd' number (default 0) global - The number of milliseconds to wait for each character sent to the - screen. When positive, characters are sent to the UI one by one. - See 'redrawdebug' for more options. For debugging purposes. + Only takes effect toghether with 'redrawdebug'. + The number of milliseconds to wait after each line or each flush vim:tw=78:ts=8:noet:ft=help:norl: -- cgit From 1aa128b0ea8764b01a433b91ba62faa77cce84f8 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 9 Feb 2023 11:54:37 +0100 Subject: docs(luvref): update version info --- runtime/doc/luvref.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt index 859e75e4af..86f4163f4d 100644 --- a/runtime/doc/luvref.txt +++ b/runtime/doc/luvref.txt @@ -3888,11 +3888,11 @@ uv.metrics_idle_time() *uv.metrics_idle_time()* ============================================================================== CREDITS *luv-credits* -This document is a reformatted version of the LUV documentation, based on -commit c51e705 (5 May 2022) of the luv repository -https://github.com/luvit/luv/commit/c51e7052ec4f0a25058f70c1b4ee99dd36180e59. +This document is a reformatted version of the LUV documentation, up-to-date +with commit e8e7b7e (3 Feb 2023) of the luv repository +https://github.com/luvit/luv/commit/e8e7b7e13225348a8806118a3ea9e021383a9536. -Included from https://github.com/nanotee/luv-vimdocs with kind permission. +Based on https://github.com/nanotee/luv-vimdocs with kind permission. vim:tw=78:ts=8:ft=help:norl: -- cgit From 165b07b2692ef131affecbbed432f27f16512124 Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Sat, 11 Feb 2023 17:34:20 +0800 Subject: docs: reword news.txt to ensure a consistent style (#22215) --- runtime/doc/news.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index b438595b5f..c8d40094f3 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -63,7 +63,7 @@ The following new APIs or features were added. < (or the Vimscript equivalent) to their |config| file. -• Run Lua scripts from your shell using |-l|. > +• Added support for running Lua scripts from shell using |-l|. > nvim -l foo.lua --arg1 --arg2 < Also works with stdin: > echo "print(42)" | nvim -l - -- cgit From 7d58de11f49c574a8a305e28e96b9ff810493012 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 11 Feb 2023 18:25:01 +0800 Subject: fix(rpc)!: preseve files when stdio channel is closed (#22137) BREAKING CHANGE: Unsaved changes are now preserved rather than discarded when stdio channel is closed. --- runtime/doc/news.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index c8d40094f3..2afb22bb43 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -47,6 +47,9 @@ The following changes may require adaptations in user config or plugins. • libiconv is now a required build dependency. +• Unsaved changes are now preserved rather than discarded when |channel-stdio| + is closed. + ============================================================================== NEW FEATURES *news-features* -- cgit From 374955bcc571dff05f068ec18d0f578d1f334c5f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 11 Feb 2023 20:00:31 +0800 Subject: vim-patch:9.0.1300: 'statusline' only supports one "%=" item (#22218) Problem: 'statusline' only supports one "%=" item. Solution: Add support for multiple "%=" items. (TJ DeVries, Yegappan Lakshmanan, closes vim/vim#11970, closes vim/vim#11965) https://github.com/vim/vim/commit/3ec78f973fdaec2cea8e036ed38037b2fe40670b Co-authored-by: Yegappan Lakshmanan --- runtime/doc/options.txt | 6 ++++-- runtime/doc/vim_diff.txt | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 17f1c822ff..e4106358f1 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -6201,8 +6201,10 @@ A jump table for the options with a short description can be found at |Q_op|. this label. < - Where to truncate line if too long. Default is at the start. No width fields allowed. - = - Separation point between alignment sections. Each section will - be separated by an equal number of spaces. + = - Separation point between alignment sections. Each section will + be separated by an equal number of spaces. With one %= what + comes after it will be right-aligned. With two %= there is a + middle part, with white space left and right of it. No width fields allowed. # - Set highlight group. The name must follow and then a # again. Thus use %#HLname# for highlight group HLname. The same diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index bb3b670b24..97fc211c36 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -267,7 +267,6 @@ Options: 'pumblend' pseudo-transparent popupmenu 'scrollback' 'signcolumn' supports up to 9 dynamic/fixed columns - 'statusline' supports unlimited alignment sections 'tabline' %@Func@foo%X can call any function on mouse-click 'winblend' pseudo-transparency in floating windows |api-floatwin| 'winhighlight' window-local highlights @@ -292,6 +291,7 @@ These Nvim features were later integrated into Vim. - |WinScrolled| - |:sign-define| "numhl" argument - |:source| works with anonymous (no file) scripts +- 'statusline' supports unlimited alignment sections ============================================================================== 5. Changed features *nvim-features-changed* -- cgit From a289e82142fdc5ff657dd30198546eeb1e115fe9 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 15 Feb 2023 12:26:07 +0000 Subject: fix(treesitter): make params optional --- runtime/doc/treesitter.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 693804497d..d4799053f7 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -721,7 +721,7 @@ add_directive({name}, {handler}, {force}) • predicate: list of strings containing the full directive being called, e.g. `(node (#set! conceal "-"))` would get the predicate `{ "#set!", "conceal", "-" }` - • {force} (boolean) + • {force} (boolean|nil) *vim.treesitter.query.add_predicate()* add_predicate({name}, {handler}, {force}) @@ -733,7 +733,7 @@ add_predicate({name}, {handler}, {force}) bufnr:number, predicate:string[]) • see |vim.treesitter.query.add_directive()| for argument meanings - • {force} (boolean) + • {force} (boolean|nil) *vim.treesitter.query.get_node_text()* get_node_text({node}, {source}, {opts}) -- cgit From d34c64e342dfba9248d1055e702d02620a1b31a8 Mon Sep 17 00:00:00 2001 From: Ghjuvan Lacambre Date: Thu, 16 Feb 2023 13:15:02 +0100 Subject: feat: $NVIM_APPNAME #22128 This commit implements the ability to control all of the XDG paths Neovim should use. This is done by setting an environment variable named NVIM_APPNAME. For example, setting $NVIM_APPNAME makes Neovim look for its configuration directory in $XDG_CONFIG_HOME/$NVIM_APPNAME instead of $XDG_CONFIG_HOME/nvim. If NVIM_APPNAME is not set or is an empty string, "nvim" will be used as default. The usecase for this feature is to enable an easy way to switch from configuration to configuration. One might argue that the various $XDG environment variables can already be used for this usecase. However, setting $XDG environment variables also affects tools spawned by Neovim. For example, while setting $XDG_CONFIG_HOME will enable Neovim to use a different configuration directory, it will also prevent Git from finding its "default" configuration. Closes https://github.com/neovim/neovim/issues/21691 --- runtime/doc/news.txt | 4 ++++ runtime/doc/starting.txt | 12 ++++++++++++ 2 files changed, 16 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 2afb22bb43..ae21bc47ca 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -55,6 +55,10 @@ NEW FEATURES *news-features* The following new APIs or features were added. +• A new environment variable named NVIM_APPNAME enables configuring the + directories where Neovim should find its configuration and state files. See + `:help $NVIM_APPNAME` . + • |nvim_open_win()| now accepts a relative `mouse` option to open a floating win relative to the mouse. Note that the mouse doesn't update frequently without setting `vim.o.mousemoveevent = true` diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 5e0718c3bb..67a88913fb 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -1385,6 +1385,18 @@ STATE DIRECTORY (DEFAULT) ~ Note: Throughout the user manual these defaults are used as placeholders, e.g. "~/.config" is understood to mean "$XDG_CONFIG_HOME or ~/.config". +NVIM_APPNAME *$NVIM_APPNAME* +The XDG directories used by Nvim can be further configured by setting the +`$NVIM_APPNAME` environment variable. This variable controls the directory +Neovim will look for (and auto-create) in the various XDG parent directories. +For example, setting `$NVIM_APPNAME` to "neovim" before running Neovim will +result in Neovim looking for configuration files in `$XDG_CONFIG_HOME/neovim` +instead of `$XDG_CONFIG_HOME/nvim`. + +Note: Similarly to the $XDG environment variables, when +`$XDG_CONFIG_HOME/nvim` is mentionned, it should be understood as +`$XDG_CONFIG_HOME/$NVIM_APPNAME`. + LOG FILE *$NVIM_LOG_FILE* *E5430* Besides 'debug' and 'verbose', Nvim keeps a general log file for internal debugging, plugins and RPC clients. > -- cgit From bcae4af3743dbc8fc51027bbe323ddc9211cd8ca Mon Sep 17 00:00:00 2001 From: Jonas Strittmatter <40792180+smjonas@users.noreply.github.com> Date: Thu, 16 Feb 2023 15:54:25 +0100 Subject: docs: remove mentions of 'balloonexpr' #22049 'balloonexpr' option was removed in Nvim. --- runtime/doc/cmdline.txt | 2 +- runtime/doc/eval.txt | 36 ++---------------------------------- 2 files changed, 3 insertions(+), 35 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index b4923b0d70..e0c4e14b01 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -891,7 +891,7 @@ Note: these are typed literally, they are not special keys! to form a C expression. E.g., when the cursor is on "arg" of "ptr->arg" then the result is "ptr->arg"; when the cursor is on "]" of "list[idx]" then the result is - "list[idx]". This is used for |v:beval_text|. + "list[idx]". *:* ** is replaced with the path name under the cursor (like what |gf| uses) diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 58759a6053..0e77fb182e 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1670,38 +1670,6 @@ v:argv The command line arguments Vim was invoked with. This is a list of strings. The first item is the Vim command. See |v:progpath| for the command with full path. - *v:beval_col* *beval_col-variable* -v:beval_col The number of the column, over which the mouse pointer is. - This is the byte index in the |v:beval_lnum| line. - Only valid while evaluating the 'balloonexpr' option. - - *v:beval_bufnr* *beval_bufnr-variable* -v:beval_bufnr The number of the buffer, over which the mouse pointer is. Only - valid while evaluating the 'balloonexpr' option. - - *v:beval_lnum* *beval_lnum-variable* -v:beval_lnum The number of the line, over which the mouse pointer is. Only - valid while evaluating the 'balloonexpr' option. - - *v:beval_text* *beval_text-variable* -v:beval_text The text under or after the mouse pointer. Usually a word as - it is useful for debugging a C program. 'iskeyword' applies, - but a dot and "->" before the position is included. When on a - ']' the text before it is used, including the matching '[' and - word before it. When on a Visual area within one line the - highlighted text is used. Also see ||. - Only valid while evaluating the 'balloonexpr' option. - - *v:beval_winnr* *beval_winnr-variable* -v:beval_winnr The number of the window, over which the mouse pointer is. Only - valid while evaluating the 'balloonexpr' option. The first - window has number zero (unlike most other places where a - window gets a number). - - *v:beval_winid* *beval_winid-variable* -v:beval_winid The |window-ID| of the window, over which the mouse pointer - is. Otherwise like v:beval_winnr. - *v:char* *char-variable* v:char Argument for evaluating 'formatexpr' and used for the typed character when using in an abbreviation |:map-|. @@ -4244,8 +4212,8 @@ Textlock *textlock* In a few situations it is not allowed to change the text in the buffer, jump to another window and some other things that might confuse or break what Vim is currently doing. This mostly applies to things that happen when Vim is -actually doing something else. For example, evaluating the 'balloonexpr' may -happen any moment the mouse cursor is resting at some position. +actually doing something else. For example, a TextYankPost autocommand cannot +edit the text it is yanking. This is not allowed when the textlock is active: - changing the buffer text -- cgit From b62c0c8d9c22ae7fc9ee200733f8312efa6dbced Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Mon, 20 Feb 2023 08:12:59 +0100 Subject: docs: fix typos (#21961) Co-authored-by: Ben Morgan --- runtime/doc/eval.txt | 4 ++-- runtime/doc/intro.txt | 2 +- runtime/doc/tagsrch.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 0e77fb182e..3889b8e9a5 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1827,8 +1827,8 @@ v:event Dictionary of event data for the current |autocommand|. Valid |CompleteChanged|. scrollbar Is |v:true| if popup menu have scrollbar, or |v:false| if not. - changed_window Is |v:true| if the the event fired - while changing window (or tab) on |DirChanged|. + changed_window Is |v:true| if the event fired while + changing window (or tab) on |DirChanged|. status Job status or exit code, -1 means "unknown". |TermClose| *v:exception* *exception-variable* diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 6bf6850ccf..11ba1b408c 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -382,7 +382,7 @@ Note: - If numlock is on the |TUI| receives plain ASCII values, so mapping , , ..., and will not work. - Nvim supports mapping multibyte chars with modifiers such as ``. Which - combinations actually work depends on the the UI or host terminal. + combinations actually work depends on the UI or host terminal. - When a key is pressed using a meta or alt modifier and no mapping exists for that keypress, Nvim may behave as though was pressed before the key. - It is possible to notate combined modifiers (e.g. for CTRL-ALT-T), diff --git a/runtime/doc/tagsrch.txt b/runtime/doc/tagsrch.txt index 0f785dd1eb..49e51d6736 100644 --- a/runtime/doc/tagsrch.txt +++ b/runtime/doc/tagsrch.txt @@ -92,7 +92,7 @@ The ignore-case matches are found when: - when 'tagcase' is "followscs" and 'ignorecase' is on or the 'smartcase' option is on and the pattern does not contain an upper case character - when 'tagcase' is "ignore" -- when 'tagcase' is "smart" and the patter does not contain an upper case +- when 'tagcase' is "smart" and the pattern does not contain an upper case character Note that using ignore-case tag searching disables binary searching in the -- cgit From f1816f9ee2a8b811fd6ce4e60a843087f855f97d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 20 Feb 2023 15:13:55 +0800 Subject: refactor(main.c): remove unreachable use_builtin_ui conditions (#22338) When use_builtin_ui is true, Nvim will exit before line 385 is reached. --- runtime/doc/eval.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 3889b8e9a5..49d4546f95 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1794,7 +1794,7 @@ v:event Dictionary of event data for the current |autocommand|. Valid abort Whether the event triggered during an aborting condition (e.g. |c_Esc| or |c_CTRL-C| for |CmdlineLeave|). - chan |channel-id| or 0 for "internal". + chan |channel-id| cmdlevel Level of cmdline. cmdtype Type of cmdline, |cmdline-char|. cwd Current working directory. -- cgit From ee26b227e15abc263195d4c746d5dba9f0e6dec4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 21 Feb 2023 23:50:29 +0800 Subject: vim-patch:partial:938ae280c79b (#22356) Update runtime files. https://github.com/vim/vim/commit/938ae280c79b8cdb0fca60336ec4c090ecd8bb5a Partially skip autocmd.txt: needs patch 8.2.5011. Partially skip builtin.txt: needs patch 9.0.0411. Partially skip eval.txt: needs patch 8.2.3783. Cherry-pick :map-meta-keys from patch 9.0.1276. Co-authored-by: Bram Moolenaar --- runtime/doc/autocmd.txt | 1 + runtime/doc/builtin.txt | 17 ++++++++++------- runtime/doc/cmdline.txt | 1 + runtime/doc/eval.txt | 2 +- runtime/doc/filetype.txt | 5 ++++- runtime/doc/if_pyth.txt | 2 +- runtime/doc/index.txt | 4 ++-- runtime/doc/insert.txt | 6 +++--- runtime/doc/map.txt | 27 +++++++++++++++++++++++---- runtime/doc/options.txt | 16 ++++++++-------- runtime/doc/pattern.txt | 16 +++++++++------- runtime/doc/pi_netrw.txt | 38 +++++++++++++++++++------------------- runtime/doc/remote.txt | 2 +- runtime/doc/repeat.txt | 20 ++++++++++---------- runtime/doc/sign.txt | 2 +- runtime/doc/syntax.txt | 28 +++++++++++++++++++++------- runtime/doc/uganda.txt | 2 +- runtime/doc/userfunc.txt | 7 ++++--- runtime/doc/usr_02.txt | 2 +- runtime/doc/usr_05.txt | 2 +- runtime/doc/usr_22.txt | 40 ++++++++++++++++++++-------------------- 21 files changed, 142 insertions(+), 98 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 8cc4754880..89252145f2 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -380,6 +380,7 @@ CmdlineChanged After a change was made to the text inside CmdlineEnter After entering the command-line (including non-interactive use of ":" in a mapping: use || instead to avoid this). + The pattern is matched against |cmdline-char|. expands to the |cmdline-char|. Sets these |v:event| keys: cmdlevel diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 2fc7dce7fc..60a1035da3 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -225,7 +225,7 @@ gettabwinvar({tabnr}, {winnr}, {name} [, {def}]) gettagstack([{nr}]) Dict get the tag stack of window {nr} gettext({text}) String lookup translation of {text} getwininfo([{winid}]) List list of info about each window -getwinpos([{timeout}]) List X and Y coord in pixels of the Vim window +getwinpos([{timeout}]) List X and Y coord in pixels of Vim window getwinposx() Number X coord in pixels of Vim window getwinposy() Number Y coord in pixels of Vim window getwinvar({nr}, {varname} [, {def}]) @@ -326,7 +326,7 @@ max({expr}) Number maximum value of items in {expr} menu_get({path} [, {modes}]) List description of |menus| matched by {path} menu_info({name} [, {mode}]) Dict get menu item information min({expr}) Number minimum value of items in {expr} -mkdir({name} [, {path} [, {prot}]]) +mkdir({name} [, {flags} [, {prot}]]) Number create directory {name} mode([expr]) String current editing mode msgpackdump({list} [, {type}]) List/Blob dump objects to msgpack @@ -5432,11 +5432,14 @@ min({expr}) Return the minimum value of all items in {expr}. Example: > mylist->min() < *mkdir()* *E739* -mkdir({name} [, {path} [, {prot}]]) +mkdir({name} [, {flags} [, {prot}]]) Create directory {name}. - If {path} is "p" then intermediate directories are created as - necessary. Otherwise it must be "". + When {flags} is present it must be a string. An empty string + has no effect. + + If {flags} is "p" then intermediate directories are created as + necessary. If {prot} is given it is used to set the protection bits of the new directory. The default is 0o755 (rwxr-xr-x: r/w for @@ -5449,7 +5452,7 @@ mkdir({name} [, {path} [, {prot}]]) < This function is not available in the |sandbox|. - If you try to create an existing directory with {path} set to + If you try to create an existing directory with {flags} set to "p" mkdir() will silently exit. The function result is a Number, which is TRUE if the call was @@ -6957,7 +6960,7 @@ setcellwidths({list}) *setcellwidths()* {width} must be either 1 or 2, indicating the character width in screen cells. *E1112* An error is given if the argument is invalid, also when a - range overlaps with another. *E1113* + range overlaps with another. *E1113* If the new value causes 'fillchars' or 'listchars' to become invalid it is rejected and an error is given. diff --git a/runtime/doc/cmdline.txt b/runtime/doc/cmdline.txt index e0c4e14b01..844aab6fa3 100644 --- a/runtime/doc/cmdline.txt +++ b/runtime/doc/cmdline.txt @@ -584,6 +584,7 @@ followed by another Vim command: :registers :read ! :sign + :tabdo :terminal :vglobal :windo diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 49d4546f95..af67e2b67d 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1445,7 +1445,7 @@ See below |functions|. ------------------------------------------------------------------------------ lambda expression *expr-lambda* *lambda* -{args -> expr1} lambda expression +{args -> expr1} lambda expression *E451* A lambda expression creates a new unnamed function which returns the result of evaluating |expr1|. Lambda expressions differ from |user-function|s in diff --git a/runtime/doc/filetype.txt b/runtime/doc/filetype.txt index a53c287d48..f69ffeabfe 100644 --- a/runtime/doc/filetype.txt +++ b/runtime/doc/filetype.txt @@ -634,7 +634,10 @@ MARKDOWN *ft-markdown-plugin* To enable folding use this: > let g:markdown_folding = 1 -< + +'expandtab' will be set by default. If you do not want that use this: > + let g:markdown_recommended_style = 0 + PDF *ft-pdf-plugin* diff --git a/runtime/doc/if_pyth.txt b/runtime/doc/if_pyth.txt index 4c184ddf94..45accc2e03 100644 --- a/runtime/doc/if_pyth.txt +++ b/runtime/doc/if_pyth.txt @@ -629,7 +629,7 @@ You can test if Python is available with: >vim if has('pythonx') echo 'there is Python' endif - if has('python3') + if has('python3') echo 'there is Python 3.x' endif diff --git a/runtime/doc/index.txt b/runtime/doc/index.txt index a6aa036b55..174683a8c3 100644 --- a/runtime/doc/index.txt +++ b/runtime/doc/index.txt @@ -220,7 +220,7 @@ tag char note action in Normal mode ~ |CTRL-\_CTRL-N| CTRL-\ CTRL-N go to Normal mode (no-op) |CTRL-\_CTRL-G| CTRL-\ CTRL-G go to Normal mode (no-op) CTRL-\ a - z reserved for extensions - CTRL-\ others not used + CTRL-\ others not used |CTRL-]| CTRL-] :ta to ident under cursor |CTRL-^| CTRL-^ edit Nth alternate file (equivalent to ":e #N") @@ -233,7 +233,7 @@ tag char note action in Normal mode ~ 2 filter Nmove text through the {filter} command |!!| !!{filter} 2 filter N lines through the {filter} command -|quote| "{register} use {register} for next delete, yank or put +|quote| "{register} use {register} for next delete, yank or put ({.%#:} only work with put) |#| # 1 search backward for the Nth occurrence of the ident under the cursor diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index e608b431f2..84aee43af4 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -1101,8 +1101,8 @@ cursor column will be replaced with the matches. If the returned value is larger than the cursor column, the cursor column is used. Negative return values: - -2 To cancel silently and stay in completion mode. - -3 To cancel silently and leave completion mode. + -2 To cancel silently and stay in completion mode. + -3 To cancel silently and leave completion mode. Another negative value: completion starts at the cursor column On the second invocation the arguments are: @@ -1154,7 +1154,7 @@ items: item with the same word is already present. empty when non-zero this match will be added even when it is an empty string - user_data custom data which is associated with the item and + user_data custom data which is associated with the item and available in |v:completed_item|; it can be any type; defaults to an empty string diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index cb8b162eb6..ad0570e9f7 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -764,7 +764,7 @@ option). After that it assumes that the 'q' is to be interpreted as such. If you type slowly, or your system is slow, reset the 'timeout' option. Then you might want to set the 'ttimeout' option. - *map-precedence* + *map-precedence* Buffer-local mappings (defined using |:map-|) take precedence over global mappings. When a buffer-local mapping is the same as a global mapping, Vim will use the buffer-local mapping. In addition, Vim will use a complete @@ -838,6 +838,11 @@ in the original Vi, you would get back the text before the first undo). 1.10 MAPPING ALT-KEYS *:map-alt-keys* +For a readable mapping command the form can be used. Note that +and are different, the latter will use an upper case letter. Actually, + and are the same. Instead of "A" you can use "M". If you have +an actual Meta modifier key, please see |:map-meta-keys|. + In the GUI Nvim handles the |ALT| key itself, thus mapping keys with ALT should always work. But in a terminal Nvim gets a sequence of bytes and has to figure out whether ALT was pressed. Terminals may use ESC to indicate that @@ -847,7 +852,21 @@ milliseconds, the ESC is interpreted as: otherwise it is interpreted as two key presses: {key} -1.11 MAPPING AN OPERATOR *:map-operator* +1.11 MAPPING META-KEYS *:map-meta-keys* + +Mapping keys with the Meta modifier works very similar to using the Alt key. +What key on your keyboard produces the Meta modifier depends on your keyboard +and configuration. + +Note that mapping actually is for using the Alt key. That can be +confusing! It cannot be changed, it would not be backwards compatible. + +For the Meta modifier the "T" character is used. For example, to map Meta-b +in Insert mode: > + :imap terrible + + +1.12 MAPPING AN OPERATOR *:map-operator* An operator is used before a {motion} command. To define your own operator you must create a mapping that first sets the 'operatorfunc' option and then @@ -984,7 +1003,7 @@ non-id The "non-id" type ends in a non-keyword character, the other Examples of strings that cannot be abbreviations: "a.b", "#def", "a b", "_$r" An abbreviation is only recognized when you type a non-keyword character. -This can also be the that ends insert mode or the that ends a +This can also be the that ends Insert mode or the that ends a command. The non-keyword character which ends the abbreviation is inserted after the expanded abbreviation. An exception to this is the character , which is used to expand an abbreviation without inserting any extra @@ -1484,7 +1503,7 @@ which by default correspond to the current line, last line and the whole buffer, relate to arguments, (loaded) buffers, windows or tab pages. Possible values are (second column is the short name used in listing): - -addr=lines Range of lines (this is the default for -range) + -addr=lines Range of lines (this is the default for -range) -addr=arguments arg Range for arguments -addr=buffers buf Range for buffers (also not loaded buffers) -addr=loaded_buffers load Range for loaded buffers diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index e4106358f1..d13ab8c393 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -1186,7 +1186,7 @@ A jump table for the options with a short description can be found at |Q_op|. case mapping, the current locale is not effective. This probably only matters for Turkish. - *'cdhome'* *'cdh'* + *'cdhome'* *'cdh'* *'nocdhome'* *'nocdh'* 'cdhome' 'cdh' boolean (default: off) global When on, |:cd|, |:tcd| and |:lcd| without an argument changes the @@ -4291,7 +4291,7 @@ A jump table for the options with a short description can be found at |Q_op|. The 'mousemodel' option is set by the |:behave| command. - *'mousemoveevent'* *'mousemev'* + *'mousemoveevent'* *'mousemev'* *'nomousemoveevent'* *'nomousemev'* 'mousemoveevent' 'mousemev' boolean (default off) global When on, mouse move events are delivered to the input queue and are @@ -5550,7 +5550,7 @@ A jump table for the options with a short description can be found at |Q_op|. A don't give the "ATTENTION" message when an existing *shm-A* swap file is found I don't give the intro message when starting Vim, *shm-I* - see |:intro| + see |:intro| c don't give |ins-completion-menu| messages; for *shm-c* example, "-- XXX completion (YYY)", "match 1 of 2", "The only match", "Pattern not found", "Back at original", etc. @@ -5559,8 +5559,8 @@ A jump table for the options with a short description can be found at |Q_op|. q use "recording" instead of "recording @a" *shm-q* F don't give the file info when editing a file, like *shm-F* `:silent` was used for the command - S do not show search count message when searching, e.g. *shm-S* - "[1/5]" + S do not show search count message when searching, e.g. *shm-S* + "[1/5]" This gives you the opportunity to avoid that a change between buffers requires you to hit , but still gives as useful a message as @@ -5709,7 +5709,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'signcolumn' 'scl' string (default "auto") local to window When and how to draw the signcolumn. Valid values are: - "auto" only when there is a sign to display + "auto" only when there is a sign to display "auto:[1-9]" resize to accommodate multiple signs up to the given number (maximum 9), e.g. "auto:4" "auto:[1-8]-[2-9]" @@ -5718,8 +5718,8 @@ A jump table for the options with a short description can be found at |Q_op|. at least the given minimum (maximum 8) fixed space. The minimum number should always be less than the maximum number, e.g. "auto:2-5" - "no" never - "yes" always + "no" never + "yes" always "yes:[1-9]" always, with fixed space for signs up to the given number (maximum 9), e.g. "yes:3" "number" display signs in the 'number' column. If the number diff --git a/runtime/doc/pattern.txt b/runtime/doc/pattern.txt index 5357aaa3f1..625e1f95e1 100644 --- a/runtime/doc/pattern.txt +++ b/runtime/doc/pattern.txt @@ -97,6 +97,8 @@ g# Like "#", but don't put "\<" and "\>" around the word. *gd* gd Goto local Declaration. When the cursor is on a local variable, this command will jump to its declaration. + This was made to work for C code, in other languages + it may not work well. First Vim searches for the start of the current function, just like "[[". If it is not found the search stops in line 1. If it is found, Vim goes back @@ -1129,21 +1131,21 @@ x A single character, with no special meaning, matches itself are supported: Name Func Contents ~ *[:alnum:]* [:alnum:] isalnum ASCII letters and digits -*[:alpha:]* [:alpha:] isalpha ASCII letters -*[:blank:]* [:blank:] space and tab -*[:cntrl:]* [:cntrl:] iscntrl ASCII control characters -*[:digit:]* [:digit:] decimal digits '0' to '9' +*[:alpha:]* [:alpha:] isalpha ASCII letters +*[:blank:]* [:blank:] space and tab +*[:cntrl:]* [:cntrl:] iscntrl ASCII control characters +*[:digit:]* [:digit:] decimal digits '0' to '9' *[:graph:]* [:graph:] isgraph ASCII printable characters excluding space *[:lower:]* [:lower:] (1) lowercase letters (all letters when 'ignorecase' is used) -*[:print:]* [:print:] (2) printable characters including space +*[:print:]* [:print:] (2) printable characters including space *[:punct:]* [:punct:] ispunct ASCII punctuation characters -*[:space:]* [:space:] whitespace characters: space, tab, CR, +*[:space:]* [:space:] whitespace characters: space, tab, CR, NL, vertical tab, form feed *[:upper:]* [:upper:] (3) uppercase letters (all letters when 'ignorecase' is used) -*[:xdigit:]* [:xdigit:] hexadecimal digits: 0-9, a-f, A-F +*[:xdigit:]* [:xdigit:] hexadecimal digits: 0-9, a-f, A-F *[:return:]* [:return:] the character *[:tab:]* [:tab:] the character *[:escape:]* [:escape:] the character diff --git a/runtime/doc/pi_netrw.txt b/runtime/doc/pi_netrw.txt index 5167b4baf7..d3d5e4605a 100644 --- a/runtime/doc/pi_netrw.txt +++ b/runtime/doc/pi_netrw.txt @@ -1085,8 +1085,8 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 Shrink/expand a netrw/explore window |netrw-c-tab| - Makes Netrw go up one directory |netrw--| a Cycles between normal display, |netrw-a| - hiding (suppress display of files matching g:netrw_list_hide) - and showing (display only files which match g:netrw_list_hide) + hiding (suppress display of files matching g:netrw_list_hide) + and showing (display only files which match g:netrw_list_hide) cd Make browsing directory the current directory |netrw-cd| C Setting the editing window |netrw-C| d Make a directory |netrw-d| @@ -1118,7 +1118,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 mX Apply arbitrary shell command to marked files en bloc|netrw-mX| mz Compress/decompress marked files |netrw-mz| o Enter the file/directory under the cursor in a new |netrw-o| - browser window. A horizontal split is used. + browser window. A horizontal split is used. O Obtain a file specified by cursor |netrw-O| p Preview the file |netrw-p| P Browse in the previously used window |netrw-P| @@ -1134,7 +1134,7 @@ QUICK REFERENCE: MAPS *netrw-browse-maps* {{{2 u Change to recently-visited directory |netrw-u| U Change to subsequently-visited directory |netrw-U| v Enter the file/directory under the cursor in a new |netrw-v| - browser window. A vertical split is used. + browser window. A vertical split is used. x View file with an associated program |netrw-x| X Execute filename under cursor via |system()| |netrw-X| @@ -2271,7 +2271,7 @@ Example: ... -MARKED FILES, ARBITRARY SHELL COMMAND, EN BLOC *netrw-mX* {{{2 +MARKED FILES, ARBITRARY SHELL COMMAND, EN BLOC *netrw-mX* {{{2 (See |netrw-mf| and |netrw-mr| for how to mark files) (uses the global marked-file list) @@ -2611,7 +2611,7 @@ your browsing preferences. (see also: |netrw-settings|) Used to change access permission for a file. *g:netrw_clipboard* =1 - By default, netrw will attempt to insure that + By default, netrw will attempt to insure that the clipboard's values will remain unchanged. However, some users report that they have speed problems with this; consequently, this @@ -2759,7 +2759,7 @@ your browsing preferences. (see also: |netrw-settings|) escaped before applying glob() *g:netrw_gx* ="" - This option controls how gx (|netrw-gx|) picks + This option controls how gx (|netrw-gx|) picks up the text under the cursor. See |expand()| for possibilities. @@ -2824,11 +2824,11 @@ your browsing preferences. (see also: |netrw-settings|) directory (|netrw-mt|, |netrw-mc|) *g:netrw_localcopycmdopt* ='' Linux/Unix/MacOS/Cygwin - =' \c copy' Windows + =' \c copy' Windows Options for the |g:netrw_localcopycmd| *g:netrw_localcopydircmd* ="cp" Linux/Unix/MacOS/Cygwin - =expand("$COMSPEC") Windows + =expand("$COMSPEC") Windows Copies directories to target directory. (|netrw-mc|, |netrw-mt|) @@ -2854,7 +2854,7 @@ your browsing preferences. (see also: |netrw-settings|) Options for |g:netrw_localmovecmd| *g:netrw_localrmdir* ="rmdir" Linux/Unix/MacOS/Cygwin - =expand("$COMSPEC") Windows + =expand("$COMSPEC") Windows Remove directory command (rmdir) This variable is only used if your vim is earlier than 7.4 or if your vim doesn't @@ -2890,10 +2890,10 @@ your browsing preferences. (see also: |netrw-settings|) (see |'ballooneval'|) *g:netrw_sizestyle* not defined: actual bytes (default) - ="b" : actual bytes (default) - ="h" : human-readable (ex. 5k, 4m, 3g) + ="b" : actual bytes (default) + ="h" : human-readable (ex. 5k, 4m, 3g) uses 1000 base - ="H" : human-readable (ex. 5K, 4M, 3G) + ="H" : human-readable (ex. 5K, 4M, 3G) uses 1024 base The long listing (|netrw-i|) and query-file maps (|netrw-qf|) will display file size @@ -2941,7 +2941,7 @@ your browsing preferences. (see also: |netrw-settings|) default: "NETRWSERVER" *g:netrw_sort_by* sort by "name", "time", "size", or - "exten". + "exten". default: "name" *g:netrw_sort_direction* sorting direction: "normal" or "reverse" @@ -2998,7 +2998,7 @@ your browsing preferences. (see also: |netrw-settings|) .vim/after/syntax/netrw.vim. < The netrwGray highlighting is set up by netrw when > - * netrwGray has not been previously + * netrwGray has not been previously defined * the gui is running < As an example, I myself use a dark-background @@ -3256,7 +3256,7 @@ If there are marked files: (see |netrw-mf|) name, applying that substitute, and renaming each file to the result. As an example : > - mr [query: reply with *.c] + mr [query: reply with *.c] R [query: reply with s/^\(.*\)\.c$/\1.cpp/] < This example will mark all "*.c" files and then rename them to "*.cpp" @@ -3265,7 +3265,7 @@ If there are marked files: (see |netrw-mf|) The ctrl-X character has special meaning for renaming files: > - : a single ctrl-x tells netrw to ignore the portion of the response + : a single ctrl-x tells netrw to ignore the portion of the response lying between the last '/' and the ctrl-x. : a pair of contiguous ctrl-x's tells netrw to ignore any @@ -3833,7 +3833,7 @@ netrw: Decho.vim is provided as a "vimball". You should edit the Decho.vba.gz file and source it in: > - vim Decho.vba.gz + vim Decho.vba.gz :so % :q < @@ -3875,7 +3875,7 @@ netrw: To save the file: under linux, the output will be in a separate remote server window; in it, just save the file with > - :w! DBG + :w! DBG < Under a vim that doesn't support clientserver, your debugging output will appear in another tab: > diff --git a/runtime/doc/remote.txt b/runtime/doc/remote.txt index 4610088ab0..804645f774 100644 --- a/runtime/doc/remote.txt +++ b/runtime/doc/remote.txt @@ -46,7 +46,7 @@ The following command line arguments are available: new tabpage. *--remote-send* --remote-send {keys} Send {keys} to server and exit. The {keys} - are not mapped. Special key names are + are not mapped. Special key names are recognized, e.g., "" results in a CR character. *--remote-expr* diff --git a/runtime/doc/repeat.txt b/runtime/doc/repeat.txt index bf77aacdc0..23030761dd 100644 --- a/runtime/doc/repeat.txt +++ b/runtime/doc/repeat.txt @@ -214,7 +214,7 @@ For writing a Vim script, see chapter 41 of the user manual |usr_41.txt|. When [where] is omitted only 'runtimepath' is used. Other values: START search only under "start" in 'packpath' - OPT search only under "opt" in 'packpath' + OPT search only under "opt" in 'packpath' PACK search under "start" and "opt" in 'packpath' ALL first use 'runtimepath', then search @@ -641,15 +641,15 @@ up-to-date easily, but it requires a program like "git" to be available. You can do both, github can automatically create an archive for a release. Your directory layout would be like this: - start/foobar/plugin/foo.vim " always loaded, defines commands - start/foobar/plugin/bar.vim " always loaded, defines commands - start/foobar/autoload/foo.vim " loaded when foo command used - start/foobar/doc/foo.txt " help for foo.vim - start/foobar/doc/tags " help tags - opt/fooextra/plugin/extra.vim " optional plugin, defines commands - opt/fooextra/autoload/extra.vim " loaded when extra command used - opt/fooextra/doc/extra.txt " help for extra.vim - opt/fooextra/doc/tags " help tags + start/foobar/plugin/foo.vim " always loaded, defines commands + start/foobar/plugin/bar.vim " always loaded, defines commands + start/foobar/autoload/foo.vim " loaded when foo command used + start/foobar/doc/foo.txt " help for foo.vim + start/foobar/doc/tags " help tags + opt/fooextra/plugin/extra.vim " optional plugin, defines commands + opt/fooextra/autoload/extra.vim " loaded when extra command used + opt/fooextra/doc/extra.txt " help for extra.vim + opt/fooextra/doc/tags " help tags This allows for the user to do: > mkdir ~/.local/share/nvim/site/pack diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index d09d0f226f..53ef03eb63 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -610,7 +610,7 @@ sign_placelist({list}) be placed. For the accepted values, see |line()|. name name of the sign to place. See |sign_define()| - for more information. + for more information. priority priority of the sign. When multiple signs are placed on a line, the sign with the highest priority is used. If not specified, the diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index bd5a4f1926..7102e93f0a 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -1271,18 +1271,32 @@ When not set 4 is used. DOSBATCH *dosbatch.vim* *ft-dosbatch-syntax* -There is one option with highlighting DOS batch files. This covers new -extensions to the Command Interpreter introduced with Windows 2000 and -is controlled by the variable dosbatch_cmdextversion. For Windows NT -this should have the value 1, and for Windows 2000 it should be 2. +Select the set of Windows Command interpreter extensions that should be +supported with the variable dosbatch_cmdextversion. For versions of Windows +NT (before Windows 2000) this should have the value of 1. For Windows 2000 +and later it should be 2. Select the version you want with the following line: > :let dosbatch_cmdextversion = 1 If this variable is not defined it defaults to a value of 2 to support -Windows 2000. +Windows 2000 and later. -A second option covers whether *.btm files should be detected as type +The original MS-DOS supports an idiom of using a double colon (::) as an +alternative way to enter a comment line. This idiom can be used with the +current Windows Command Interpreter, but it can lead to problems when used +inside ( ... ) command blocks. You can find a discussion about this on +Stack Overflow - + +https://stackoverflow.com/questions/12407800/which-comment-style-should-i-use-in-batch-files + +To allow the use of the :: idiom for comments in the Windows Command +Interpreter or working with MS-DOS bat files, set the +dosbatch_colons_comment variable to anything: > + + :let dosbatch_colons_comment = 1 + +There is an option that covers whether *.btm files should be detected as type "dosbatch" (MS-DOS batch files) or type "btm" (4DOS batch files). The latter is used by default. You may select the former with the following line: > @@ -3784,7 +3798,7 @@ SYNTAX ISKEYWORD SETTING *:syn-iskeyword* clear: Syntax specific iskeyword setting is disabled and the buffer-local 'iskeyword' setting is used. - {option} Set the syntax 'iskeyword' option to a new value. + {option} Set the syntax 'iskeyword' option to a new value. Example: > :syntax iskeyword @,48-57,192-255,$,_ diff --git a/runtime/doc/uganda.txt b/runtime/doc/uganda.txt index d8fc26ad17..fc38f5b73c 100644 --- a/runtime/doc/uganda.txt +++ b/runtime/doc/uganda.txt @@ -246,7 +246,7 @@ Credit Card: You can use PayPal to send money with a Credit card. This is Bram@iccf-holland.org Others: Transfer to this account if possible: - ING bank: IBAN: NL95 INGB 0004 5487 74 + ING bank: IBAN: NL95 INGB 0004 5487 74 Swift code: INGBNL2A under the name "stichting ICCF Holland", Amersfoort Checks are not accepted. diff --git a/runtime/doc/userfunc.txt b/runtime/doc/userfunc.txt index 9c428175bb..ce6f2fc2e9 100644 --- a/runtime/doc/userfunc.txt +++ b/runtime/doc/userfunc.txt @@ -234,9 +234,10 @@ Example: > call Something('key', 20) "key: 20" The argument default expressions are evaluated at the time of the function -call, not definition. Thus it is possible to use an expression which is -invalid the moment the function is defined. The expressions are also only -evaluated when arguments are not specified during a call. +call, not when the function is defined. Thus it is possible to use an +expression which is invalid the moment the function is defined. The +expressions are also only evaluated when arguments are not specified during a +call. *E989* Optional arguments with default expressions must occur after any mandatory diff --git a/runtime/doc/usr_02.txt b/runtime/doc/usr_02.txt index 11afe39742..259bb41200 100644 --- a/runtime/doc/usr_02.txt +++ b/runtime/doc/usr_02.txt @@ -495,7 +495,7 @@ You can use the error ID at the start to find help about it: > :help E37 -Summary: *help-summary* > +Summary: *help-summary* > 1) Use Ctrl-D after typing a topic and let Vim show all available topics. Or press Tab to complete: > diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index 24d6185eae..d8fb2acedb 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -273,7 +273,7 @@ an archive or as a repository. For an archive you can follow these steps: package. 2. unpack the archive in that directory. This assumes the top directory in the archive is "start": > - cd ~/.local/share/nvim/site/pack/fancy + cd ~/.local/share/nvim/site/pack/fancy unzip /tmp/fancy.zip < If the archive layout is different make sure that you end up with a path like this: diff --git a/runtime/doc/usr_22.txt b/runtime/doc/usr_22.txt index 539bda3980..d977b20ecc 100644 --- a/runtime/doc/usr_22.txt +++ b/runtime/doc/usr_22.txt @@ -77,25 +77,25 @@ browser. This is what you get: > 9. Directory Browsing netrw-browse netrw-dir netrw-list netrw-help MAPS netrw-maps - .............Help.......................................|netrw-help| - .............Browsing...................................|netrw-cr| - ............Deleting Files or Directories..............|netrw-delete| - -................Going Up...................................|netrw--| - a................Hiding Files or Directories................|netrw-a| - mb...............Bookmarking a Directory....................|netrw-mb| - gb...............Changing to a Bookmarked Directory.........|netrw-gb| - cd...............Make Browsing Directory The Current Dir....|netrw-c| - d................Make A New Directory.......................|netrw-d| - D................Deleting Files or Directories..............|netrw-D| - ............Edit File/Directory Hiding List............|netrw-ctrl-h| - i................Change Listing Style.......................|netrw-i| - ............Refreshing the Listing.....................|netrw-ctrl-l| - o................Browsing with a Horizontal Split...........|netrw-o| - p................Use Preview Window.........................|netrw-p| - P................Edit in Previous Window....................|netrw-p| - q................Listing Bookmarks and History..............|netrw-qb| - r................Reversing Sorting Order....................|netrw-r| -< (etc) + .............Help.......................................|netrw-help| + .............Browsing...................................|netrw-cr| + ............Deleting Files or Directories..............|netrw-delete| + -................Going Up...................................|netrw--| + a................Hiding Files or Directories................|netrw-a| + mb...............Bookmarking a Directory....................|netrw-mb| + gb...............Changing to a Bookmarked Directory.........|netrw-gb| + cd...............Make Browsing Directory The Current Dir....|netrw-c| + d................Make A New Directory.......................|netrw-d| + D................Deleting Files or Directories..............|netrw-D| + ............Edit File/Directory Hiding List............|netrw-ctrl-h| + i................Change Listing Style.......................|netrw-i| + ............Refreshing the Listing.....................|netrw-ctrl-l| + o................Browsing with a Horizontal Split...........|netrw-o| + p................Use Preview Window.........................|netrw-p| + P................Edit in Previous Window....................|netrw-p| + q................Listing Bookmarks and History..............|netrw-qb| + r................Reversing Sorting Order....................|netrw-r| +< (etc) The key thus brings you to a netrw directory browsing contents help page. It's a regular help page; use the usual |CTRL-]| to jump to tagged help items @@ -106,7 +106,7 @@ To select files for display and editing: (with the cursor is atop a filename) Open the file in the current window. |netrw-cr| o Horizontally split window and display file |netrw-o| v Vertically split window and display file |netrw-v| - p Use the |preview-window| |netrw-p| + p Use the |preview-window| |netrw-p| P Edit in the previous window |netrw-P| t Open file in a new tab |netrw-t| -- cgit From 344a1ee8e6b7d78120f8393d1babfd285e866334 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 22 Feb 2023 00:07:26 +0800 Subject: docs: fix typos (#22353) --- runtime/doc/api.txt | 2 +- runtime/doc/autocmd.txt | 2 +- runtime/doc/builtin.txt | 4 ++-- runtime/doc/deprecated.txt | 4 ++-- runtime/doc/develop.txt | 4 ++-- runtime/doc/eval.txt | 18 +++++++++--------- runtime/doc/help.txt | 28 ++++++++++++++-------------- runtime/doc/if_perl.txt | 2 +- runtime/doc/intro.txt | 2 +- runtime/doc/motion.txt | 2 +- runtime/doc/nvim_terminal_emulator.txt | 6 +++--- runtime/doc/provider.txt | 8 ++++---- runtime/doc/remote_plugin.txt | 2 +- runtime/doc/starting.txt | 4 ++-- runtime/doc/ui.txt | 22 +++++++++++----------- runtime/doc/various.txt | 2 +- runtime/doc/windows.txt | 2 +- 17 files changed, 57 insertions(+), 57 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 95a929b808..7bcae79852 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -2644,7 +2644,7 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {*opts}) buffer. • right_gravity : boolean that indicates the direction the extmark will be shifted in when new text is inserted (true - for right, false for left). defaults to true. + for right, false for left). Defaults to true. • end_right_gravity : boolean that indicates the direction the extmark end position (if it exists) will be shifted in when new text is inserted (true for right, false for diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 89252145f2..e9a4196252 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -426,7 +426,7 @@ ColorSchemePre Before loading a color scheme. |:colorscheme| Useful to setup removing things added by a color scheme, before another one is loaded. -CompleteChanged *CompleteChanged* +CompleteChanged *CompleteChanged* After each time the Insert mode completion menu changed. Not fired on popup menu hide, use |CompleteDonePre| or |CompleteDone| for diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 60a1035da3..af5ba9ab8f 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -1055,7 +1055,7 @@ chansend({id}, {data}) *chansend()* newlines in an item will be sent as NUL. To send a final newline, include a final empty string. Example: > :call chansend(id, ["abc", "123\n456", ""]) -< will send "abc123456". +< will send "abc123456". chansend() writes raw data, not RPC messages. If the channel was created with `"rpc":v:true` then the channel expects RPC @@ -4846,7 +4846,7 @@ maparg({name} [, {mode} [, {abbr} [, {dict}]]]) *maparg()* "lhs" The {lhs} of the mapping as it would be typed "lhsraw" The {lhs} of the mapping as raw bytes "lhsrawalt" The {lhs} of the mapping as raw bytes, alternate - form, only present when it differs from "lhsraw" + form, only present when it differs from "lhsraw" "rhs" The {rhs} of the mapping as typed. "silent" 1 for a |:map-silent| mapping, else 0. "noremap" 1 if the {rhs} of the mapping is not remappable. diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 1bdd13ac0c..e7b0a710e8 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -113,14 +113,14 @@ LSP FUNCTIONS - *vim.lsp.util.set_qflist()* Use |setqflist()| instead. - *vim.lsp.util.set_loclist()* Use |setloclist()| instead. - *vim.lsp.buf_get_clients()* Use |vim.lsp.get_active_clients()| with - {buffer = bufnr} instead. + {buffer = bufnr} instead. - *vim.lsp.buf.formatting()* Use |vim.lsp.buf.format()| with {async = true} instead. - *vim.lsp.buf.range_formatting()* Use |vim.lsp.formatexpr()| or |vim.lsp.buf.format()| instead. LUA -- *vim.register_keystroke_callback()* Use |vim.on_key()| instead. +- *vim.register_keystroke_callback()* Use |vim.on_key()| instead. NORMAL COMMANDS - *]f* *[f* Same as "gf". diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index ff48ae3e26..87190d7f33 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -81,7 +81,7 @@ include the kitchen sink... but it's good for plumbing." Developer guidelines *dev-guidelines* -PROVIDERS *dev-provider* +PROVIDERS *dev-provider* A primary goal of Nvim is to allow extension of the editor without special knowledge in the core. Some core functions are delegated to "providers" @@ -391,7 +391,7 @@ API client implementation guidelines ~ https://github.com/msgpack-rpc/msgpack-rpc -EXTERNAL UI *dev-ui* +EXTERNAL UI *dev-ui* External UIs should be aware of the |api-contract|. In particular, future versions of Nvim may add new items to existing events. The API is strongly diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index af67e2b67d..d79b446986 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1817,17 +1817,17 @@ v:event Dictionary of event data for the current |autocommand|. Valid completed_item Current selected complete item on |CompleteChanged|, Is `{}` when no complete item selected. - height Height of popup menu on |CompleteChanged| - width width of popup menu on |CompleteChanged| - row Row count of popup menu on |CompleteChanged|, + height Height of popup menu on |CompleteChanged| + width width of popup menu on |CompleteChanged| + row Row count of popup menu on |CompleteChanged|, relative to screen. - col Col count of popup menu on |CompleteChanged|, + col Col count of popup menu on |CompleteChanged|, relative to screen. - size Total number of completion items on + size Total number of completion items on |CompleteChanged|. - scrollbar Is |v:true| if popup menu have scrollbar, or + scrollbar Is |v:true| if popup menu have scrollbar, or |v:false| if not. - changed_window Is |v:true| if the event fired while + changed_window Is |v:true| if the event fired while changing window (or tab) on |DirChanged|. status Job status or exit code, -1 means "unknown". |TermClose| @@ -2668,8 +2668,8 @@ text... Example with [depth] 0: > let mylist = [1, 2, 3] lockvar 0 mylist - let mylist[0] = 77 " OK - call add(mylist, 4] " OK + let mylist[0] = 77 " OK + call add(mylist, 4] " OK let mylist = [7, 8, 9] " Error! < *E743* For unlimited depth use [!] and omit [depth]. diff --git a/runtime/doc/help.txt b/runtime/doc/help.txt index 07f898f99c..68c886887f 100644 --- a/runtime/doc/help.txt +++ b/runtime/doc/help.txt @@ -120,15 +120,15 @@ PROGRAMMING LANGUAGE SUPPORT |lsp| Language Server Protocol (LSP) |diagnostic-api| Diagnostic framework |treesitter| Incremental syntax parsing -|indent.txt| automatic indenting for C and other languages +|indent.txt| automatic indenting for C and other languages |syntax| syntax highlighting |filetype| Settings for specific types of files |quickfix| Commands for a quick edit-compile-fix cycle -|ft_ada.txt| Ada filetype plugin -|ft_ps1.txt| PowerShell filetype plugin -|ft_raku.txt| Raku filetype plugin -|ft_rust.txt| Rust filetype plugin -|ft_sql.txt| SQL filetype plugin +|ft_ada.txt| Ada filetype plugin +|ft_ps1.txt| PowerShell filetype plugin +|ft_raku.txt| Raku filetype plugin +|ft_rust.txt| Rust filetype plugin +|ft_sql.txt| SQL filetype plugin ------------------------------------------------------------------------------ UI @@ -172,14 +172,14 @@ DEVELOPING NVIM *standard-plugin-list* Standard plugins ~ |matchit.txt| Extended |%| matching -|pi_gzip.txt| Reading and writing compressed files -|pi_health.txt| Healthcheck framework -|pi_msgpack.txt| msgpack utilities -|pi_netrw.txt| Reading and writing files over a network -|pi_paren.txt| Highlight matching parens -|pi_spec.txt| Filetype plugin to work with rpm spec files -|pi_tar.txt| Tar file explorer -|pi_zip.txt| Zip archive explorer +|pi_gzip.txt| Reading and writing compressed files +|pi_health.txt| Healthcheck framework +|pi_msgpack.txt| msgpack utilities +|pi_netrw.txt| Reading and writing files over a network +|pi_paren.txt| Highlight matching parens +|pi_spec.txt| Filetype plugin to work with rpm spec files +|pi_tar.txt| Tar file explorer +|pi_zip.txt| Zip archive explorer LOCAL ADDITIONS: *local-additions* diff --git a/runtime/doc/if_perl.txt b/runtime/doc/if_perl.txt index 3787ca69ba..e4ec6dcf45 100644 --- a/runtime/doc/if_perl.txt +++ b/runtime/doc/if_perl.txt @@ -116,7 +116,7 @@ Overview > VIM::SetOption("ai") # sets a vim option $nbuf = VIM::Buffers() # returns the number of buffers @buflist = VIM::Buffers() # returns array of all buffers - $mybuf = (VIM::Buffers('a.c'))[0] # returns buffer object for 'a.c' + $mybuf = (VIM::Buffers('a.c'))[0] # returns buffer object for 'a.c' @winlist = VIM::Windows() # returns array of all windows $nwin = VIM::Windows() # returns the number of windows ($success, $v) = VIM::Eval('&path') # $v: option 'path', $success: 1 diff --git a/runtime/doc/intro.txt b/runtime/doc/intro.txt index 11ba1b408c..685c953718 100644 --- a/runtime/doc/intro.txt +++ b/runtime/doc/intro.txt @@ -358,7 +358,7 @@ notation meaning equivalent decimal value(s) ~ keypad origin (middle) *keypad-origin* keypad page-up (upper right) *keypad-page-up* keypad page-down (lower right) *keypad-page-down* - keypad delete *keypad-delete* + keypad delete *keypad-delete* keypad + *keypad-plus* keypad - *keypad-minus* keypad * *keypad-multiply* diff --git a/runtime/doc/motion.txt b/runtime/doc/motion.txt index 929efee19f..59ae209aa9 100644 --- a/runtime/doc/motion.txt +++ b/runtime/doc/motion.txt @@ -589,7 +589,7 @@ i( *vib* *v_ib* *v_i(* *ib* ib "inner block", select [count] blocks, from "[count] [(" to the matching ')', excluding the '(' and ')' (see |[(|). If the cursor is not inside a () block, then - find the next "(". + find the next "(". When used in Visual mode it is made charwise. a> *v_a>* *v_a<* *a>* *a<* diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index 96f99528ed..50a241f515 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -239,7 +239,7 @@ gdb window and use a "print" command, e.g.: > print *eap If mouse pointer movements are working, Vim will also show a balloon when the mouse rests on text that can be evaluated by gdb. -You can also use the "K" mapping that will either use neovim floating windows +You can also use the "K" mapping that will either use Nvim floating windows if available to show the results or print below the status bar. Now go back to the source window and put the cursor on the first line after @@ -428,14 +428,14 @@ If the command needs an argument use a List: >vim If there is no g:termdebug_config you can use: >vim let g:termdebugger = ['rr', 'replay', '--'] -To not use neovim floating windows for previewing variable evaluation, set the +To not use Nvim floating windows for previewing variable evaluation, set the `g:termdebug_useFloatingHover` variable like this: >vim let g:termdebug_useFloatingHover = 0 If you are a mouse person, you can also define a mapping using your right click to one of the terminal command like evaluate the variable under the cursor: >vim - nnoremap :Evaluate + nnoremap :Evaluate or set/unset a breakpoint: >vim nnoremap :Break diff --git a/runtime/doc/provider.txt b/runtime/doc/provider.txt index 5375d971f0..432e6138fa 100644 --- a/runtime/doc/provider.txt +++ b/runtime/doc/provider.txt @@ -4,7 +4,7 @@ NVIM REFERENCE MANUAL by Thiago de Arruda -Providers *provider* +Providers *provider* Nvim delegates some features to dynamic "providers". This document describes the providers and how to install them. @@ -82,7 +82,7 @@ The last command reports the interpreter path, add it to your init.vim: >vim See also: https://github.com/zchee/deoplete-jedi/wiki/Setting-up-Python-for-Neovim ============================================================================== -Ruby integration *provider-ruby* +Ruby integration *provider-ruby* Nvim supports Ruby |remote-plugin|s and the Vim legacy |ruby-vim| interface (which is itself implemented as a Nvim remote-plugin). @@ -169,7 +169,7 @@ can be slow. To avoid this, set g:node_host_prog to the host path: >vim let g:node_host_prog = '/usr/local/bin/neovim-node-host' < ============================================================================== -Clipboard integration *provider-clipboard* *clipboard* +Clipboard integration *provider-clipboard* *clipboard* Nvim has no direct connection to the system clipboard. Instead it depends on a |provider| which transparently uses shell commands to communicate with the @@ -255,7 +255,7 @@ For Windows WSL, try this g:clipboard definition: \ } ============================================================================== -Paste *provider-paste* *paste* +Paste *provider-paste* *paste* "Paste" is a separate concept from |clipboard|: paste means "dump a bunch of text to the editor", whereas clipboard provides features like |quote+| to get diff --git a/runtime/doc/remote_plugin.txt b/runtime/doc/remote_plugin.txt index 4cdcbed250..348f6c86a5 100644 --- a/runtime/doc/remote_plugin.txt +++ b/runtime/doc/remote_plugin.txt @@ -4,7 +4,7 @@ NVIM REFERENCE MANUAL by Thiago de Arruda -Nvim support for remote plugins *remote-plugin* +Nvim support for remote plugins *remote-plugin* Type |gO| to see the table of contents. diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index 67a88913fb..a8a149def8 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -368,7 +368,7 @@ argument. -W {scriptout} Like -w, but do not append, overwrite an existing file. *--api-info* ---api-info Print msgpack-encoded |api-metadata| and exit. +--api-info Print msgpack-encoded |api-metadata| and exit. *--embed* --embed Use stdin/stdout as a msgpack-RPC channel, so applications can @@ -392,7 +392,7 @@ argument. < See also: |ui-startup| |channel-stdio| *--headless* ---headless Start without UI, and do not wait for `nvim_ui_attach`. The +--headless Start without UI, and do not wait for `nvim_ui_attach`. The builtin TUI is not used, so stdio works as an arbitrary communication channel. |channel-stdio| diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index 3110d0817c..4e4f88f275 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -53,11 +53,11 @@ with these (optional) keys: - `term_name` Sets the name of the terminal 'term'. - `term_colors` Sets the number of supported colors 't_Co'. - `term_background` Sets the default value of 'background'. -- `stdin_fd` Read buffer from `fd` as if it was a stdin pipe - This option can only used by |--embed| ui, - see |ui-startup-stdin|. - `stdin_tty` Tells if `stdin` is a `tty` or not. - `stdout_tty` Tells if `stdout` is a `tty` or not. +- `stdin_fd` Read buffer from `fd` as if it was a stdin pipe. + This option can only used by |--embed| ui on startup. + See |ui-startup-stdin|. +- `stdin_tty` Tells if `stdin` is a `tty` or not. +- `stdout_tty` Tells if `stdout` is a `tty` or not. Specifying an unknown option is an error; UIs can check the |api-metadata| `ui_options` key for supported options. @@ -154,11 +154,11 @@ procedure: An UI can support the native read from stdin feature as invoked with `command | nvim -` for the builtin TUI. |--| The embedding process can detect that its stdin is open to a file which -not is a terminal, just like nvim does. It then needs to forward this fd +not is a terminal, just like Nvim does. It then needs to forward this fd to Nvim. As fd=0 is already is used to send rpc data from the embedder to Nvim, it needs to use some other file descriptor, like fd=3 or higher. -Then, `stdin_fd` option should be passed to `nvim_ui_attach` and nvim will +Then, `stdin_fd` option should be passed to `nvim_ui_attach` and Nvim will implicitly read it as a buffer. This option can only be used when Nvim is launched with `--embed` option, as described above. @@ -356,8 +356,8 @@ numerical highlight ids to the actual attributes. The bulitin highlight group `name` was set to use the attributes `hl_id` defined by a previous `hl_attr_define` call. This event is not needed to render the grids which use attribute ids directly, but is useful - for an UI who want to render its own elements with consistent - highlighting. For instance an UI using |ui-popupmenu| events, might + for a UI who want to render its own elements with consistent + highlighting. For instance a UI using |ui-popupmenu| events, might use the |hl-Pmenu| family of builtin highlights. *ui-event-grid_line* @@ -532,7 +532,7 @@ is not active. New UIs should implement |ui-linegrid| instead. +-------------------------+ < ============================================================================== -Detailed highlight state Extension *ui-hlstate* +Detailed highlight state Extension *ui-hlstate* Activated by the `ext_hlstate` |ui-option|. Activates |ui-linegrid| implicitly. @@ -566,7 +566,7 @@ highlight group is cleared, so `ui_name` can always be used to reliably identify screen elements, even if no attributes have been applied. ============================================================================== -Multigrid Events *ui-multigrid* +Multigrid Events *ui-multigrid* Activated by the `ext_multigrid` |ui-option|. Activates |ui-linegrid| implicitly. diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt index e13d892fd6..ccde53cc06 100644 --- a/runtime/doc/various.txt +++ b/runtime/doc/various.txt @@ -473,7 +473,7 @@ will be no "Last set" message. When it was defined while executing a function, user command or autocommand, the script in which it was defined is reported. *K* -[count]K Runs the program given by 'keywordprg' to lookup the +[count]K Runs the program given by 'keywordprg' to lookup the |word| (defined by 'iskeyword') under or right of the cursor. Default is "man". Works like this: > :tabnew | terminal {program} {keyword} diff --git a/runtime/doc/windows.txt b/runtime/doc/windows.txt index 61f5013f47..4b7901e614 100644 --- a/runtime/doc/windows.txt +++ b/runtime/doc/windows.txt @@ -223,7 +223,7 @@ CTRL-W ^ Split the current window in two and edit the alternate file. CTRL-W ge *CTRL-W_ge* Detach the current window as an external window. - Only available when using an UI with |ui-multigrid| support. + Only available when using a UI with |ui-multigrid| support. Note that the 'splitbelow' and 'splitright' options influence where a new window will appear. -- cgit From 8714a4009c0f0be0bb27a6b3eb486eeb3d9f3049 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Tue, 21 Feb 2023 17:09:18 +0000 Subject: feat(treesitter): add filetype -> lang API Problem: vim.treesitter does not know how to map a specific filetype to a parser. This creates problems since in a few places (including in vim.treesitter itself), the filetype is incorrectly used in place of lang. Solution: Add an API to enable this: - Add vim.treesitter.language.add() as a replacement for vim.treesitter.language.require_language(). - Optional arguments are now passed via an opts table. - Also takes a filetype (or list of filetypes) so we can keep track of what filetypes are associated with which langs. - Deprecated vim.treesitter.language.require_language(). - Add vim.treesitter.language.get_lang() which returns the associated lang for a given filetype. - Add vim.treesitter.language.register() to associate filetypes to a lang without loading the parser. --- runtime/doc/news.txt | 5 +++++ runtime/doc/treesitter.txt | 50 +++++++++++++++++++++++++++++++--------------- 2 files changed, 39 insertions(+), 16 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index ae21bc47ca..8b41f2d104 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -164,6 +164,9 @@ The following new APIs or features were added. • |vim.treesitter.query.get_node_text()| now accepts a `metadata` option for writing custom directives using |vim.treesitter.query.add_directive()|. +• |vim.treesitter.language.add()| as a new replacement for + `vim.treesitter.language.require_language`. + ============================================================================== CHANGED FEATURES *news-changes* @@ -202,6 +205,8 @@ DEPRECATIONS *news-deprecations* The following functions are now deprecated and will be removed in the next release. +• `vim.treesitter.language.require_language()` has been deprecated in favour + of |vim.treesitter.language.add()|. vim:tw=78:ts=8:sw=2:et:ft=help:norl: diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index d4799053f7..e35e145301 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -666,6 +666,36 @@ stop({bufnr}) *vim.treesitter.stop()* ============================================================================== Lua module: vim.treesitter.language *lua-treesitter-language* +add({lang}, {opts}) *vim.treesitter.language.add()* + Asserts that a parser for the language {lang} is installed. + + Parsers are searched in the `parser` runtime directory, or the provided + {path} + + Parameters: ~ + • {lang} (string) Language the parser should parse (alphanumerical and + `_` only) + • {opts} (table|nil) Options: + • filetype (string|string[]) Filetype(s) that lang can be + parsed with. Note this is not strictly the same as lang + since a single lang can parse multiple filetypes. Defaults + to lang. + • path (string|nil) Optional path the parser is located at + • symbol_name (string|nil) Internal symbol name for the + language to load + • silent (boolean|nil) Don't throw an error if language not + found + + Return: ~ + (boolean) If the specified language is installed + +get_lang({filetype}) *vim.treesitter.language.get_lang()* + Parameters: ~ + • {filetype} (string) + + Return: ~ + (string|nil) + inspect_language({lang}) *vim.treesitter.language.inspect_language()* Inspects the provided language. @@ -678,24 +708,12 @@ inspect_language({lang}) *vim.treesitter.language.inspect_language()* Return: ~ (table) - *vim.treesitter.language.require_language()* -require_language({lang}, {path}, {silent}, {symbol_name}) - Asserts that a parser for the language {lang} is installed. - - Parsers are searched in the `parser` runtime directory, or the provided - {path} +register({lang}, {filetype}) *vim.treesitter.language.register()* + Register a lang to be used for a filetype (or list of filetypes). Parameters: ~ - • {lang} (string) Language the parser should parse - (alphanumerical and `_` only) - • {path} (string|nil) Optional path the parser is located at - • {silent} (boolean|nil) Don't throw an error if language not - found - • {symbol_name} (string|nil) Internal symbol name for the language to - load - - Return: ~ - (boolean) If the specified language is installed + • {lang} (string) Language to register + • {filetype} string|string[] Filetype(s) to associate with lang ============================================================================== -- cgit From 675826da63e879efa97c0998fea192ed5c79d56e Mon Sep 17 00:00:00 2001 From: Gregory Anders <8965202+gpanders@users.noreply.github.com> Date: Wed, 22 Feb 2023 08:01:08 -0700 Subject: refactor(treesitter): Add vim.treesitter.get_node() (#22360) This function replaces both vim.treesitter.get_node_at_pos() and vim.treesitter.get_node_at_cursor(). These two functions are similar enough that they don't need separate interfaces. Even worse, get_node_at_pos() returns a TSNode while get_node_at_cursor() returns a string, so the two functions behave slightly differently. vim.treesitter.get_node() combines these two into a more streamlined interface. With no arguments, it returns the node under the cursor in the current buffer. Optionally, it can accept a buffer number or a position to get the node at a given position in a given buffer. --- runtime/doc/deprecated.txt | 8 ++++++++ runtime/doc/news.txt | 2 ++ runtime/doc/treesitter.txt | 29 ++++++++++------------------- 3 files changed, 20 insertions(+), 19 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index e7b0a710e8..42dfb53e77 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -119,6 +119,14 @@ LSP FUNCTIONS - *vim.lsp.buf.range_formatting()* Use |vim.lsp.formatexpr()| or |vim.lsp.buf.format()| instead. +TREESITTER FUNCTIONS +- *vim.treesitter.language.require_language()* Use |vim.treesitter.language.add()| + instead. +- *vim.treesitter.get_node_at_pos()* Use |vim.treesitter.get_node()| + instead. +- *vim.treesitter.get_node_at_cursor()* Use |vim.treesitter.get_node()| + and |TSNode:type()| instead. + LUA - *vim.register_keystroke_callback()* Use |vim.on_key()| instead. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 8b41f2d104..2a12a144e6 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -208,5 +208,7 @@ release. • `vim.treesitter.language.require_language()` has been deprecated in favour of |vim.treesitter.language.add()|. +• |vim.treesitter.get_node_at_pos()| and |vim.treesitter.get_node_at_cursor()| + are both deprecated in favor of |vim.treesitter.get_node()|. vim:tw=78:ts=8:sw=2:et:ft=help:norl: diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index e35e145301..16de49029e 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -508,30 +508,21 @@ get_captures_at_pos({bufnr}, {row}, {col}) table[] List of captures `{ capture = "capture name", metadata = { ... } }` -get_node_at_cursor({winnr}) *vim.treesitter.get_node_at_cursor()* - Returns the smallest named node under the cursor - - Parameters: ~ - • {winnr} (integer|nil) Window handle or 0 for current window (default) - - Return: ~ - (string) Name of node under the cursor - - *vim.treesitter.get_node_at_pos()* -get_node_at_pos({bufnr}, {row}, {col}, {opts}) +get_node({opts}) *vim.treesitter.get_node()* Returns the smallest named node at the given position Parameters: ~ - • {bufnr} (integer) Buffer number (0 for current buffer) - • {row} (integer) Position row - • {col} (integer) Position column - • {opts} (table) Optional keyword arguments: - • lang string|nil Parser language - • ignore_injections boolean Ignore injected languages - (default true) + • {opts} (table|nil) Optional keyword arguments: + • bufnr integer|nil Buffer number (nil or 0 for current + buffer) + • pos table|nil 0-indexed (row, col) tuple. Defaults to cursor + position in the current window. Required if {bufnr} is not + the current buffer + • ignore_injections boolean Ignore injected languages (default + true) Return: ~ - |TSNode||nil under the cursor + |TSNode| | nil Node at the given position get_node_range({node_or_range}) *vim.treesitter.get_node_range()* Returns the node's range or an unpacked range table -- cgit From b496605fea0117b517a47f0f300e2161ac75dcc0 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 10 Jan 2023 15:49:39 +0100 Subject: docs: vim_diff.txt --- runtime/doc/news.txt | 4 +- runtime/doc/vim_diff.txt | 239 ++++++++++++++++++++++++----------------------- 2 files changed, 124 insertions(+), 119 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 8b41f2d104..c6588fdeab 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -13,7 +13,7 @@ BREAKING CHANGES *news-breaking* The following changes may require adaptations in user config or plugins. -• Cscope support is now removed (see |cscope| and |nvim-features-removed|): +• Cscope support is now removed (see |cscope| and |nvim-removed|): - Commands removed: - `:cscope` - `:lcscope` @@ -34,7 +34,7 @@ The following changes may require adaptations in user config or plugins. See https://github.com/neovim/neovim/pull/20545 for more information. -• `:hardcopy` is now removed (see |hardcopy| and |nvim-features-removed|): +• `:hardcopy` is now removed (see |hardcopy| and |nvim-removed|): - Commands removed: - `:hardcopy` - Options removed: diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 97fc211c36..b274c02945 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -13,7 +13,7 @@ centralized reference of the differences. Type |gO| to see the table of contents. ============================================================================== -1. Configuration *nvim-config* +Configuration *nvim-config* - Use `$XDG_CONFIG_HOME/nvim/init.vim` instead of `.vimrc` for your |config|. - Use `$XDG_CONFIG_HOME/nvim` instead of `.vim` to store configuration files. @@ -21,7 +21,7 @@ centralized reference of the differences. session information. |shada| ============================================================================== -2. Defaults *nvim-defaults* +Defaults *nvim-defaults* - Filetype detection is enabled by default. This can be disabled by adding ":filetype off" to |init.vim|. @@ -78,7 +78,7 @@ centralized reference of the differences. - |g:vimsyn_embed| defaults to "l" to enable Lua highlighting -Default Mouse ~ +DEFAULT MOUSE *default-mouse* *disable-mouse* By default the mouse is enabled, and opens a |popup-menu| with standard actions ("Cut", "Copy", "Paste", …). Mouse is NOT enabled in @@ -102,7 +102,7 @@ To remove the "How-to disable mouse" menu item and the separator above it: >vim aunmenu PopUp.How-to\ disable\ mouse aunmenu PopUp.-1- < -Default Mappings ~ +DEFAULT MAPPINGS *default-mappings* Nvim creates the following default mappings at |startup|. You can disable any of these in your config by simply removing the mapping, e.g. ":unmap Y". @@ -115,7 +115,7 @@ of these in your config by simply removing the mapping, e.g. ":unmap Y". xnoremap # y?\V" nnoremap & :&& < -Default Autocommands ~ +DEFAULT AUTOCOMMANDS *default-autocmds* Default autocommands exist in the following groups. Use ":autocmd! {group}" to remove them and ":autocmd {group}" to see how they're defined. @@ -127,35 +127,36 @@ nvim_cmdwin: - CmdwinEnter: Limits syntax sync to maxlines=1 in the |cmdwin|. ============================================================================== -3. New Features *nvim-features* +New Features *nvim-features* MAJOR COMPONENTS -API |API| -Job control |job-control| -LSP framework |lsp| -Lua scripting |lua| -Parsing engine |treesitter| -Providers - Clipboard |provider-clipboard| - Node.js plugins |provider-nodejs| - Python plugins |provider-python| - Ruby plugins |provider-ruby| -Remote plugins |remote-plugin| -Shared data |shada| -Terminal emulator |terminal| -Vimscript parser |nvim_parse_expression()| -XDG base directories |xdg| +- API |API| +- Job control |job-control| +- LSP framework |lsp| +- Lua scripting |lua| +- Parsing engine |treesitter| +- Providers + - Clipboard |provider-clipboard| + - Node.js plugins |provider-nodejs| + - Python plugins |provider-python| + - Ruby plugins |provider-ruby| +- Remote plugins |remote-plugin| +- Shared data |shada| +- Terminal emulator |terminal| +- UI |ui| |--listen| |--server| +- Vimscript parser |nvim_parse_expression()| +- XDG base directories |xdg| USER EXPERIENCE Working intuitively and consistently is a major goal of Nvim. *feature-compile* -- Nvim always includes ALL features, in contrast to Vim (which ships with - various combinations of 100+ optional features). Think of it as a leaner - version of Vim's "HUGE" build. This reduces surface area for bugs, and - removes a common source of confusion and friction for users. +- Nvim always includes ALL features, in contrast to Vim (which ships various + combinations of 100+ optional features). |feature-compile| Think of it as + a leaner version of Vim's "HUGE" build. This reduces surface area for bugs, + and removes a common source of confusion and friction for users. - Nvim avoids features that cannot be provided on all platforms; instead that is delegated to external plugins/extensions. E.g. the `-X` platform-specific @@ -173,6 +174,7 @@ backwards-compatibility cost. Some examples: - Directories for 'directory' and 'undodir' are auto-created. - Terminal features such as 'guicursor' are enabled where possible. +- Various "nvim" |cli-arguments| were redesigned. Some features are built in that otherwise required external plugins: @@ -180,6 +182,11 @@ Some features are built in that otherwise required external plugins: ARCHITECTURE +The Nvim UI is "decoupled" from the core editor: all UIs, including the +builtin |TUI| are just plugins that connect to a Nvim server (via |--server| +or |--embed|). Multiple Nvim UI clients can connect to the same Nvim editor +server. + External plugins run in separate processes. |remote-plugin| This improves stability and allows those plugins to work without blocking the editor. Even "legacy" Python and Ruby plugins which use the old Vim interfaces (|if_pyth|, @@ -191,7 +198,7 @@ by Nvim developers. FEATURES -Command-line highlighting: +Command-line: The expression prompt (|@=|, |c_CTRL-R_=|, |i_CTRL-R_=|) is highlighted using a built-in Vimscript expression parser. |expr-highlight| *E5408* *E5409* @@ -253,34 +260,105 @@ Input/Mappings: Normal commands: |gO| shows a filetype-defined "outline" of the current buffer. + |Q| replays the last recorded macro instead of switching to Ex mode (|gQ|). Options: 'cpoptions' flags: |cpo-_| - 'guicursor' works in the terminal + 'diffopt' "linematch" feature + 'exrc' searches for ".nvim.lua", ".nvimrc", or ".exrc" files. The + user is prompted whether to trust the file. 'fillchars' flags: "msgsep", "horiz", "horizup", "horizdown", "vertleft", "vertright", "verthoriz" 'foldcolumn' supports up to 9 dynamic/fixed columns + 'guicursor' works in the terminal (TUI) 'inccommand' shows interactive results for |:substitute|-like commands and |:command-preview| commands + 'jumpoptions' "stack" behavior + 'jumpoptions' "view" tries to restore the |mark-view| when moving through + the |jumplist|, |changelist|, |alternate-file| or using |mark-motions|. 'laststatus' global statusline support 'mousescroll' amount to scroll by when scrolling with a mouse 'pumblend' pseudo-transparent popupmenu 'scrollback' + 'shortmess' "F" flag does not affect output from autocommands 'signcolumn' supports up to 9 dynamic/fixed columns + 'statuscolumn' full control of columns using 'statusline' format + 'statusline' supports unlimited alignment sections 'tabline' %@Func@foo%X can call any function on mouse-click + 'ttimeout', 'ttimeoutlen' behavior was simplified 'winblend' pseudo-transparency in floating windows |api-floatwin| 'winhighlight' window-local highlights - 'diffopt' has the option `linematch`. + +Providers: + If a Python interpreter is available on your `$PATH`, |:python| and + |:python3| are always available. See |provider-python|. + +Shell: + Shell output (|:!|, |:make|, …) is always routed through the UI, so it + cannot "mess up" the screen. (You can still use "chansend(v:stderr,…)" if + you want to mess up the screen :) + + Nvim throttles (skips) messages from shell commands (|:!|, |:grep|, |:make|) + if there is too much output. No data is lost, this only affects display and + improves performance. |:terminal| output is never throttled. + + |:!| does not support "interactive" commands. Use |:terminal| instead. + (GUI Vim has a similar limitation, see ":help gui-pty" in Vim.) + + :!start is not special-cased on Windows. + + |system()| does not support writing/reading "backgrounded" commands. |E5677| Signs: Signs are removed if the associated line is deleted. +Startup: + |-e| and |-es| invoke the same "improved Ex mode" as -E and -Es. + |-E| and |-Es| read stdin as text (into buffer 1). + |-es| and |-Es| have improved behavior: + - Quits automatically, don't need "-c qa!". + - Skips swap-file dialog. + |-s| reads Normal commands from stdin if the script name is "-". + Reading text (instead of commands) from stdin |--|: + - works by default: "-" file is optional + - works in more cases: |-Es|, file args + +TUI: + *:set-termcap* + Start Nvim with 'verbose' level 3 to show terminal capabilities: > + nvim -V3 +< + *'term'* *E529* *E530* *E531* + 'term' reflects the terminal type derived from |$TERM| and other environment + checks. For debugging only; not reliable during startup. >vim + :echo &term +< "builtin_x" means one of the |builtin-terms| was chosen, because the expected + terminfo file was not found on the system. + + Nvim will use 256-colour capability on Linux virtual terminals. Vim uses + only 8 colours plus bright foreground on Linux VTs. + + Vim combines what is in its |builtin-terms| with what it reads from terminfo, + and has a 'ttybuiltin' setting to control how that combination works. Nvim + uses one or the other, it does not attempt to merge the two. + +UI/Display: + |Visual| selection highlights the character at cursor. |visual-use| + + messages: When showing messages longer than 'cmdheight', only + scroll the message lines, not the entire screen. The + separator line is decorated by |hl-MsgSeparator| and + the "msgsep" flag of 'fillchars'. *msgsep* + Variables: |v:progpath| is always absolute ("full") |v:windowid| is always available (for use by external UIs) +Vimscript: + |:redir| nested in |execute()| works. + ============================================================================== -4. Upstreamed features *nvim-upstreamed* +Upstreamed features *nvim-upstreamed* These Nvim features were later integrated into Vim. @@ -294,17 +372,9 @@ These Nvim features were later integrated into Vim. - 'statusline' supports unlimited alignment sections ============================================================================== -5. Changed features *nvim-features-changed* - -Nvim always builds with all features, in contrast to Vim which may have -certain features removed/added at compile-time. |feature-compile| - -Some Vim features were changed in Nvim, and vice versa. +Changed features *nvim-changed* -If a Python interpreter is available on your `$PATH`, |:python| and |:python3| -are always available and may be used simultaneously. See |provider-python|. - -|:redir| nested in |execute()| works. +This section lists various low-level details about other behavior changes. |mkdir()| behaviour changed: 1. Assuming /tmp/foo does not exist and /tmp can be written to @@ -345,7 +415,7 @@ are always available and may be used simultaneously. See |provider-python|. |json_encode()| behaviour slightly changed: now |msgpack-special-dict| values are accepted, but |v:none| is not. -Viminfo text files were replaced with binary (messagepack) ShaDa files. +Viminfo text files were replaced with binary (messagepack) |shada| files. Additional differences: - |shada-c| has no effect. @@ -387,7 +457,7 @@ Commands: |:wincmd| accepts a count. `:write!` does not show a prompt if the file was updated externally. -Command line completion: +Command-line: The meanings of arrow keys do not change depending on 'wildoptions'. Functions: @@ -424,46 +494,6 @@ Mappings: Motion: The |jumplist| avoids useless/phantom jumps. -Normal commands: - |Q| replays the last recorded macro instead of switching to Ex mode. - Instead |gQ| can be used to enter Ex mode. - -Options: - 'ttimeout', 'ttimeoutlen' behavior was simplified - 'jumpoptions' "stack" behavior - 'jumpoptions' "view" tries to restore the |mark-view| when moving through - the |jumplist|, |changelist|, |alternate-file| or using |mark-motions|. - 'shortmess' the "F" flag does not affect output from autocommands - 'exrc' searches for ".nvim.lua", ".nvimrc", or ".exrc" files. The user is - prompted whether to trust the file. - -Shell: - Shell output (|:!|, |:make|, …) is always routed through the UI, so it - cannot "mess up" the screen. (You can still use "chansend(v:stderr,…)" if - you want to mess up the screen :) - - Nvim throttles (skips) messages from shell commands (|:!|, |:grep|, |:make|) - if there is too much output. No data is lost, this only affects display and - improves performance. |:terminal| output is never throttled. - - |:!| does not support "interactive" commands. Use |:terminal| instead. - (GUI Vim has a similar limitation, see ":help gui-pty" in Vim.) - - :!start is not special-cased on Windows. - - |system()| does not support writing/reading "backgrounded" commands. |E5677| - -Startup: - |-e| and |-es| invoke the same "improved Ex mode" as -E and -Es. - |-E| and |-Es| read stdin as text (into buffer 1). - |-es| and |-Es| have improved behavior: - - Quits automatically, don't need "-c qa!". - - Skips swap-file dialog. - |-s| reads Normal commands from stdin if the script name is "-". - Reading text (instead of commands) from stdin |--|: - - works by default: "-" file is optional - - works in more cases: |-Es|, file args - Syntax highlighting: syncolor.vim has been removed. Nvim now sets up default highlighting groups automatically for both light and dark backgrounds, regardless of whether or @@ -472,40 +502,13 @@ Syntax highlighting: after/syntax/syncolor.vim file should transition that file into a colorscheme. |:colorscheme| -TUI: - *:set-termcap* - Start Nvim with 'verbose' level 3 to show terminal capabilities: > - nvim -V3 -< - *'term'* *E529* *E530* *E531* - 'term' reflects the terminal type derived from |$TERM| and other environment - checks. For debugging only; not reliable during startup. >vim - :echo &term -< "builtin_x" means one of the |builtin-terms| was chosen, because the expected - terminfo file was not found on the system. - - Nvim will use 256-colour capability on Linux virtual terminals. Vim uses - only 8 colours plus bright foreground on Linux VTs. - - Vim combines what is in its |builtin-terms| with what it reads from terminfo, - and has a 'ttybuiltin' setting to control how that combination works. Nvim - uses one or the other, it does not attempt to merge the two. - -UI/Display: - |Visual| selection highlights the character at cursor. |visual-use| - - messages: When showing messages longer than 'cmdheight', only - scroll the message lines, not the entire screen. The - separator line is decorated by |hl-MsgSeparator| and - the "msgsep" flag of 'fillchars'. *msgsep* - Vimscript compatibility: `count` does not alias to |v:count| `errmsg` does not alias to |v:errmsg| `shell_error` does not alias to |v:shell_error| `this_session` does not alias to |v:this_session| -Working directory (Vim implemented some of these later than Nvim): +Working directory (Vim implemented some of these after Nvim): - |DirChanged| and |DirChangedPre| can be triggered when switching to another window or tab. - |getcwd()| and |haslocaldir()| may throw errors if the tab page or window @@ -516,20 +519,15 @@ Working directory (Vim implemented some of these later than Nvim): working directory. Use `getcwd(-1, -1)` to get the global working directory. ============================================================================== -6. Missing legacy features *nvim-features-missing* - -Some legacy Vim features are not yet implemented: +Missing legacy features *nvim-missing* -- *if_lua* : Nvim |Lua| API is not compatible with Vim's "if_lua" -- *if_mzscheme* -- |if_pyth|: *python-bindeval* *python-Function* are not supported -- *if_tcl* +These legacy Vim features are not yet implemented: *:gui* *:gvim* ============================================================================== -7. Removed features *nvim-features-removed* +Removed legacy features *nvim-removed* These Vim features were intentionally removed from Nvim. @@ -687,6 +685,13 @@ Options: Performance: Folds are not updated during insert-mode. +Providers: + +- *if_lua* : Nvim |Lua| API is not compatible with Vim's "if_lua". +- *if_mzscheme* +- |if_pyth|: *python-bindeval* *python-Function* are not supported. +- *if_tcl* + Startup: --literal (file args are always literal; to expand wildcards on Windows, use |:n| e.g. `nvim +"n *"`) -- cgit From 0b36145c696fb58e002169edd4f9a1d9a8176fc3 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Wed, 22 Feb 2023 16:23:24 +0100 Subject: docs: mention getmousepos() for click execute function label close #18741 close #11312 --- runtime/doc/options.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index d13ab8c393..2260cd8377 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -6199,6 +6199,8 @@ A jump table for the options with a short description can be found at |Q_op|. is a bug that denotes that new mouse button recognition was added without modifying code that reacts on mouse clicks on this label. + Use |getmousepos()|.winid in the specified function to get the + corresponding window id of the clicked item. < - Where to truncate line if too long. Default is at the start. No width fields allowed. = - Separation point between alignment sections. Each section will -- cgit From 6752f1005d26c93a033d856a60b7b296f3e51634 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 14 Dec 2022 19:58:18 +0100 Subject: docs: naming conventions, guidelines close #21063 --- runtime/doc/api.txt | 57 ++++++------- runtime/doc/develop.txt | 191 ++++++++++++++++++++++++++----------------- runtime/doc/editing.txt | 41 +++++----- runtime/doc/editorconfig.txt | 24 +++--- runtime/doc/lua-guide.txt | 6 +- runtime/doc/lua.txt | 63 ++++++-------- runtime/doc/options.txt | 37 ++++----- runtime/doc/support.txt | 6 +- runtime/doc/ui.txt | 3 + runtime/doc/vim_diff.txt | 1 + 10 files changed, 220 insertions(+), 209 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 7bcae79852..3ca50dda15 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -1461,16 +1461,15 @@ nvim_set_keymap({mode}, {lhs}, {rhs}, {*opts}) *nvim_set_keymap()* "!" for |:map!|, or empty string for |:map|. • {lhs} Left-hand-side |{lhs}| of the mapping. • {rhs} Right-hand-side |{rhs}| of the mapping. - • {opts} Optional parameters map: keys are |:map-arguments|, values are - booleans (default false). Accepts all |:map-arguments| as keys - excluding || but including |:noremap| and "desc". - Unknown key is an error. "desc" can be used to give a - description to the mapping. When called from Lua, also accepts - a "callback" key that takes a Lua function to call when the - mapping is executed. When "expr" is true, "replace_keycodes" - (boolean) can be used to replace keycodes in the resulting - string (see |nvim_replace_termcodes()|), and a Lua callback - returning `nil` is equivalent to returning an empty string. + • {opts} Optional parameters map: Accepts all |:map-arguments| as keys + except ||, values are booleans (default false). Also: + • "noremap" non-recursive mapping |:noremap| + • "desc" human-readable description. + • "callback" Lua function called when the mapping is executed. + • "replace_keycodes" (boolean) When "expr" is true, replace + keycodes in the resulting string (see + |nvim_replace_termcodes()|). Returning nil from the Lua + "callback" is equivalent to returning an empty string. nvim_set_var({name}, {value}) *nvim_set_var()* Sets a global (g:) variable. @@ -1678,7 +1677,7 @@ Command Functions *api-command* *nvim_buf_create_user_command()* nvim_buf_create_user_command({buffer}, {name}, {command}, {*opts}) - Create a new user command |user-commands| in the given buffer. + Creates a buffer-local command |user-commands|. Parameters: ~ • {buffer} Buffer handle, or 0 for current buffer. @@ -1743,15 +1742,12 @@ nvim_cmd({*cmd}, {*opts}) *nvim_cmd()* *nvim_create_user_command()* nvim_create_user_command({name}, {command}, {*opts}) - Create a new user command |user-commands| + Creates a global |user-commands| command. - {name} is the name of the new command. The name must begin with an - uppercase letter. - - {command} is the replacement text or Lua function to execute. + For Lua usage see |lua-guide-commands-create|. Example: >vim - :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {}) + :call nvim_create_user_command('SayHello', 'echo "Hello world!"', {'bang': v:true}) :SayHello Hello world! < @@ -1783,19 +1779,20 @@ nvim_create_user_command({name}, {command}, {*opts}) • smods: (table) Command modifiers in a structured format. Has the same structure as the "mods" key of |nvim_parse_cmd()|. - • {opts} Optional command attributes. See |command-attributes| for - more details. To use boolean attributes (such as - |:command-bang| or |:command-bar|) set the value to "true". - In addition to the string options listed in - |:command-complete|, the "complete" key also accepts a Lua - function which works like the "customlist" completion mode - |:command-completion-customlist|. Additional parameters: - • desc: (string) Used for listing the command when a Lua - function is used for {command}. - • force: (boolean, default true) Override any previous - definition. - • preview: (function) Preview callback for 'inccommand' - |:command-preview| + • {opts} Optional |command-attributes|. + • Set boolean attributes such as |:command-bang| or + |:command-bar| to true (but not |:command-buffer|, use + |nvim_buf_create_user_command()| instead). + • "complete" |:command-complete| also accepts a Lua + function which works like + |:command-completion-customlist|. + • Other parameters: + • desc: (string) Used for listing the command when a Lua + function is used for {command}. + • force: (boolean, default true) Override any previous + definition. + • preview: (function) Preview callback for 'inccommand' + |:command-preview| nvim_del_user_command({name}) *nvim_del_user_command()* Delete a user-defined command. diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt index 87190d7f33..b090fd4f09 100644 --- a/runtime/doc/develop.txt +++ b/runtime/doc/develop.txt @@ -132,6 +132,18 @@ DOCUMENTATION *dev-doc* optimize for the reader's time and energy: be "precise yet concise". - See https://developers.google.com/style/tone - Prefer the active voice: "Foo does X", not "X is done by Foo". +- Start function docstrings with present tense ("Gets"), not imperative + ("Get"). This tends to reduce ambiguity and improve clarity. > + GOOD: + /// Gets a highlight definition. + BAD: + /// Get a highlight definition. +- Avoid starting docstrings with "The" or "A" unless needed to avoid + ambiguity. This is a visual aid and reduces noise. > + GOOD: + /// @param dirname Path fragment before `pend` + BAD: + /// @param dirname The path fragment before `pend` - Vim differences: - Do not prefix help tags with "nvim-". Use |vim_diff.txt| to catalog differences from Vim; no other distinction is necessary. @@ -143,13 +155,6 @@ DOCUMENTATION *dev-doc* not "the user host terminal". - Use "tui-" to prefix help tags related to the host terminal, and "TUI" in prose if possible. -- Docstrings: do not start parameter descriptions with "The" or "A" unless it - is critical to avoid ambiguity. > - GOOD: - /// @param dirname Path fragment before `pend` - BAD: - /// @param dirname The path fragment before `pend` -< Documentation format ~ @@ -159,14 +164,14 @@ https://neovim.io/doc/user ). Strict "vimdoc" subset: -- Use lists (like this!) prefixed with "-", "*", or "•", for adjacent lines - that you don't want auto-wrapped. Lists are always rendered with "flow" - (soft-wrapped) layout instead of preformatted (hard-wrapped) layout common - in legacy :help docs. +- Use lists (like this!) prefixed with "-" or "•", for adjacent lines that you + don't want to auto-wrap. Lists are always rendered with "flow" layout + (soft-wrapped) instead of preformatted (hard-wrapped) layout common in + legacy :help docs. - Limitation: currently the parser https://github.com/neovim/tree-sitter-vimdoc does not understand numbered listitems, so use a bullet symbol (- or •) - before numbered items, e.g. "- 1." instead of "1.". -- Separate blocks (paragraphs) of content by a blank line(s). + before numbered items, e.g. "• 1." instead of "1.". +- Separate blocks (paragraphs) of content by a blank line. - Do not use indentation in random places—that prevents the page from using "flow" layout. If you need a preformatted section, put it in a |help-codeblock| starting with ">". @@ -246,7 +251,9 @@ vim.paste in runtime/lua/vim/_editor.lua like this: > ---@returns false if client should cancel the paste. -LUA *dev-lua* +LUA STDLIB DESIGN GUIDELINES *dev-lua* + +See also |dev-naming|. - Keep the core Lua modules |lua-stdlib| simple. Avoid elaborate OOP or pseudo-OOP designs. Plugin authors just want functions to call, not a big, @@ -255,10 +262,26 @@ LUA *dev-lua* tables or values are easier to serialize, easier to construct from literals, easier to inspect and print, and inherently compatible with all Lua plugins. (This guideline doesn't apply to opaque, non-data objects like `vim.cmd`.) - - -API *dev-api* - +- stdlib functions should follow these common patterns: + - accept iterable instead of table + - exception: in some cases iterable doesn't make sense, e.g. spair() sorts + the input by definition, so there is no reason for it to accept an + iterable, because the input needs to be "hydrated", it can't operate on + a "stream". + - return iterable instead of table + - mimic the pairs() or ipairs() interface if the function is intended to be + used in a "for" loop. + + +API DESIGN GUIDELINES *dev-api* + +See also |dev-naming|. + +- When adding an API, check the following: + - What precedents did you draw from? How does your solution compare to them? + - Does your new API allow future expansion? How? Or why not? + - Is the new API similar to existing APIs? Do we need to deprecate the old ones? + - Did you cross-reference related concepts in the docs? - Avoid "mutually exclusive" parameters--via constraints or limitations, if necessary. For example nvim_create_autocmd() has mutually exclusive "callback" and "command" args; but the "command" arg could be eliminated by @@ -266,66 +289,95 @@ API *dev-api* "callback" arg as an Ex command (which can call Vimscript functions). The "buffer" arg could also be eliminated by treating a number "pattern" as a buffer number. +- Avoid functions that depend on cursor position, current buffer, etc. Instead + the function should take a position parameter, buffer parameter, etc. - *dev-api-naming* -Use this format to name new RPC |API| functions: +NAMING GUIDELINES *dev-naming* - nvim_{thing}_{action}_{arbitrary-qualifiers} +Naming is exceedingly important: the name of a thing is the primary interface +for uses it, discusses it, searches for it, shares it... Consistent +naming in the stdlib, API, and UI helps both users and developers discover and +intuitively understand related concepts ("families"), and reduces cognitive +burden. Discoverability encourages code re-use and likewise avoids redundant, +overlapping mechanisms, which reduces code surface-area, and thereby minimizes +bugs... -If the function acts on an object then {thing} is the name of that object -(e.g. "buf" or "win"). If the function operates in a "global" context then -{thing} is usually omitted (but consider "namespacing" your global operations -with a {thing} that groups functions under a common concept). - -Use existing common {action} names if possible: - - add Append to, or insert into, a collection - - call Call a function - - create Create a new (non-trivial) thing - - del Delete a thing (or group of things) - - eval Evaluate an expression - - exec Execute code - - fmt Format - - get Get things (often by a query) - - open Open - - parse Parse something into a structured form - - set Set a thing (or group of things) +Naming conventions ~ + +In general, look for precedent when choosing a name, that is, look at existing +(non-deprecated) functions. In particular, see below... + + *dev-name-common* +Use existing common {verb} names (actions) if possible: + - add: Appends or inserts into a collection + - attach: Listens to something to get events from it (TODO: rename to "on"?) + - call: Calls a function + - clear: Clears state but does not destroy the container + - create: Creates a new (non-trivial) thing (TODO: rename to "def"?) + - del: Deletes a thing (or group of things) + - detach: Dispose attached listener (TODO: rename to "un"?) + - eval: Evaluates an expression + - exec: Executes code + - fmt: Formats + - get: Gets things (often by a query) + - inspect: Presents a high-level, often interactive, view + - open: Opens something (a buffer, window, …) + - parse: Parses something into a structured form + - set: Sets a thing (or group of things) + - try_{verb}: Best-effort operation, failure returns null or error obj Do NOT use these deprecated verbs: - - list Redundant with "get" + - list: Redundant with "get" + - show: Redundant with "print", "echo" + - notify: Redundant with "print", "echo" -Use consistent names for {thing} (nouns) in API functions: buffer is called +Use consistent names for {noun} (nouns) in API functions: buffer is called "buf" everywhere, not "buffer" in some places and "buf" in others. - - buf Buffer - - chan |channel| - - cmd Command - - cmdline Command-line UI or input - - fn Function - - hl Highlight - - pos Position - - proc System process - - tabpage Tabpage - - win Window + - buf: Buffer + - chan: |channel| + - cmd: Command + - cmdline: Command-line UI or input + - fn: Function + - hl: Highlight + - pos: Position + - proc: System process + - tabpage: Tabpage + - win: Window Do NOT use these deprecated nouns: - buffer - command - window -Example: - `nvim_get_keymap('v')` operates in a global context (first parameter is not - a Buffer). The "get" {action} indicates that it gets anything matching the - given filter parameter. There is no need for a "list" action because - `nvim_get_keymap('')` (i.e., empty filter) returns all items. + *dev-name-events* +Use the "on_" prefix to name event-handling callbacks and also the interface for +"registering" such handlers (on_key). The dual nature is acceptable to avoid +a confused collection of naming conventions for these related concepts. + +Editor |events| (autocommands) are historically named like: > + {Noun}{Event} + +Use this format to name API (RPC) events: > + nvim_{noun}_{event-name}_event -Example: - `nvim_buf_del_mark` acts on a `Buffer` object (the first parameter) - and uses the "del" {action}. +Example: > + nvim_buf_changedtick_event +< + *dev-name-api* +Use this format to name new RPC |API| functions: > + nvim_{noun}_{verb}_{arbitrary-qualifiers} -Use this format to name new API events: - nvim_{thing}_{event}_event +If the function acts on an object then {noun} is the name of that object +(e.g. "buf" or "win"). If the function operates in a "global" context then +{noun} is usually omitted (but consider "namespacing" your global operations +with a {noun} that groups functions under a common concept). -Example: - `nvim_buf_changedtick_event` +- Example: `nvim_get_keymap('v')` operates in a global context (first + parameter is not a Buffer). The "get" verb indicates that it gets anything + matching the given filter parameter. A "list" verb is unnecessary because + `nvim_get_keymap('')` (empty filter) returns all items. +- Example: `nvim_buf_del_mark` acts on a `Buffer` object (the first parameter) + and uses the "del" {verb}. API-CLIENT *dev-api-client* @@ -417,19 +469,4 @@ External UIs are expected to implement these common features: published in this event. See also "mouse_on", "mouse_off". -NAMING *dev-naming* - -Naming is important. Consistent naming in the API and UI helps both users and -developers discover and intuitively understand related concepts ("families"), -and reduces cognitive burden. Discoverability encourages code re-use and -likewise avoids redundant, overlapping mechanisms, which reduces code -surface-area, and thereby minimizes bugs... - -Naming conventions ~ - -Use the "on_" prefix to name event handlers and also the interface for -"registering" such handlers (on_key). The dual nature is acceptable to avoid -a confused collection of naming conventions for these related concepts. - - vim:tw=78:ts=8:sw=4:et:ft=help:norl: diff --git a/runtime/doc/editing.txt b/runtime/doc/editing.txt index f77db5fab3..bd1b62635e 100644 --- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1668,29 +1668,26 @@ There are three different types of searching: ============================================================================== 12. Trusted Files *trust* -Nvim has the ability to execute arbitrary code through the 'exrc' option. In -order to prevent executing code from untrusted sources, Nvim has the concept of -"trusted files". An untrusted file will not be executed without the user's -consent, and a user can permanently mark a file as trusted or untrusted using -the |:trust| command or the |vim.secure.read()| function. +Nvim executes arbitrary code found on the filesystem if 'exrc' is enabled. To +prevent executing malicious code, only "trusted files" are executed. You can +mark a file as trusted or untrusted using the |:trust| command or the +|vim.secure.read()| function. *:trust* *E5570* -:trust [++deny] [++remove] [{file}] - - Manage files in the trust database. Without any options - or arguments, :trust adds the file associated with the - current buffer to the trust database, along with the - SHA256 hash of its contents. - - [++deny] marks the file associated with the current - buffer (or {file}, if given) as denied; no prompts will - be displayed to the user and the file will never be - executed. - - [++remove] removes the file associated with the current - buffer (or {file}, if given) from the trust database. - Future attempts to read the file in a secure setting - (i.e. with 'exrc' or |vim.secure.read()|) will prompt - the user if the file is trusted. +:trust [++deny] [++remove] [file] + + Manage trusted files. Without ++ options, :trust marks + [file] (or current buffer if no [file]) as trusted, + keyed on a hash of its contents. The trust list is + stored on disk, Nvim will re-use it after restarting. + + [++deny] marks [file] (or current buffer if no [file]) as + untrusted: it will never be executed, 'exrc' will + ignore it. + + [++remove] removes [file] (or current buffer if no + [file]) from the trust list. When the file is + discovered by 'exrc' or |vim.secure.read()|, the user + will be asked whether to trust or deny the file. vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/editorconfig.txt b/runtime/doc/editorconfig.txt index 04a057e5ff..52fd860d2d 100644 --- a/runtime/doc/editorconfig.txt +++ b/runtime/doc/editorconfig.txt @@ -6,25 +6,21 @@ 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/. +Nvim supports EditorConfig. When a file is opened, 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 integration can be disabled globally by adding >lua +EditorConfig is enabled by default. To disable it, add to your config: >lua vim.g.editorconfig = false < -to the user's |init.lua| file (or the Vimscript equivalent to |init.vim|). It -can also be disabled per-buffer by setting the |b:editorconfig| buffer-local -variable to `false`. +(Vimscript: `let g:editorconfig = v:false`). It can also be disabled +per-buffer by setting the |b:editorconfig| buffer-local variable to `false`. -When Nvim finds a valid .editorconfig file it will store the applied -properties in the buffer variable |b:editorconfig| if it was not already set to -`false` by the user. +Nvim stores the applied properties in |b:editorconfig| if it is not `false`. *editorconfig-properties* The following properties are supported by default: @@ -88,4 +84,4 @@ Example: >lua vim.b[bufnr].foo = val end < - vim:tw=78:ts=8:noet:ft=help:norl: + vim:tw=78:ts=8:et:sw=4:ft=help:norl: diff --git a/runtime/doc/lua-guide.txt b/runtime/doc/lua-guide.txt index b971a7d2ad..236905a077 100644 --- a/runtime/doc/lua-guide.txt +++ b/runtime/doc/lua-guide.txt @@ -657,7 +657,7 @@ See also • |nvim_exec_autocmds()|: execute all matching autocommands ============================================================================== -User commands *lua-guide-usercommands* +User commands *lua-guide-commands* |user-commands| are custom Vim commands that call a Vimscript or Lua function. Just like built-in commands, they can have arguments, act on ranges, or have @@ -665,7 +665,7 @@ custom completion of arguments. As these are most useful for plugins, we will cover only the basics of this advanced topic. ------------------------------------------------------------------------------ -Creating user commands *lua-guide-usercommands-create* +Creating user commands *lua-guide-commands-create* User commands can be created through the Neovim API with `vim.api.`|nvim_create_user_command()|. This function takes three mandatory @@ -734,7 +734,7 @@ the remaining arguments are the same as for |nvim_create_user_command()|: { nargs = 1 }) < ------------------------------------------------------------------------------ -Deleting user commands *lua-guide-usercommands-delete* +Deleting user commands *lua-guide-commands-delete* User commands can be deleted with `vim.api.`|nvim_del_user_command()|. The only argument is the name of the command: diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 0472c11a15..32e89bd237 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2029,7 +2029,8 @@ uri_to_fname({uri}) *vim.uri_to_fname()* Lua module: ui *lua-ui* input({opts}, {on_confirm}) *vim.ui.input()* - Prompts the user for input + Prompts the user for input, allowing arbitrary (potentially asynchronous) + work until `on_confirm`. Example: >lua @@ -2054,7 +2055,8 @@ input({opts}, {on_confirm}) *vim.ui.input()* entered), or `nil` if the user aborted the dialog. select({items}, {opts}, {on_choice}) *vim.ui.select()* - Prompts the user to pick a single item from a collection of entries + Prompts the user to pick from a list of items, allowing arbitrary + (potentially asynchronous) work until `on_choice`. Example: >lua @@ -2253,57 +2255,38 @@ del({modes}, {lhs}, {opts}) *vim.keymap.del()* |vim.keymap.set()| set({mode}, {lhs}, {rhs}, {opts}) *vim.keymap.set()* - Add a new |mapping|. Examples: >lua + Adds a new |mapping|. Examples: >lua - -- Can add mapping to Lua functions + -- Map to a Lua function: vim.keymap.set('n', 'lhs', function() print("real lua function") end) - - -- Can use it to map multiple modes + -- Map to multiple modes: vim.keymap.set({'n', 'v'}, 'lr', vim.lsp.buf.references, { buffer=true }) - - -- Can add mapping for specific buffer + -- Buffer-local mapping: vim.keymap.set('n', 'w', "w", { silent = true, buffer = 5 }) - - -- Expr mappings + -- Expr mapping: vim.keymap.set('i', '', function() return vim.fn.pumvisible() == 1 and "" or "" end, { expr = true }) - -- mappings + -- mapping: vim.keymap.set('n', '[%', '(MatchitNormalMultiBackward)') < - Note that in a mapping like: >lua - - vim.keymap.set('n', 'asdf', require('jkl').my_fun) -< - - the `require('jkl')` gets evaluated during this call in order to access the function. If you - want to avoid this cost at startup you can wrap it in a function, for - example: >lua - - vim.keymap.set('n', 'asdf', function() return require('jkl').my_fun() end) -< - Parameters: ~ - • {mode} string|table Same mode short names as |nvim_set_keymap()|. Can + • {mode} string|table Mode short-name, see |nvim_set_keymap()|. Can also be list of modes to create mapping on multiple modes. • {lhs} (string) Left-hand side |{lhs}| of the mapping. - • {rhs} string|function Right-hand side |{rhs}| of the mapping. Can - also be a Lua function. - • {opts} (table|nil) A table of |:map-arguments|. - • Accepts options accepted by the {opts} parameter in - |nvim_set_keymap()|, with the following notable differences: - • replace_keycodes: Defaults to `true` if "expr" is `true`. - • noremap: Always overridden with the inverse of "remap" - (see below). - - • In addition to those options, the table accepts the - following keys: - • buffer: (number or boolean) Add a mapping to the given - buffer. When `0` or `true`, use the current buffer. - • remap: (boolean) Make the mapping recursive. This is the - inverse of the "noremap" option from |nvim_set_keymap()|. - Defaults to `false`. + • {rhs} string|function Right-hand side |{rhs}| of the mapping, can be + a Lua function. + • {opts} (table|nil) Table of |:map-arguments|. + • Same as |nvim_set_keymap()| {opts}, except: + • "replace_keycodes" defaults to `true` if "expr" is `true`. + • "noremap": inverse of "remap" (see below). + + • Also accepts: + • "buffer" number|boolean Creates buffer-local mapping, `0` + or `true` for current buffer. + • remap: (boolean) Make the mapping recursive. Inverses + "noremap". Defaults to `false`. See also: ~ |nvim_set_keymap()| diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 2260cd8377..f44b6f28e3 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -401,20 +401,15 @@ the system, mostly it is something like 256 or 1024 characters. ============================================================================== 2. Automatically setting options *auto-setting* -Besides changing options with the ":set" command, there are three alternatives -to set options automatically for one or more files: - -1. When starting Vim initializations are read from various places. See - |initialization|. Most of them are performed for all editing sessions, - and some of them depend on the directory where Vim is started. - You can create an initialization file with |:mkvimrc|, |:mkview| and - |:mksession|. -2. If you start editing a new file, the automatic commands are executed. - This can be used to set options for files matching a particular pattern and - many other things. See |autocommand|. -3. If you start editing a new file, and the 'modeline' option is on, a - number of lines at the beginning and end of the file are checked for - modelines. This is explained here. +Besides changing options with the ":set" command, you can set options +automatically in various ways: + +1. With a |config| file or a |startup| argument. You can create an + initialization file with |:mkvimrc|, |:mkview| and |:mksession|. +2. |autocommand|s executed when you edit a file. +3. ".nvim.lua" files in the current directory, if 'exrc' is enabled. +4. |editorconfig| in the current buffer's directory or ancestors. +5. 'modeline' settings found at the beginning or end of the file. See below. *modeline* *vim:* *vi:* *ex:* *E520* There are two forms of modelines. The first form: @@ -2267,15 +2262,13 @@ A jump table for the options with a short description can be found at |Q_op|. *'exrc'* *'ex'* *'noexrc'* *'noex'* 'exrc' 'ex' boolean (default off) global - Enables the reading of .nvim.lua, .nvimrc, and .exrc files in the current - directory. - - The file is only sourced if the user indicates the file is trusted. If - it is, the SHA256 hash of the file contents and the full path of the - file are persisted to a trust database. The user is only prompted - again if the file contents change. See |vim.secure.read()|. + Automatically execute .nvim.lua, .nvimrc, and .exrc files in the + current directory, if the file is in the |trust| list. Use |:trust| to + manage trusted files. See also |vim.secure.read()|. - Use |:trust| to manage the trusted file database. + Compare 'exrc' to |editorconfig|: + - 'exrc' can execute any code; editorconfig only specifies settings. + - 'exrc' is Nvim-specific; editorconfig works in other editors. This option cannot be set from a |modeline| or in the |sandbox|, for security reasons. diff --git a/runtime/doc/support.txt b/runtime/doc/support.txt index 481959d8f1..e4641751f2 100644 --- a/runtime/doc/support.txt +++ b/runtime/doc/support.txt @@ -14,12 +14,16 @@ Supported platforms *supported-platforms* `System` `Tier` `Versions` `Tested versions` Linux 1 >= 2.6.32, glibc >= 2.12 Ubuntu 22.04 macOS (Intel) 1 >= 10.15 macOS 12 -Windows 64-bit 1 >= 8 Windows Server 2019 +Windows 64-bit 1 >= 8 (see note below) Windows Server 2019 FreeBSD 1 >= 10 FreeBSD 13 macOS (M1) 2 >= 10.15 OpenBSD 2 >= 7 MinGW 2 MinGW-w64 +Note: Windows 10 "Version 1809" or later is required for |:terminal|. To check +your Windows version, run the "winver" command and look for "Version xxxx" +(NOT "OS Build"). + Support types ~ * Tier 1: Officially supported and tested with CI. Any contributed patch diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index 4e4f88f275..bb567e021e 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -809,5 +809,8 @@ events, which the UI must handle. Sent when |:messages| command is invoked. History is sent as a list of entries, where each entry is a `[kind, content]` tuple. +["msg_history_clear"] ~ + Clear the |:messages| history. + ============================================================================== vim:tw=78:ts=8:noet:ft=help:norl: diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index b274c02945..79808eccc9 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -72,6 +72,7 @@ Defaults *nvim-defaults* - 'wildmenu' is enabled - 'wildoptions' defaults to "pum,tagfile" +- |editorconfig| plugin is enabled, .editorconfig settings are applied. - |man.lua| plugin is enabled, so |:Man| is available by default. - |matchit| plugin is enabled. To disable it in your config: >vim :let loaded_matchit = 1 -- cgit From 799edca18a4ddcf8edcb63dd391219e01e187f0d Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 28 Nov 2022 22:43:10 +0100 Subject: feat(lua): make sure require'bit' always works, even with PUC lua 5.1 --- runtime/doc/lua.txt | 16 ++++++++++++++++ runtime/doc/news.txt | 1 + 2 files changed, 17 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 32e89bd237..8ae1c6dc40 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -33,6 +33,22 @@ Lua 5.1, not worry about forward-compatibility with future Lua versions. If Nvim ever ships with Lua 5.4+, a Lua 5.1 compatibility shim will be provided so that old plugins continue to work transparently. + *lua-luajit* +Neovim is built with luajit on platforms which support it, which provides +extra functionality. Lua code in |init.lua| and plugins can assume its presence +on installations on common platforms. For maximum compatibility with less +common platforms, availability can be checked using the `jit` global variable: >lua + if jit then + -- code for luajit + else + -- code for plain lua 5.1 + end +< + *lua-bit* +In particular, the luajit "bit" extension module is _always_ available. +A fallback implementation is included when nvim is built with PUC lua 5.1, +and will be transparently used when `require("bit")` is invoked. + ============================================================================== LUA CONCEPTS AND IDIOMS *lua-concepts* diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 6f505a958a..4dee958108 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -167,6 +167,7 @@ The following new APIs or features were added. • |vim.treesitter.language.add()| as a new replacement for `vim.treesitter.language.require_language`. +• `require'bit'` is now always available |lua-bit| ============================================================================== CHANGED FEATURES *news-changes* -- cgit From 1c37553476f268d08d290dfee1fa3da4135b54b4 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 21 Feb 2023 17:00:48 +0100 Subject: test(help): drop treesitter parse error to 0 All parser errors have been fixed; make sure we don't introduce new ones. --- runtime/doc/treesitter. | 0 runtime/doc/treesitter.txt | 4 ++-- 2 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 runtime/doc/treesitter. (limited to 'runtime/doc') diff --git a/runtime/doc/treesitter. b/runtime/doc/treesitter. new file mode 100644 index 0000000000..e69de29bb2 diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 16de49029e..99fe55b6cb 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -528,7 +528,7 @@ get_node_range({node_or_range}) *vim.treesitter.get_node_range()* Returns the node's range or an unpacked range table Parameters: ~ - • {node_or_range} (|TSNode||table) Node or table of positions + • {node_or_range} (|TSNode| | table) Node or table of positions Return: ~ (integer) start_row @@ -1017,7 +1017,7 @@ LanguageTree:named_node_for_range({self}, {range}, {opts}) • {self} Return: ~ - |TSNode||nil Found node + |TSNode| | nil Found node LanguageTree:parse({self}) *LanguageTree:parse()* Parses all defined regions using a treesitter parser for the language this -- cgit From 6dfbeb0d990d24657754463c6ab155c19e7f5f56 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 21 Feb 2023 17:39:29 +0100 Subject: docs: fix more treesitter parsing errors --- runtime/doc/diagnostic.txt | 8 ++++---- runtime/doc/lua-guide.txt | 2 +- runtime/doc/treesitter. | 0 runtime/doc/treesitter.txt | 7 +++---- 4 files changed, 8 insertions(+), 9 deletions(-) delete mode 100644 runtime/doc/treesitter. (limited to 'runtime/doc') diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index 7066a3739a..c661bf02bf 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -40,15 +40,15 @@ requires a namespace. *diagnostic-structure* A diagnostic is a Lua table with the following keys. Required keys are -indicated with (*): +indicated with (+): bufnr: Buffer number - lnum(*): The starting line of the diagnostic + lnum(+): The starting line of the diagnostic end_lnum: The final line of the diagnostic - col(*): The starting column of the diagnostic + col(+): The starting column of the diagnostic end_col: The final column of the diagnostic severity: The severity of the diagnostic |vim.diagnostic.severity| - message(*): The diagnostic text + message(+): The diagnostic text source: The source of the diagnostic code: The diagnostic code user_data: Arbitrary data plugins or users can add diff --git a/runtime/doc/lua-guide.txt b/runtime/doc/lua-guide.txt index 236905a077..8ea84f8c60 100644 --- a/runtime/doc/lua-guide.txt +++ b/runtime/doc/lua-guide.txt @@ -71,7 +71,7 @@ local keyword are not accessible outside of the command. This won't work: < You can also use `:lua=`, which is the same as `:lua vim.pretty_print(...)`, to conveniently check the value of a variable or a table: ->lua +>vim :lua=package < To run a Lua script in an external file, you can use the |:source| command diff --git a/runtime/doc/treesitter. b/runtime/doc/treesitter. deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 99fe55b6cb..3f505e5d19 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -505,8 +505,7 @@ get_captures_at_pos({bufnr}, {row}, {col}) • {col} (integer) Position column Return: ~ - table[] List of captures `{ capture = "capture name", metadata = { ... - } }` + table[] List of captures `{ capture = "name", metadata = { ... } }` get_node({opts}) *vim.treesitter.get_node()* Returns the smallest named node at the given position @@ -838,7 +837,7 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop}) -- typically useful info about the node: local type = node:type() -- type of the captured node local row1, col1, row2, col2 = node:range() -- range of the capture - ... use the info here ... + -- ... use the info here ... end < @@ -871,7 +870,7 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop}) local node_data = metadata[id] -- Node level metadata - ... use the info here ... + -- ... use the info here ... end end < -- cgit From 1df3f5ec6aca24cbe7b78ead5c37ad06a65c84e8 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Thu, 23 Feb 2023 17:05:20 +0000 Subject: feat(treesitter): upstream foldexpr from nvim-treesitter --- runtime/doc/news.txt | 3 +++ runtime/doc/treesitter.txt | 13 +++++++++++++ 2 files changed, 16 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 4dee958108..23bb6d4343 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -168,6 +168,9 @@ The following new APIs or features were added. `vim.treesitter.language.require_language`. • `require'bit'` is now always available |lua-bit| + +• |vim.treesitter.foldexpr()| can be used for 'foldexpr' to use treesitter for folding. + ============================================================================== CHANGED FEATURES *news-changes* diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 3f505e5d19..ccb3c445df 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -481,6 +481,19 @@ library. ============================================================================== Lua module: vim.treesitter *lua-treesitter-core* +foldexpr({lnum}) *vim.treesitter.foldexpr()* + Returns the fold level for {lnum} in the current buffer. Can be set + directly to 'foldexpr': >lua + + vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()' +< + + Parameters: ~ + • {lnum} (integer|nil) Line number to calculate fold level for + + Return: ~ + (string) + *vim.treesitter.get_captures_at_cursor()* get_captures_at_cursor({winnr}) Returns a list of highlight capture names under the cursor -- cgit From 904d0995837a2569ae640f5253da3dd4569fec6f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 24 Feb 2023 15:03:28 +0800 Subject: vim-patch:8.2.2449: Vim9: flatten() always changes the list type Problem: Vim9: flatten() always changes the list type. Solution: Disallow using flatten() and add flattennew(). https://github.com/vim/vim/commit/3b690069730805a147d45d92eaca4dc838272d1d Co-authored-by: Bram Moolenaar --- runtime/doc/builtin.txt | 8 +++++++- runtime/doc/usr_41.txt | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index af5ba9ab8f..5f279ed09c 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -148,6 +148,8 @@ finddir({name} [, {path} [, {count}]]) findfile({name} [, {path} [, {count}]]) String find file {name} in {path} flatten({list} [, {maxdepth}]) List flatten {list} up to {maxdepth} levels +flattennew({list} [, {maxdepth}]) + List flatten a copy of {list} float2nr({expr}) Number convert Float {expr} to a Number floor({expr}) Float round {expr} down fmod({expr1}, {expr2}) Float remainder of {expr1} / {expr2} @@ -2277,7 +2279,7 @@ flatten({list} [, {maxdepth}]) *flatten()* Flatten {list} up to {maxdepth} levels. Without {maxdepth} the result is a |List| without nesting, as if {maxdepth} is a very large number. - The {list} is changed in place, make a copy first if you do + The {list} is changed in place, use |flattennew()| if you do not want that. *E900* {maxdepth} means how deep in nested lists changes are made. @@ -2295,6 +2297,10 @@ flatten({list} [, {maxdepth}]) *flatten()* Can also be used as a |method|: > mylist->flatten() < +flattennew({list} [, {maxdepth}]) *flattennew()* + Like |flatten()| but first make a copy of {list}. + + float2nr({expr}) *float2nr()* Convert {expr} to a Number by omitting the part after the decimal point. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 910aebae70..27c5927cf9 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -670,6 +670,7 @@ List manipulation: *list-functions* count() count number of times a value appears in a List repeat() repeat a List multiple times flatten() flatten a List + flattennew() flatten a copy of a List Dictionary manipulation: *dict-functions* get() get an entry without an error for a wrong key -- cgit From c57af5d41cd039194dbd9c6fb5b68b377d2a5b59 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 24 Feb 2023 09:50:59 +0000 Subject: feat(treesitter)!: remove silent option from language.add() Simply use `pcall` if you want to silence an error. --- runtime/doc/treesitter.txt | 5 ----- 1 file changed, 5 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index ccb3c445df..76cde91920 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -686,11 +686,6 @@ add({lang}, {opts}) *vim.treesitter.language.add()* • path (string|nil) Optional path the parser is located at • symbol_name (string|nil) Internal symbol name for the language to load - • silent (boolean|nil) Don't throw an error if language not - found - - Return: ~ - (boolean) If the specified language is installed get_lang({filetype}) *vim.treesitter.language.get_lang()* Parameters: ~ -- cgit From 5732aa706c639b3d775573d91d1139f24624629c Mon Sep 17 00:00:00 2001 From: Jon Huhn Date: Sat, 25 Feb 2023 03:07:18 -0600 Subject: feat(lsp): implement workspace/didChangeWatchedFiles (#21293) --- runtime/doc/news.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 23bb6d4343..53c2b44c5f 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -171,6 +171,9 @@ The following new APIs or features were added. • |vim.treesitter.foldexpr()| can be used for 'foldexpr' to use treesitter for folding. +• Added support for the `workspace/didChangeWatchedFiles` capability to the + LSP client to notify servers of file changes on disk. + ============================================================================== CHANGED FEATURES *news-changes* -- cgit From f0f27e9aef7c237dd55fbb5c2cd47c2f42d01742 Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Sat, 25 Feb 2023 11:17:28 +0100 Subject: Revert "feat(lsp): implement workspace/didChangeWatchedFiles (#21293)" This reverts commit 5732aa706c639b3d775573d91d1139f24624629c. Causes editor to freeze in projects with many watcher registrations --- runtime/doc/news.txt | 3 --- 1 file changed, 3 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 53c2b44c5f..23bb6d4343 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -171,9 +171,6 @@ The following new APIs or features were added. • |vim.treesitter.foldexpr()| can be used for 'foldexpr' to use treesitter for folding. -• Added support for the `workspace/didChangeWatchedFiles` capability to the - LSP client to notify servers of file changes on disk. - ============================================================================== CHANGED FEATURES *news-changes* -- cgit From c1514d7e6762ed62dee027ecc29bafd4aae2206e Mon Sep 17 00:00:00 2001 From: Mathias Fußenegger Date: Sat, 25 Feb 2023 18:47:05 +0100 Subject: fix(lsp): fix some type annotations (#22397) --- runtime/doc/lsp.txt | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 215515a2d9..3b5a434eff 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -569,7 +569,7 @@ buf_notify({bufnr}, {method}, {params}) *vim.lsp.buf_notify()* • {params} (any) Arguments to send to the server Return: ~ - true if any client returns true; false otherwise + (boolean) success true if any client returns true; false otherwise *vim.lsp.buf_request_all()* buf_request_all({bufnr}, {method}, {params}, {callback}) @@ -582,11 +582,13 @@ buf_request_all({bufnr}, {method}, {params}, {callback}) • {method} (string) LSP method name • {params} (table|nil) Parameters to send to the server • {callback} (function) The callback to call when all requests are - finished. + finished. Unlike `buf_request`, this will collect all the + responses from each server instead of handling them. A map + of client_id:request_result will be provided to the + callback Return: ~ - (function) A function that will cancel all requests which is the same - as the one returned from `buf_request`. + fun() cancel A function that will cancel all requests *vim.lsp.buf_request_sync()* buf_request_sync({bufnr}, {method}, {params}, {timeout_ms}) @@ -604,8 +606,9 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms}) result. Defaults to 1000 Return: ~ - Map of client_id:request_result. On timeout, cancel or error, returns - `(nil, err)` where `err` is a string describing the failure reason. + table|nil result, string|nil err Map of + client_id:request_result. On timeout, cancel or error, returns `(nil, + err)` where `err` is a string describing the failure reason. client() *vim.lsp.client* LSP client object. You can get an active client object via @@ -671,7 +674,7 @@ client_is_stopped({client_id}) *vim.lsp.client_is_stopped()* • {client_id} (number) Return: ~ - true if client is stopped, false otherwise. + (boolean) stopped true if client is stopped, false otherwise. *vim.lsp.for_each_buffer_client()* for_each_buffer_client({bufnr}, {fn}) @@ -722,10 +725,10 @@ get_buffers_by_client_id({client_id}) Returns list of buffers attached to client_id. Parameters: ~ - • {client_id} (number) client id + • {client_id} (integer) client id Return: ~ - (list) of buffer ids + integer[] buffers list of buffer ids get_client_by_id({client_id}) *vim.lsp.get_client_by_id()* Gets a client by id, or nil if the id is invalid. The returned client may @@ -741,7 +744,7 @@ get_log_path() *vim.lsp.get_log_path()* Gets the path of the logfile used by the LSP client. Return: ~ - (String) Path to logfile. + (string) path to log file omnifunc({findstart}, {base}) *vim.lsp.omnifunc()* Implements 'omnifunc' compatible LSP completion. @@ -946,9 +949,9 @@ start_client({config}) *vim.lsp.start_client()* initialization. Return: ~ - Client id. |vim.lsp.get_client_by_id()| Note: client may not be fully - initialized. Use `on_init` to do any actions once the client has been - initialized. + (integer|nil) client_id. |vim.lsp.get_client_by_id()| Note: client may + not be fully initialized. Use `on_init` to do any actions once the + client has been initialized. stop_client({client_id}, {force}) *vim.lsp.stop_client()* Stops a client(s). @@ -979,7 +982,7 @@ tagfunc({...}) *vim.lsp.tagfunc()* • {flags} (string) See |tag-function| Return: ~ - A list of matching tags + table[] tags A list of matching tags with({handler}, {override_config}) *vim.lsp.with()* Function to manage overriding defaults for LSP handlers. @@ -1943,13 +1946,13 @@ request({method}, {params}, {callback}, {notify_reply_callback}) • {method} (string) The invoked LSP method • {params} (table|nil) Parameters for the invoked LSP method - • {callback} (function) Callback to invoke + • {callback} fun(err: lsp.ResponseError | nil, result: any) Callback to invoke • {notify_reply_callback} (function|nil) Callback to invoke as soon as a request is no longer pending Return: ~ - (bool, number) `(true, message_id)` if request could be sent, `false` - if not + (boolean) success, integer|nil request_id true, message_id if request + could be sent, `false` if not *vim.lsp.rpc.rpc_response_error()* rpc_response_error({code}, {message}, {data}) -- cgit From 774e59f3f9bf50c8350857c6722bb58df2dd940a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Sun, 26 Feb 2023 16:53:33 +0000 Subject: feat(treesitter): expand the API --- runtime/doc/news.txt | 8 ++++++++ runtime/doc/treesitter.txt | 25 ++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 3 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 23bb6d4343..c5261b739d 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -171,6 +171,14 @@ The following new APIs or features were added. • |vim.treesitter.foldexpr()| can be used for 'foldexpr' to use treesitter for folding. +• Expanded the TSNode API with: + - |TSNode:tree()| + - |TSNode:has_changes()| + - |TSNode:extra()| + - |TSNode:equal()| + + Additionally |TSNode:range()| now takes an optional {include_bytes} argument. + ============================================================================== CHANGED FEATURES *news-changes* diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 76cde91920..fdea84282f 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -136,9 +136,16 @@ TSNode:end_() *TSNode:end_()* Get the node's end position. Return three values: the row, column and total byte count (all zero-based). -TSNode:range() *TSNode:range()* - Get the range of the node. Return four values: the row, column of the - start position, then the row, column of the end position. +TSNode:range({include_bytes}) *TSNode:range()* + Get the range of the node. + + Return four or six values: + - start row + - start column + - start byte (if {include_bytes} is `true`) + - end row + - end column + - end byte (if {include_bytes} is `true`) TSNode:type() *TSNode:type()* Get the node's type as a string. @@ -155,6 +162,13 @@ TSNode:missing() *TSNode:missing()* Check if the node is missing. Missing nodes are inserted by the parser in order to recover from certain kinds of syntax errors. +TSNode:extra() *TSNode:extra()* + Check if the node is extra. Extra nodes represent things like comments, + which are not required by the grammar but can appear anywhere. + +TSNode:has_changes() *TSNode:has_changes()* + Check if a syntax node has been edited. + TSNode:has_error() *TSNode:has_error()* Check if the node is a syntax error or contains any syntax errors. @@ -171,6 +185,8 @@ TSNode:id() *TSNode:id()* Note: The `id` is not guaranteed to be unique for nodes from different trees. +TSNode:tree() *TSNode:tree()* + Get the |TSTree| of the node. *TSNode:descendant_for_range()* TSNode:descendant_for_range({start_row}, {start_col}, {end_row}, {end_col}) Get the smallest node within this node that spans the given range of (row, @@ -180,6 +196,9 @@ TSNode:descendant_for_range({start_row}, {start_col}, {end_row}, {end_col}) TSNode:named_descendant_for_range({start_row}, {start_col}, {end_row}, {end_col}) Get the smallest named node within this node that spans the given range of (row, column) positions + *TSNode:equal()* +TSNode:equal({node}) + Check if {node} refers to the same node within the same tree. ============================================================================== TREESITTER QUERIES *treesitter-query* -- cgit From 0972d7a12468d6914a70e453af85c307b167c55b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 26 Feb 2023 23:13:12 +0800 Subject: vim-patch:9.0.0196: finding value in list may require a for loop Problem: Finding value in list may require a for loop. Solution: Add indexof(). (Yegappan Lakshmanan, closes vim/vim#10903) https://github.com/vim/vim/commit/b218655d5a485f5b193fb18d7240837d42b89812 Co-authored-by: Yegappan Lakshmanan --- runtime/doc/builtin.txt | 48 +++++++++++++++++++++++++++++++++++++++++++++++- runtime/doc/usr_41.txt | 6 ++++-- 2 files changed, 51 insertions(+), 3 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 5f279ed09c..1168d7ff1d 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -255,6 +255,8 @@ iconv({expr}, {from}, {to}) String convert encoding of {expr} indent({lnum}) Number indent of line {lnum} index({object}, {expr} [, {start} [, {ic}]]) Number index in {object} where {expr} appears +indexof({object}, {expr} [, {opts}]]) + Number index in {object} where {expr} is true input({prompt} [, {text} [, {completion}]]) String get input from the user inputlist({textlist}) Number let the user pick from a choice list @@ -4084,19 +4086,25 @@ indent({lnum}) The result is a Number, which is indent of line {lnum} in the GetLnum()->indent() index({object}, {expr} [, {start} [, {ic}]]) *index()* + Find {expr} in {object} and return its index. See + |filterof()| for using a lambda to select the item. + If {object} is a |List| return the lowest index where the item has a value equal to {expr}. There is no automatic conversion, so the String "4" is different from the Number 4. And the Number 4 is different from the Float 4.0. The value - of 'ignorecase' is not used here, case always matters. + of 'ignorecase' is not used here, case matters as indicated by + the {ic} argument. If {object} is a |Blob| return the lowest index where the byte value is equal to {expr}. If {start} is given then start looking at the item with index {start} (may be negative for an item relative to the end). + When {ic} is given and it is |TRUE|, ignore case. Otherwise case must match. + -1 is returned when {expr} is not found in {object}. Example: > :let idx = index(words, "the") @@ -4105,6 +4113,44 @@ index({object}, {expr} [, {start} [, {ic}]]) *index()* < Can also be used as a |method|: > GetObject()->index(what) +indexof({object}, {expr} [, {opt}]) *indexof()* + {object} must be a |List| or a |Blob|. + If {object} is a |List|, evaluate {expr} for each item in the + List until the expression returns v:true and return the index + of this item. + + If {object} is a |Blob| evaluate {expr} for each byte in the + Blob until the expression returns v:true and return the index + of this byte. + + {expr} must be a |string| or |Funcref|. + + If {expr} is a |string|: If {object} is a |List|, inside + {expr} |v:key| has the index of the current List item and + |v:val| has the value of the item. If {object} is a |Blob|, + inside {expr} |v:key| has the index of the current byte and + |v:val| has the byte value. + + If {expr} is a |Funcref| it must take two arguments: + 1. the key or the index of the current item. + 2. the value of the current item. + The function must return |TRUE| if the item is found and the + search should stop. + + The optional argument {opt} is a Dict and supports the + following items: + start start evaluating {expr} at the item with index + {start} (may be negative for an item relative + to the end). + Returns -1 when {expr} evaluates to v:false for all the items. + Example: > + :let l = [#{n: 10}, #{n: 20}, #{n: 30]] + :let idx = indexof(l, "v:val.n == 20") + :let idx = indexof(l, {i, v -> v.n == 30}) + +< Can also be used as a |method|: > + mylist->indexof(expr) + input({prompt} [, {text} [, {completion}]]) *input()* input({opts}) The result is a String, which is whatever the user typed on diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 27c5927cf9..77b1795a57 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -657,14 +657,16 @@ List manipulation: *list-functions* map() change each List item reduce() reduce a List to a value sort() sort a List - reverse() reverse the order of a List + reverse() reverse the order of a List or Blob uniq() remove copies of repeated adjacent items split() split a String into a List join() join List items into a String range() return a List with a sequence of numbers string() String representation of a List call() call a function with List as arguments - index() index of a value in a List + index() index of a value in a List or Blob + indexof() index in a List or Blob where an expression + evaluates to true max() maximum value in a List min() minimum value in a List count() count number of times a value appears in a List -- cgit From 13da3d469ae10201de00ae89277c53c40342f4df Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 26 Feb 2023 23:50:35 +0800 Subject: vim-patch:partial:9.0.0202: code and help for indexof() is not ideal Problem: Code and help for indexof() is not ideal. Solution: Refactor the code, improve the help. (Yegappan Lakshmanan, closes vim/vim#10908) https://github.com/vim/vim/commit/3fbf6cd355de2212e9227f57d545592aae3f688f Skip CHECK_LIST_MATERIALIZE and set_vim_var_type(). Use tv_list_uidx() instead of lv_idx. Co-authored-by: Yegappan Lakshmanan --- runtime/doc/builtin.txt | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 1168d7ff1d..35f1b7cd6f 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -4087,7 +4087,7 @@ indent({lnum}) The result is a Number, which is indent of line {lnum} in the index({object}, {expr} [, {start} [, {ic}]]) *index()* Find {expr} in {object} and return its index. See - |filterof()| for using a lambda to select the item. + |indexof()| for using a lambda to select the item. If {object} is a |List| return the lowest index where the item has a value equal to {expr}. There is no automatic @@ -4113,15 +4113,17 @@ index({object}, {expr} [, {start} [, {ic}]]) *index()* < Can also be used as a |method|: > GetObject()->index(what) -indexof({object}, {expr} [, {opt}]) *indexof()* - {object} must be a |List| or a |Blob|. +indexof({object}, {expr} [, {opts}]) *indexof()* + Returns the index of an item in {object} where {expr} is + v:true. {object} must be a |List| or a |Blob|. + If {object} is a |List|, evaluate {expr} for each item in the - List until the expression returns v:true and return the index - of this item. + List until the expression is v:true and return the index of + this item. If {object} is a |Blob| evaluate {expr} for each byte in the - Blob until the expression returns v:true and return the index - of this byte. + Blob until the expression is v:true and return the index of + this byte. {expr} must be a |string| or |Funcref|. @@ -4137,16 +4139,17 @@ indexof({object}, {expr} [, {opt}]) *indexof()* The function must return |TRUE| if the item is found and the search should stop. - The optional argument {opt} is a Dict and supports the + The optional argument {opts} is a Dict and supports the following items: - start start evaluating {expr} at the item with index - {start} (may be negative for an item relative - to the end). + startidx start evaluating {expr} at the item with this + index; may be negative for an item relative to + the end Returns -1 when {expr} evaluates to v:false for all the items. Example: > - :let l = [#{n: 10}, #{n: 20}, #{n: 30]] - :let idx = indexof(l, "v:val.n == 20") - :let idx = indexof(l, {i, v -> v.n == 30}) + :let l = [#{n: 10}, #{n: 20}, #{n: 30}] + :echo indexof(l, "v:val.n == 20") + :echo indexof(l, {i, v -> v.n == 30}) + :echo indexof(l, "v:val.n == 20", #{startidx: 1}) < Can also be used as a |method|: > mylist->indexof(expr) -- cgit From 2c9fbe34b20266ef5ab54f6ed14fb38eef60430d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 27 Feb 2023 10:10:42 +0800 Subject: vim-patch:8.2.2336: Vim9: not possible to extend dictionary with different type (#22425) Problem: Vim9: it is not possible to extend a dictionary with different item types. Solution: Add extendnew(). (closes vim/vim#7666) https://github.com/vim/vim/commit/b0e6b513648db7035046613431a4aa9d71ef4653 Co-authored-by: Bram Moolenaar --- runtime/doc/builtin.txt | 11 +++++++++++ runtime/doc/usr_41.txt | 2 ++ 2 files changed, 13 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 35f1b7cd6f..3ff4e47a45 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -138,6 +138,9 @@ expandcmd({string} [, {options}]) String expand {string} like with `:edit` extend({expr1}, {expr2} [, {expr3}]) List/Dict insert items of {expr2} into {expr1} +extendnew({expr1}, {expr2} [, {expr3}]) + List/Dict like |extend()| but creates a new + List or Dictionary feedkeys({string} [, {mode}]) Number add key sequence to typeahead buffer filereadable({file}) Number |TRUE| if {file} is a readable file filewritable({file}) Number |TRUE| if {file} is a writable file @@ -2119,6 +2122,14 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* Can also be used as a |method|: > mylist->extend(otherlist) + +extendnew({expr1}, {expr2} [, {expr3}]) *extendnew()* + Like |extend()| but instead of adding items to {expr1} a new + List or Dictionary is created and returned. {expr1} remains + unchanged. Items can still be changed by {expr2}, if you + don't want that use |deepcopy()| first. + + feedkeys({string} [, {mode}]) *feedkeys()* Characters in {string} are queued for processing as if they come from a mapping or were typed by the user. diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 77b1795a57..0f2cfdd2ac 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -650,6 +650,7 @@ List manipulation: *list-functions* insert() insert an item somewhere in a List add() append an item to a List extend() append a List to a List + extendnew() make a new List and append items remove() remove one or more items from a List copy() make a shallow copy of a List deepcopy() make a full copy of a List @@ -681,6 +682,7 @@ Dictionary manipulation: *dict-functions* empty() check if Dictionary is empty remove() remove an entry from a Dictionary extend() add entries from one Dictionary to another + extendnew() make a new Dictionary and append items filter() remove selected entries from a Dictionary map() change each Dictionary entry keys() get List of Dictionary keys -- cgit From 7f424e2b65779c59fc0cac3cc7508ba2ec07f200 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 23 Feb 2023 18:29:36 +0100 Subject: feat(api): more fields in nvim_list_uis Problem: nvim_list_uis does not report all ":help ui-option" fields. Solution: Store ":help ui-option" fields on the `UI` object and update ui_array. --- runtime/doc/builtin.txt | 1 + runtime/doc/news.txt | 2 ++ runtime/doc/ui.txt | 5 ++--- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 3ff4e47a45..8cde2f8fb0 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -3868,6 +3868,7 @@ has({feature}) Returns 1 if {feature} is supported, 0 otherwise. The clipboard |clipboard| provider is available. fname_case Case in file names matters (for Darwin and MS-Windows this is not present). + gui_running Nvim has a GUI. iconv Can use |iconv()| for conversion. linux Linux system. mac MacOS system. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index c5261b739d..4c9cbf9189 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -179,6 +179,8 @@ The following new APIs or features were added. Additionally |TSNode:range()| now takes an optional {include_bytes} argument. +• |nvim_list_uis()| reports all |ui-option| fields. + ============================================================================== CHANGED FEATURES *news-changes* diff --git a/runtime/doc/ui.txt b/runtime/doc/ui.txt index bb567e021e..e706e36374 100644 --- a/runtime/doc/ui.txt +++ b/runtime/doc/ui.txt @@ -53,9 +53,8 @@ with these (optional) keys: - `term_name` Sets the name of the terminal 'term'. - `term_colors` Sets the number of supported colors 't_Co'. - `term_background` Sets the default value of 'background'. -- `stdin_fd` Read buffer from `fd` as if it was a stdin pipe. - This option can only used by |--embed| ui on startup. - See |ui-startup-stdin|. +- `stdin_fd` Read buffer 1 from this fd as if it were stdin |--|. + Only from |--embed| UI on startup. |ui-startup-stdin| - `stdin_tty` Tells if `stdin` is a `tty` or not. - `stdout_tty` Tells if `stdout` is a `tty` or not. -- cgit From ce597235a26839826de88ecd8b949ec54c310fbd Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 27 Feb 2023 16:31:05 +0100 Subject: feat(ui): restore has('gui_running') Problem: has('gui_running') is still common in the wild and our answer has changed over time, causing frustration. https://github.com/vimpostor/vim-tpipeline/commit/95a6ccbe9f33bc42dd4cee45731d8bc3fbcd92d1 Solution: Use stdin_tty/stdout_tty to decide if a UI is (not) a GUI. --- runtime/doc/news.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 4c9cbf9189..90e17d3678 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -181,6 +181,9 @@ The following new APIs or features were added. • |nvim_list_uis()| reports all |ui-option| fields. +• Vim's `has('gui_running')` is now supported as a way for plugins to check if + a GUI (not the |TUI|) is attached to Nvim. |has()| + ============================================================================== CHANGED FEATURES *news-changes* -- cgit From f89e3497c88f59916e3bce2e902be9b0f8bf15ba Mon Sep 17 00:00:00 2001 From: Mike Date: Mon, 27 Feb 2023 14:19:41 -0600 Subject: docs(lsp): update cmd_env description (#22438) --- runtime/doc/lsp.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 3b5a434eff..7e46698614 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -851,11 +851,10 @@ start_client({config}) *vim.lsp.start_client()* • cmd_cwd: (string, default=|getcwd()|) Directory to launch the `cmd` process. Not related to `root_dir`. • cmd_env: (table) Environment flags to pass to the LSP on - spawn. Can be specified using keys like a map or as a list - with `k=v` pairs or both. Non-string values are coerced to string. - Example: > + spawn. Must be specified using a map-like table. + Non-string values are coerced to string. Example: > - { "PRODUCTION=true"; "TEST=123"; PORT = 8080; HOST = "0.0.0.0"; } + { PORT = 8080; HOST = "0.0.0.0"; } < • detached: (boolean, default true) Daemonize the server process so that it runs in a separate process group from -- cgit From fb2ead6cf3ef2d5a60af5dbe9cd1443a07296beb Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Mon, 27 Feb 2023 22:17:12 +0000 Subject: docs(usr): make usr_05.txt more coherent with Nvim changes (#22428) - Make section 05.2 more coherent. - Remove explanation of options that are already default. --- runtime/doc/usr_05.txt | 80 ++++++++------------------------------------------ 1 file changed, 13 insertions(+), 67 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/usr_05.txt b/runtime/doc/usr_05.txt index d8fb2acedb..00b4f9eed4 100644 --- a/runtime/doc/usr_05.txt +++ b/runtime/doc/usr_05.txt @@ -10,7 +10,7 @@ make Vim start with options set to different values. Add plugins to extend Vim's capabilities. Or define your own macros. |05.1| The vimrc file -|05.2| The example vimrc file explained +|05.2| Example vimrc contents |05.3| Simple mappings |05.4| Adding a package |05.5| Adding a plugin @@ -27,10 +27,10 @@ Table of contents: |usr_toc.txt| You probably got tired of typing commands that you use very often. To start Vim with all your favorite option settings and mappings, you write them in -what is called the init.vim file. Vim executes the commands in this file when +what is called the init.vim file. Vim executes the commands in this file when it starts up. -If you already have a init.vim file (e.g., when your sysadmin has one setup +If you already have a init.vim file (e.g., when your sysadmin has one setup for you), you can edit it this way: > :edit $MYVIMRC @@ -56,80 +56,32 @@ This chapter only explains the most basic items. For more information on how to write a Vim script file: |usr_41.txt|. ============================================================================== -*05.2* The example vimrc file explained *vimrc_example.vim* +*05.2* Example vimrc contents *vimrc_example.vim* In the first chapter was explained how to create a vimrc file. > :exe 'edit' stdpath('config').'/init.vim' -In this section we will explain the various commands used in this file. This -will give you hints about how to set up your own preferences. Not everything -will be explained though. Use the ":help" command to find out more. - -> - set backspace=indent,eol,start - -This specifies where in Insert mode the is allowed to delete the -character in front of the cursor. The three items, separated by commas, tell -Vim to delete the white space at the start of the line, a line break and the -character before where Insert mode started. -> - - set autoindent - -This makes Vim use the indent of the previous line for a newly created line. -Thus there is the same amount of white space before the new line. For example -when pressing in Insert mode, and when using the "o" command to open a -new line. +In this section we will explain the various commands that can be specified in +this file. This will give you hints about how to set up your own preferences. +Not everything will be explained though. Use the ":help" command to find out +more. > - set backup This tells Vim to keep a backup copy of a file when overwriting it. The backup file will have the same name as the original file with "~" added. See |07.4| > - set history=50 - +< Keep 50 commands and 50 search patterns in the history. Use another number if you want to remember fewer or more lines. -> - - set ruler - -Always display the current cursor position in the lower right corner of the -Vim window. - -> - set showcmd - -Display an incomplete command in the lower right corner of the Vim window, -left of the ruler. For example, when you type "2f", Vim is waiting for you to -type the character to find and "2f" is displayed. When you press "w" next, -the "2fw" command is executed and the displayed "2f" is removed. -> - +-------------------------------------------------+ - |text in the Vim window | - |~ | - |~ | - |-- VISUAL -- 2f 43,8 17% | - +-------------------------------------------------+ - ^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^^^ - 'showmode' 'showcmd' 'ruler' - -> - set incsearch -< -Display matches for a search pattern while you type. - > map Q gq This defines a key mapping. More about that in the next section. This -defines the "Q" command to do formatting with the "gq" operator. This is how -it worked before Vim 5.0. Otherwise the "Q" command repeats the last recorded -register. - +defines the "Q" command to do formatting with the "gq" operator. Otherwise the +"Q" command repeats the last recorded register. > vnoremap _g y:exe "grep /" .. escape(@", '\\/') .. "/ *.c *.h" @@ -138,14 +90,8 @@ This is a complicated mapping. You can see that mappings can be used to do quite complicated things. Still, it is just a sequence of commands that are executed like you typed them. + *vimrc-filetype* > - set hlsearch - -This option tells Vim to highlight matches with the last used search pattern. -The "if" command is very useful to set options only when some condition is -met. More about that in |usr_41.txt|. - - *vimrc-filetype* > filetype plugin indent on This switches on three very clever mechanisms: @@ -342,7 +288,7 @@ That's all! Now you can use the commands defined in this plugin. Instead of putting plugins directly into the plugin/ directory, you may better organize them by putting them into subdirectories under plugin/. -As an example, consider using "~/.local/share/nvim/site/plugin/perl/*.vim" for +As an example, consider using "~/.local/share/nvim/site/plugin/perl/*.vim" for all your Perl plugins. -- cgit From 66c384d4e806a5e8de53bc57a05f0ddd8c8a9d1c Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Tue, 28 Feb 2023 09:34:27 +0100 Subject: vim-patch:partial:dd60c365cd26 (#22437) vim-patch:partial:dd60c365cd26 Update runtime files https://github.com/vim/vim/commit/dd60c365cd2630794be84d63c4fe287124a30b97 Co-authored-by: Bram Moolenaar Skip: eval.txt, repeat.txt (needs `getscriptinfo()`) --- runtime/doc/builtin.txt | 5 +++-- runtime/doc/change.txt | 6 ++++-- runtime/doc/map.txt | 6 ++++-- runtime/doc/sign.txt | 12 ++++++------ runtime/doc/syntax.txt | 20 ++++++++++++++------ 5 files changed, 31 insertions(+), 18 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 3ff4e47a45..b74e30db09 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2126,8 +2126,7 @@ extend({expr1}, {expr2} [, {expr3}]) *extend()* extendnew({expr1}, {expr2} [, {expr3}]) *extendnew()* Like |extend()| but instead of adding items to {expr1} a new List or Dictionary is created and returned. {expr1} remains - unchanged. Items can still be changed by {expr2}, if you - don't want that use |deepcopy()| first. + unchanged. feedkeys({string} [, {mode}]) *feedkeys()* @@ -8725,6 +8724,8 @@ timer_start({time}, {callback} [, {options}]) {time} is the waiting time in milliseconds. This is the minimum time before invoking the callback. When the system is busy or Vim is not waiting for input the time will be longer. + Zero can be used to execute the callback when Vim is back in + the main loop. {callback} is the function to call. It can be the name of a function or a |Funcref|. It is called with one argument, which diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 990ba3d8fd..2cebd8abdd 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -276,7 +276,9 @@ gr{char} Replace the virtual characters under the cursor with {char}. This replaces in screen space, not file space. See |gR| and |Virtual-Replace-mode| for more details. As with |r| a count may be given. - {char} can be entered like with |r|. + {char} can be entered like with |r|, but characters + that have a special meaning in Insert mode, such as + most CTRL-keys, cannot be used. *digraph-arg* The argument for Normal mode commands like |r| and |t| is a single character. @@ -976,7 +978,7 @@ inside of strings can change! Also see 'softtabstop' option. > < to display registers '1' and 'a'. Spaces are allowed in {arg}. - *:di* *:display* + *:di* *:dis* *:display* :di[splay] [arg] Same as :registers. *y* *yank* diff --git a/runtime/doc/map.txt b/runtime/doc/map.txt index ad0570e9f7..3a5223fa3a 100644 --- a/runtime/doc/map.txt +++ b/runtime/doc/map.txt @@ -1205,12 +1205,14 @@ functions used in one script use the same name as in other scripts. To avoid this, they can be made local to the script. ** ** *E81* -The string "" can be used in a mapping or menu. +The string "" can be used in a mapping or menu. This is useful if you +have a script-local function that you want to call from a mapping in the same +script. When executing the map command, Vim will replace "" with the special key code , followed by a number that's unique for the script, and an underscore. Example: > :map Add -could define a mapping "23_Add". +would define a mapping "23_Add". When defining a function in a script, "s:" can be prepended to the name to make it local to the script. But when a mapping is executed from outside of diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 53ef03eb63..162bdaed7b 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -595,23 +595,23 @@ sign_placelist({list}) |sign_place()| function. The {list} argument specifies the List of signs to place. Each list item is a dict with the following sign attributes: - buffer buffer name or number. For the accepted + buffer Buffer name or number. For the accepted values, see |bufname()|. - group sign group. {group} functions as a namespace + group Sign group. {group} functions as a namespace for {id}, thus two groups can use the same IDs. If not specified or set to an empty string, then the global group is used. See |sign-group| for more information. - id sign identifier. If not specified or zero, + id Sign identifier. If not specified or zero, then a new unique identifier is allocated. Otherwise the specified number is used. See |sign-identifier| for more information. - lnum line number in the buffer where the sign is to + lnum Line number in the buffer where the sign is to be placed. For the accepted values, see |line()|. - name name of the sign to place. See |sign_define()| + name Name of the sign to place. See |sign_define()| for more information. - priority priority of the sign. When multiple signs are + priority Priority of the sign. When multiple signs are placed on a line, the sign with the highest priority is used. If not specified, the default value of 10 is used. See diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt index 7102e93f0a..68d059be82 100644 --- a/runtime/doc/syntax.txt +++ b/runtime/doc/syntax.txt @@ -2756,17 +2756,25 @@ For highlighted doctests and code inside: > :let python_no_doctest_highlight = 1 or > :let python_no_doctest_code_highlight = 1 -(first option implies second one). +The first option implies the second one. For highlighted trailing whitespace and mix of spaces and tabs: > :let python_space_error_highlight = 1 -If you want all possible Python highlighting (the same as setting the -preceding last option and unsetting all other ones): > +If you want all possible Python highlighting: > :let python_highlight_all = 1 +This has the same effect as setting python_space_error_highlight and +unsetting all the other ones. + +If you use Python 2 or straddling code (Python 2 and 3 compatible), +you can enforce the use of an older syntax file with support for +Python 2 and up to Python 3.5. > + : let python_use_python2_syntax = 1 +This option will exclude all modern Python 3.6 or higher features. + +Note: Only existence of these options matters, not their value. + You can replace 1 above with anything. -Note: Only existence of these options matter, not their value. You can replace - 1 above with anything. QUAKE *quake.vim* *ft-quake-syntax* @@ -5179,7 +5187,7 @@ Conceal Placeholder characters substituted for concealed *hl-CurSearch* CurSearch Used for highlighting a search pattern under the cursor (see 'hlsearch'). - *hl-Cursor* + *hl-Cursor* *hl-lCursor* Cursor Character under the cursor. lCursor Character under the cursor when |language-mapping| is used (see 'guicursor'). -- cgit From bfa0bc7df0ca527fcec49dbd2055f1bac438663e Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Feb 2023 19:04:32 +0800 Subject: vim-patch:9.0.0795: readblob() always reads the whole file Problem: readblob() always reads the whole file. Solution: Add arguments to read part of the file. (Ken Takata, closes vim/vim#11402) https://github.com/vim/vim/commit/11df3aeee548b959ccd4b9a4d3c44651eab6b3ce Remove trailing whitespace in test as done in patch 9.0.1257. Move the help for rand() before range(). Co-authored-by: K.Takata --- runtime/doc/builtin.txt | 53 ++++++++++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 20 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index ed8c78ef2f..113703680f 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -359,7 +359,8 @@ pyxeval({expr}) any evaluate |python_x| expression rand([{expr}]) Number get pseudo-random number range({expr} [, {max} [, {stride}]]) List items from {expr} to {max} -readblob({fname}) Blob read a |Blob| from {fname} +readblob({fname} [, {offset} [, {size}]]) + Blob read a |Blob| from {fname} readdir({dir} [, {expr}]) List file names in {dir} selected by {expr} readfile({fname} [, {type} [, {max}]]) List get list of lines from file {fname} @@ -6110,6 +6111,25 @@ pyxeval({expr}) *pyxeval()* Can also be used as a |method|: > GetExpr()->pyxeval() < +rand([{expr}]) *rand()* + Return a pseudo-random Number generated with an xoshiro128** + algorithm using seed {expr}. The returned number is 32 bits, + also on 64 bits systems, for consistency. + {expr} can be initialized by |srand()| and will be updated by + rand(). If {expr} is omitted, an internal seed value is used + and updated. + Returns -1 if {expr} is invalid. + + Examples: > + :echo rand() + :let seed = srand() + :echo rand(seed) + :echo rand(seed) % 16 " random number 0 - 15 +< + Can also be used as a |method|: > + seed->rand() +< + *E726* *E727* range({expr} [, {max} [, {stride}]]) *range()* Returns a |List| with Numbers: @@ -6132,29 +6152,22 @@ range({expr} [, {max} [, {stride}]]) *range()* Can also be used as a |method|: > GetExpr()->range() < -rand([{expr}]) *rand()* - Return a pseudo-random Number generated with an xoshiro128** - algorithm using seed {expr}. The returned number is 32 bits, - also on 64 bits systems, for consistency. - {expr} can be initialized by |srand()| and will be updated by - rand(). If {expr} is omitted, an internal seed value is used - and updated. - Returns -1 if {expr} is invalid. - - Examples: > - :echo rand() - :let seed = srand() - :echo rand(seed) - :echo rand(seed) % 16 " random number 0 - 15 -< - Can also be used as a |method|: > - seed->rand() -< -readblob({fname}) *readblob()* +readblob({fname} [, {offset} [, {size}]]) *readblob()* Read file {fname} in binary mode and return a |Blob|. + If {offset} is specified, read the file from the specified + offset. If it is a negative value, it is used as an offset + from the end of the file. E.g., to read the last 12 bytes: > + readblob('file.bin', -12) +< If {size} is specified, only the specified size will be read. + E.g. to read the first 100 bytes of a file: > + readblob('file.bin', 0, 100) +< If {size} is -1 or omitted, the whole data starting from + {offset} will be read. When the file can't be opened an error message is given and the result is an empty |Blob|. + When trying to read bytes beyond the end of the file the + result is an empty blob. Also see |readfile()| and |writefile()|. -- cgit From 4bd0611d7b07b56fc5a9e121669a313166ba540f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Feb 2023 19:23:28 +0800 Subject: vim-patch:9.0.0803: readblob() cannot read from character device Problem: readblob() cannot read from character device. Solution: Use S_ISCHR() to not check the size. (Ken Takata, closes vim/vim#11407) https://github.com/vim/vim/commit/43625762a9751cc6e6e4d8f54fbc8b82d98fb20d S_ISCHR is always defined in Nvim. Co-authored-by: K.Takata --- runtime/doc/builtin.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 113703680f..eab415f495 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -6164,7 +6164,12 @@ readblob({fname} [, {offset} [, {size}]]) *readblob()* readblob('file.bin', 0, 100) < If {size} is -1 or omitted, the whole data starting from {offset} will be read. - When the file can't be opened an error message is given and + This can be also used to read the data from a character device + on Unix when {size} is explicitly set. Only if the device + supports seeking {offset} can be used. Otherwise it should be + zero. E.g. to read 10 bytes from a serial console: > + readblob('/dev/ttyS0', 0, 10) +< When the file can't be opened an error message is given and the result is an empty |Blob|. When trying to read bytes beyond the end of the file the result is an empty blob. -- cgit From 7aad75e293e3a01e292308ca2058e35083b83280 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Feb 2023 19:29:59 +0800 Subject: vim-patch:9.0.0810: readblob() returns empty when trying to read too much Problem: readblob() returns empty when trying to read too much. Solution: Return what is available. https://github.com/vim/vim/commit/5b2a3d77d320d76f12b1666938a9d58c2a848205 Co-authored-by: Bram Moolenaar --- runtime/doc/builtin.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index eab415f495..568b73ddfa 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -6171,8 +6171,10 @@ readblob({fname} [, {offset} [, {size}]]) *readblob()* readblob('/dev/ttyS0', 0, 10) < When the file can't be opened an error message is given and the result is an empty |Blob|. - When trying to read bytes beyond the end of the file the - result is an empty blob. + When the offset is beyond the end of the file the result is an + empty blob. + When trying to read more bytes than are available the result + is truncated. Also see |readfile()| and |writefile()|. -- cgit From f6b9791212e86bac3e8128035dec2bfc5016927f Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Feb 2023 20:18:52 +0800 Subject: vim-patch:8.2.3438: cannot manipulate blobs Problem: Cannot manipulate blobs. Solution: Add blob2list() and list2blob(). (Yegappan Lakshmanan, closes vim/vim#8868) https://github.com/vim/vim/commit/5dfe467432638fac2e0156a2f9cd0d9eb569fb39 Co-authored-by: Yegappan Lakshmanan --- runtime/doc/builtin.txt | 28 +++++++++++++++++++++++++++- runtime/doc/usr_41.txt | 6 ++++++ 2 files changed, 33 insertions(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 568b73ddfa..b194a104f7 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -55,6 +55,7 @@ assert_report({msg}) Number report a test failure assert_true({actual} [, {msg}]) Number assert {actual} is true atan({expr}) Float arc tangent of {expr} atan2({expr1}, {expr2}) Float arc tangent of {expr1} / {expr2} +blob2list({blob}) List convert {blob} into a list of numbers browse({save}, {title}, {initdir}, {default}) String put up a file requester browsedir({title}, {initdir}) String put up a directory requester @@ -296,7 +297,8 @@ libcallnr({lib}, {func}, {arg}) Number idem, but return a Number line({expr} [, {winid}]) Number line nr of cursor, last line or mark line2byte({lnum}) Number byte count of line {lnum} lispindent({lnum}) Number Lisp indent for line {lnum} -list2str({list} [, {utf8}]) String turn numbers in {list} into a String +list2blob({list}) Blob turn {list} of numbers into a Blob +list2str({list} [, {utf8}]) String turn {list} of numbers into a String localtime() Number current time log({expr}) Float natural logarithm (base e) of {expr} log10({expr}) Float logarithm of Float {expr} to base 10 @@ -777,6 +779,17 @@ atan2({expr1}, {expr2}) *atan2()* Can also be used as a |method|: > Compute()->atan2(1) +blob2list({blob}) *blob2list()* + Return a List containing the number value of each byte in Blob + {blob}. Examples: > + blob2list(0z0102.0304) returns [1, 2, 3, 4] + blob2list(0z) returns [] +< Returns an empty List on error. |list2blob()| does the + opposite. + + Can also be used as a |method|: > + GetBlob()->blob2list() +< *browse()* browse({save}, {title}, {initdir}, {default}) Put up a file requester. This only works when "has("browse")" @@ -4768,6 +4781,19 @@ lispindent({lnum}) *lispindent()* Can also be used as a |method|: > GetLnum()->lispindent() +list2blob({list}) *list2blob()* + Return a Blob concatenating all the number values in {list}. + Examples: > + list2blob([1, 2, 3, 4]) returns 0z01020304 + list2blob([]) returns 0z +< Returns an empty Blob on error. If one of the numbers is + negative or more than 255 error *E1239* is given. + + |blob2list()| does the opposite. + + Can also be used as a |method|: > + GetList()->list2blob() + list2str({list} [, {utf8}]) *list2str()* Convert each number in {list} to a character string can concatenate them all. Examples: > diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 0f2cfdd2ac..ed16f837cf 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -721,6 +721,10 @@ Floating point computation: *float-functions* isinf() check for infinity isnan() check for not a number +Blob manipulation: *blob-functions* + blob2list() get a list of numbers from a blob + list2blob() get a blob from a list of numbers + Other computation: *bitwise-function* and() bitwise AND invert() bitwise invert @@ -1321,6 +1325,8 @@ is a List with arguments. Function references are most useful in combination with a Dictionary, as is explained in the next section. +More information about defining your own functions here: |user-functions|. + ============================================================================== *41.8* Lists and Dictionaries -- cgit From ccac34af766bee70d4f2a3cd69b54977849f567d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Feb 2023 20:38:16 +0800 Subject: vim-patch:8.2.3446: not enough tests for empty string arguments Problem: Not enough tests for empty string arguments. Solution: Add tests, fix type check. (Yegappan Lakshmanan, closes vim/vim#8881) https://github.com/vim/vim/commit/820d5525cae707f39571c6abc2aa6a9e66ed171e Co-authored-by: Yegappan Lakshmanan --- runtime/doc/sign.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'runtime/doc') diff --git a/runtime/doc/sign.txt b/runtime/doc/sign.txt index 162bdaed7b..9f469767a2 100644 --- a/runtime/doc/sign.txt +++ b/runtime/doc/sign.txt @@ -525,6 +525,7 @@ sign_jump({id}, {group}, {buf}) {buf} and position the cursor at sign {id} in group {group}. This is similar to the |:sign-jump| command. + If {group} is an empty string, then the global group is used. For the use of {buf}, see |bufname()|. Returns the line number of the sign. Returns -1 if the -- cgit From 278aeee3aed753d1084597378e653395bd472c42 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 28 Feb 2023 21:07:56 +0800 Subject: vim-patch:9.0.0430: cannot use repeat() with a blob Problem: Cannot use repeat() with a blob. Solution: Implement blob repeat. (closes vim/vim#11090) https://github.com/vim/vim/commit/375141e1f80dced9be738568a3418f65813f4a2f Co-authored-by: Bakudankun --- runtime/doc/builtin.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index b194a104f7..7fab2ac6ff 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -380,7 +380,8 @@ remove({blob}, {idx} [, {end}]) Number/Blob remove bytes {idx}-{end} from {blob} remove({dict}, {key}) any remove entry {key} from {dict} rename({from}, {to}) Number rename (move) file from {from} to {to} -repeat({expr}, {count}) String repeat {expr} {count} times +repeat({expr}, {count}) List/Blob/String + repeat {expr} {count} times resolve({filename}) String get filename a shortcut points to reverse({list}) List reverse {list} in-place round({expr}) Float round off {expr} @@ -6420,8 +6421,8 @@ repeat({expr}, {count}) *repeat()* result. Example: > :let separator = repeat('-', 80) < When {count} is zero or negative the result is empty. - When {expr} is a |List| the result is {expr} concatenated - {count} times. Example: > + When {expr} is a |List| or a |Blob| the result is {expr} + concatenated {count} times. Example: > :let longlist = repeat(['a', 'b'], 3) < Results in ['a', 'b', 'a', 'b', 'a', 'b']. -- cgit From cf07f2baabd3a1a072102e0cacb6d70509ada044 Mon Sep 17 00:00:00 2001 From: bfredl Date: Mon, 27 Feb 2023 12:29:20 +0100 Subject: feat(edit)!: remove old c implementation of hebrew keymap This feature has long been obsolete. The 'keymap' option can be used to support language keymaps, including hebrew and hebrewp (phonetic mapping). There is no need to keep the old c code with hardcoded keymaps for some languages. --- runtime/doc/hebrew.txt | 19 ++++++------------- runtime/doc/insert.txt | 8 ++++---- runtime/doc/news.txt | 2 ++ runtime/doc/options.txt | 24 ------------------------ runtime/doc/starting.txt | 2 +- runtime/doc/vim_diff.txt | 4 ++++ 6 files changed, 17 insertions(+), 42 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/hebrew.txt b/runtime/doc/hebrew.txt index 76266d777f..e38385e13a 100644 --- a/runtime/doc/hebrew.txt +++ b/runtime/doc/hebrew.txt @@ -30,17 +30,10 @@ Details + 'rightleft' ('rl') sets window orientation to right-to-left. This means that the logical text 'ABC' will be displayed as 'CBA', and will start drawing at the right edge of the window, not the left edge. - + 'hkmap' ('hk') sets keyboard mapping to Hebrew, in insert/replace modes. - + 'aleph' ('al'), numeric, holds the decimal code of Aleph, for keyboard - mapping. - + 'hkmapp' ('hkp') sets keyboard mapping to "phonetic hebrew" - - NOTE: these three ('hkmap', 'hkmapp' and 'aleph') are obsolete. You should - use ":set keymap=hebrewp" instead. - - + 'delcombine' ('deco'), boolean, if editing UTF-8 encoded Hebrew, allows - one to remove the niqud or te`amim by pressing 'x' on a character (with - associated niqud). + + 'keymap' ('kmp') sets keyboard mapping. use values "hebrew" or "heprewp" + (the latter option enables phonetic mapping) + + 'delcombine' ('deco'), boolean, allows one to remove the niqud or + te`amim by pressing 'x' on a character (with associated niqud). + 'rightleftcmd' ('rlc') makes the command-prompt for searches show up on the right side. It only takes effect if the window is 'rightleft'. @@ -62,10 +55,10 @@ Details + CTRL-_ in insert/replace modes toggles 'revins' and 'hkmap' as follows: - When in rightleft window, 'revins' and 'nohkmap' are toggled, since + When in rightleft window, 'revins' is toggled, since English will likely be inserted in this case. - When in norightleft window, 'revins' 'hkmap' are toggled, since Hebrew + When in norightleft window, 'revins' is toggled, since Hebrew will likely be inserted in this case. CTRL-_ moves the cursor to the end of the typed text. diff --git a/runtime/doc/insert.txt b/runtime/doc/insert.txt index 84aee43af4..49aa2a79a4 100644 --- a/runtime/doc/insert.txt +++ b/runtime/doc/insert.txt @@ -221,11 +221,11 @@ CTRL-Y Insert the character which is above the cursor. able to copy characters from a long line. *i_CTRL-_* -CTRL-_ Switch between languages, as follows: - - When in a rightleft window, revins and nohkmap are toggled, +CTRL-_ Switch between insert direction, by toggling 'revins', as follows: + - When in a rightleft window, 'revins' is toggled, since English will likely be inserted in this case. - - When in a norightleft window, revins and hkmap are toggled, - since Hebrew will likely be inserted in this case. + - When in a norightleft window, 'revins' is toggled, + since a rightleft language will likely be inserted in this case. CTRL-_ moves the cursor to the end of the typed text. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index c5261b739d..86a81e0c95 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -211,6 +211,8 @@ The following deprecated functions or APIs were removed. changes need to be contributed there first.) See https://github.com/neovim/neovim/pull/20674. +- 'hkmap', 'hkmapp' and 'aleph' options were removed. Use 'keymap' option instead. + ============================================================================== DEPRECATIONS *news-deprecations* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index f44b6f28e3..6c5b168402 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -575,16 +575,6 @@ supported use something like this: > *E355* A jump table for the options with a short description can be found at |Q_op|. - *'aleph'* *'al'* *aleph* *Aleph* -'aleph' 'al' number (default 224) - global - The ASCII code for the first letter of the Hebrew alphabet. The - routine that maps the keyboard in Hebrew mode, both in Insert mode - (when hkmap is set) and on the command-line (when hitting CTRL-_) - outputs the Hebrew characters in the range [aleph..aleph+26]. - aleph=128 applies to PC code, and aleph=224 applies to ISO 8859-8. - See |rileft.txt|. - *'allowrevins'* *'ari'* *'noallowrevins'* *'noari'* 'allowrevins' 'ari' boolean (default off) global @@ -3195,20 +3185,6 @@ A jump table for the options with a short description can be found at |Q_op|. each of these histories (see |cmdline-editing|). The maximum value is 10000. - *'hkmap'* *'hk'* *'nohkmap'* *'nohk'* -'hkmap' 'hk' boolean (default off) - global - When on, the keyboard is mapped for the Hebrew character set. - Normally you would set 'allowrevins' and use CTRL-_ in insert mode to - toggle this option. See |rileft.txt|. - - *'hkmapp'* *'hkp'* *'nohkmapp'* *'nohkp'* -'hkmapp' 'hkp' boolean (default off) - global - When on, phonetic keyboard mapping is used. 'hkmap' must also be on. - This is useful if you have a non-Hebrew keyboard. - See |rileft.txt|. - *'hlsearch'* *'hls'* *'nohlsearch'* *'nohls'* 'hlsearch' 'hls' boolean (default on) global diff --git a/runtime/doc/starting.txt b/runtime/doc/starting.txt index a8a149def8..8c9ec7df9c 100644 --- a/runtime/doc/starting.txt +++ b/runtime/doc/starting.txt @@ -258,7 +258,7 @@ argument. -A Arabic mode. Sets the 'arabic' option on. *-H* --H Hebrew mode. Sets the 'hkmap' and 'rightleft' options on. +-H Hebrew mode. Sets the 'rightleft' option on and 'keymap' to "hebrew" *-V* *verbose* -V[N] Verbose. Sets the 'verbose' option to [N] (default: 10). diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index 79808eccc9..5efe094226 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -594,6 +594,7 @@ Highlight groups: < Options: + *'aleph'* *'al'* antialias *'balloondelay'* *'bdlay'* *'ballooneval'* *'beval'* *'noballooneval'* *'nobeval'* @@ -617,6 +618,9 @@ Options: *'guifontset'* *'gfs'* (Use 'guifont' instead.) *'guipty'* (Nvim uses pipes and PTYs consistently on all platforms.) 'highlight' (Names of builtin |highlight-groups| cannot be changed.) + *'hkmap'* *'hk'* use `set keymap=hebrew` instead. + *'hkmapp'* *'hkp'* use `set keymap=hebrewp` instead. + *'imactivatefunc'* *'imaf'* *'imactivatekey'* *'imak'* *'imstatusfunc'* *'imsf'* -- cgit From bc15b075d14c85098d674a2466d2386e08b0005f Mon Sep 17 00:00:00 2001 From: Mike Date: Wed, 1 Mar 2023 10:51:22 -0600 Subject: feat(vim.fs): pass path to find() predicate, lazy evaluate #22378 Problem: No easy way to find files under certain directories (ex: grab all files under `test/`) or exclude the content of certain paths (ex. `build/`, `.git/`) Solution: Pass the full `path` as an arg to the predicate. --- runtime/doc/lua.txt | 35 ++++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 8ae1c6dc40..e3e0665025 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2359,12 +2359,37 @@ find({names}, {opts}) *vim.fs.find()* The search can be narrowed to find only files or only directories by specifying {type} to be "file" or "directory", respectively. + Examples: >lua + + -- location of Cargo.toml from the current buffer's path + local cargo = vim.fs.find('Cargo.toml', { + upward = true, + stop = vim.loop.os_homedir(), + path = vim.fs.dirname(vim.api.nvim_buf_get_name(0)), + }) + + -- list all test directories under the runtime directory + local test_dirs = vim.fs.find( + {'test', 'tst', 'testdir'}, + {limit = math.huge, type = 'directory', path = './runtime/'} + ) + + -- get all files ending with .cpp or .hpp inside lib/ + local cpp_hpp = vim.fs.find(function(name, path) + return name:match('.*%.[ch]pp$') and path:match('[/\\]lib$') + end, {limit = math.huge, type = 'file'}) +< + Parameters: ~ - • {names} (string|table|fun(name: string): boolean) Names of the files - and directories to find. Must be base names, paths and globs - are not supported. The function is called per file and - directory within the traversed directories to test if they - match {names}. + • {names} (string|table|fun(name: string, path: string): boolean) Names + of the files and directories to find. Must be base names, + paths and globs are not supported when {names} is a string or + a table. If {names} is a function, it is called for each + traversed file and directory with args: + • name: base name of the current item + • path: full path of the current item The function should + return `true` if the given file or directory is considered + a match. • {opts} (table) Optional keyword arguments: • path (string): Path to begin searching from. If omitted, the |current-directory| is used. -- cgit From b0b4c310973c2b419350e3c05c772596b1c334e9 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 2 Mar 2023 10:01:42 -0500 Subject: refactor: rename show_tree => inspect_tree #22474 Problem: "show" is potentially a new verb that we can avoid (there is already "open" and "echo"). Even if we can't avoid it, the behavior of `show_tree` fits well in the "inspect" family of functions: a way for users to introspect/reflect on the state of Nvim. Existing "inspect" functions: vim.inspect() vim.inspect_pos() vim.treesitter.inspect_language() nvim__inspect_cell Solution: Rename `show_tree` to `inspect_tree`. --- runtime/doc/news.txt | 2 +- runtime/doc/treesitter.txt | 50 +++++++++++++++++++++++----------------------- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 919f8ceaee..226444ccb5 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -89,7 +89,7 @@ The following new APIs or features were added. See |lsp-semantic_tokens| for more information. -• |vim.treesitter.show_tree()| opens a split window showing a text +• |vim.treesitter.inspect_tree()| opens a split window showing a text representation of the nodes in a language tree for the current buffer. • Added support for the `willSave` and `willSaveWaitUntil` capabilities to the diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index fdea84282f..b75e879424 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -595,6 +595,31 @@ get_string_parser({str}, {lang}, {opts}) Return: ~ |LanguageTree| object to use for parsing +inspect_tree({opts}) *vim.treesitter.inspect_tree()* + Open a window that displays a textual representation of the nodes in the + language tree. + + While in the window, press "a" to toggle display of anonymous nodes, "I" + to toggle the display of the source language of each node, and press + to jump to the node under the cursor in the source buffer. + + Parameters: ~ + • {opts} (table|nil) Optional options table with the following possible + keys: + • lang (string|nil): The language of the source buffer. If + omitted, the filetype of the source buffer is used. + • bufnr (integer|nil): Buffer to draw the tree into. If + omitted, a new buffer is created. + • winid (integer|nil): Window id to display the tree buffer + in. If omitted, a new window is created with {command}. + • command (string|nil): Vimscript command to create the + window. Default value is "topleft 60vnew". Only used when + {winid} is nil. + • title (string|fun(bufnr:integer):string|nil): Title of the + window. If a function, it accepts the buffer number of the + source buffer as its only argument and should return a + string. + is_ancestor({dest}, {source}) *vim.treesitter.is_ancestor()* Determines whether a node is the ancestor of another @@ -627,31 +652,6 @@ node_contains({node}, {range}) *vim.treesitter.node_contains()* Return: ~ (boolean) True if the {node} contains the {range} -show_tree({opts}) *vim.treesitter.show_tree()* - Open a window that displays a textual representation of the nodes in the - language tree. - - While in the window, press "a" to toggle display of anonymous nodes, "I" - to toggle the display of the source language of each node, and press - to jump to the node under the cursor in the source buffer. - - Parameters: ~ - • {opts} (table|nil) Optional options table with the following possible - keys: - • lang (string|nil): The language of the source buffer. If - omitted, the filetype of the source buffer is used. - • bufnr (integer|nil): Buffer to draw the tree into. If - omitted, a new buffer is created. - • winid (integer|nil): Window id to display the tree buffer - in. If omitted, a new window is created with {command}. - • command (string|nil): Vimscript command to create the - window. Default value is "topleft 60vnew". Only used when - {winid} is nil. - • title (string|fun(bufnr:integer):string|nil): Title of the - window. If a function, it accepts the buffer number of the - source buffer as its only argument and should return a - string. - start({bufnr}, {lang}) *vim.treesitter.start()* Starts treesitter highlighting for a buffer -- cgit From f449121764c19cebda7b8b2c970b76bc8121bae7 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 2 Mar 2023 18:03:11 +0100 Subject: feat(treesitter): add :InspectTree command (#22477) --- runtime/doc/news.txt | 5 +++-- runtime/doc/treesitter.txt | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 226444ccb5..0ffd335520 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -89,8 +89,9 @@ The following new APIs or features were added. See |lsp-semantic_tokens| for more information. -• |vim.treesitter.inspect_tree()| opens a split window showing a text - representation of the nodes in a language tree for the current buffer. +• |vim.treesitter.inspect_tree()| and |:InspectTree| opens a split window + showing a text representation of the nodes in a language tree for the current + buffer. • Added support for the `willSave` and `willSaveWaitUntil` capabilities to the LSP client. `willSaveWaitUntil` allows a server to modify a document before it diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index b75e879424..5ac24de70a 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -603,6 +603,8 @@ inspect_tree({opts}) *vim.treesitter.inspect_tree()* to toggle the display of the source language of each node, and press to jump to the node under the cursor in the source buffer. + Can also be shown with `:InspectTree`. *:InspectTree* + Parameters: ~ • {opts} (table|nil) Optional options table with the following possible keys: -- cgit From 8414cfe7f4d8888698343cb54a3f373a28b365db Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Thu, 2 Mar 2023 20:46:59 +0100 Subject: docs: fix vim.treesitter tags Problem: Help tags like vim.treesitter.language.add() are confusing because `vim.treesitter.language` is (thankfully) not a user-facing module. Solution: Ignore the "fstem" when generating "treesitter" tags. --- runtime/doc/deprecated.txt | 2 +- runtime/doc/news.txt | 10 +++---- runtime/doc/treesitter.txt | 69 +++++++++++++--------------------------------- 3 files changed, 24 insertions(+), 57 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/deprecated.txt b/runtime/doc/deprecated.txt index 42dfb53e77..3d861b07b3 100644 --- a/runtime/doc/deprecated.txt +++ b/runtime/doc/deprecated.txt @@ -120,7 +120,7 @@ LSP FUNCTIONS or |vim.lsp.buf.format()| instead. TREESITTER FUNCTIONS -- *vim.treesitter.language.require_language()* Use |vim.treesitter.language.add()| +- *vim.treesitter.language.require_language()* Use |vim.treesitter.add()| instead. - *vim.treesitter.get_node_at_pos()* Use |vim.treesitter.get_node()| instead. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 0ffd335520..cda4792c9e 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -162,11 +162,10 @@ The following new APIs or features were added. • Treesitter captures can now be transformed by directives. This will allow more complicated dynamic language injections. -• |vim.treesitter.query.get_node_text()| now accepts a `metadata` option for - writing custom directives using |vim.treesitter.query.add_directive()|. +• |vim.treesitter.get_node_text()| now accepts a `metadata` option for + writing custom directives using |vim.treesitter.add_directive()|. -• |vim.treesitter.language.add()| as a new replacement for - `vim.treesitter.language.require_language`. +• |vim.treesitter.add()| replaces `vim.treesitter.language.require_language`. • `require'bit'` is now always available |lua-bit| @@ -225,8 +224,7 @@ DEPRECATIONS *news-deprecations* The following functions are now deprecated and will be removed in the next release. -• `vim.treesitter.language.require_language()` has been deprecated in favour - of |vim.treesitter.language.add()|. +• |vim.treesitter.add()| replaces `vim.treesitter.language.require_language()` • |vim.treesitter.get_node_at_pos()| and |vim.treesitter.get_node_at_cursor()| are both deprecated in favor of |vim.treesitter.get_node()|. diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 5ac24de70a..94a93bdbbb 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -272,9 +272,8 @@ The following predicates are built in: Each predicate has a `not-` prefixed predicate that is just the negation of the predicate. -Further predicates can be added via |vim.treesitter.query.add_predicate()|. -Use |vim.treesitter.query.list_predicates()| to list all available -predicates. +Further predicates can be added via |vim.treesitter.add_predicate()|. +Use |vim.treesitter.list_predicates()| to list all available predicates. TREESITTER QUERY DIRECTIVES *treesitter-directives* @@ -316,9 +315,8 @@ The following directives are built in: ((identifier) @constant (#offset! @constant 0 1 0 -1)) < -Further directives can be added via |vim.treesitter.query.add_directive()|. -Use |vim.treesitter.query.list_directives()| to list all available -directives. +Further directives can be added via |vim.treesitter.add_directive()|. +Use |vim.treesitter.list_directives()| to list all available directives. TREESITTER QUERY MODELINES *treesitter-query-modeline* @@ -690,7 +688,7 @@ stop({bufnr}) *vim.treesitter.stop()* ============================================================================== Lua module: vim.treesitter.language *lua-treesitter-language* -add({lang}, {opts}) *vim.treesitter.language.add()* +add({lang}, {opts}) *vim.treesitter.add()* Asserts that a parser for the language {lang} is installed. Parsers are searched in the `parser` runtime directory, or the provided @@ -708,14 +706,14 @@ add({lang}, {opts}) *vim.treesitter.language.add()* • symbol_name (string|nil) Internal symbol name for the language to load -get_lang({filetype}) *vim.treesitter.language.get_lang()* +get_lang({filetype}) *vim.treesitter.get_lang()* Parameters: ~ • {filetype} (string) Return: ~ (string|nil) -inspect_language({lang}) *vim.treesitter.language.inspect_language()* +inspect_language({lang}) *vim.treesitter.inspect_language()* Inspects the provided language. Inspecting provides some useful information on the language like node @@ -727,7 +725,7 @@ inspect_language({lang}) *vim.treesitter.language.inspect_language()* Return: ~ (table) -register({lang}, {filetype}) *vim.treesitter.language.register()* +register({lang}, {filetype}) *vim.treesitter.register()* Register a lang to be used for a filetype (or list of filetypes). Parameters: ~ @@ -738,7 +736,7 @@ register({lang}, {filetype}) *vim.treesitter.language.register()* ============================================================================== Lua module: vim.treesitter.query *lua-treesitter-query* - *vim.treesitter.query.add_directive()* + *vim.treesitter.add_directive()* add_directive({name}, {handler}, {force}) Adds a new directive to be used in queries @@ -760,7 +758,7 @@ add_directive({name}, {handler}, {force}) the predicate `{ "#set!", "conceal", "-" }` • {force} (boolean|nil) - *vim.treesitter.query.add_predicate()* + *vim.treesitter.add_predicate()* add_predicate({name}, {handler}, {force}) Adds a new predicate to be used in queries @@ -768,11 +766,11 @@ add_predicate({name}, {handler}, {force}) • {name} (string) Name of the predicate, without leading # • {handler} function(match:table, pattern:string, bufnr:number, predicate:string[]) - • see |vim.treesitter.query.add_directive()| for argument + • see |vim.treesitter.add_directive()| for argument meanings • {force} (boolean|nil) - *vim.treesitter.query.get_node_text()* + *vim.treesitter.get_node_text()* get_node_text({node}, {source}, {opts}) Gets the text corresponding to a given node @@ -785,12 +783,12 @@ get_node_text({node}, {source}, {opts}) true) • metadata (table) Metadata of a specific capture. This would be set to `metadata[capture_id]` when using - |vim.treesitter.query.add_directive()|. + |vim.treesitter.add_directive()|. Return: ~ (string[]|string|nil) -get_query({lang}, {query_name}) *vim.treesitter.query.get_query()* +get_query({lang}, {query_name}) *vim.treesitter.get_query()* Returns the runtime query {query_name} for {lang}. Parameters: ~ @@ -800,7 +798,7 @@ get_query({lang}, {query_name}) *vim.treesitter.query.get_query()* Return: ~ Query|nil Parsed query - *vim.treesitter.query.get_query_files()* + *vim.treesitter.get_query_files()* get_query_files({lang}, {query_name}, {is_included}) Gets the list of files used to make up a query @@ -814,19 +812,19 @@ get_query_files({lang}, {query_name}, {is_included}) string[] query_files List of files to load for given query and language -list_directives() *vim.treesitter.query.list_directives()* +list_directives() *vim.treesitter.list_directives()* Lists the currently available directives to use in queries. Return: ~ string[] List of supported directives. -list_predicates() *vim.treesitter.query.list_predicates()* +list_predicates() *vim.treesitter.list_predicates()* Lists the currently available predicates to use in queries. Return: ~ string[] List of supported predicates. -parse_query({lang}, {query}) *vim.treesitter.query.parse_query()* +parse_query({lang}, {query}) *vim.treesitter.parse_query()* Parse {query} as a string. (If the query is in a file, the caller should read the contents into a string before calling). @@ -915,8 +913,7 @@ Query:iter_matches({self}, {node}, {source}, {start}, {stop}) (fun(): integer, table, table): pattern id, match, metadata - *vim.treesitter.query.set_query()* -set_query({lang}, {query_name}, {text}) +set_query({lang}, {query_name}, {text}) *vim.treesitter.set_query()* Sets the runtime query named {query_name} for {lang} This allows users to override any runtime files and/or configuration set @@ -931,17 +928,6 @@ set_query({lang}, {query_name}, {text}) ============================================================================== Lua module: vim.treesitter.highlighter *lua-treesitter-highlighter* -new({tree}, {opts}) *vim.treesitter.highlighter.new()* - Creates a new highlighter using - - Parameters: ~ - • {tree} |LanguageTree| parser object to use for highlighting - • {opts} (table|nil) Configuration of the highlighter: - • queries table overwrite queries used by the highlighter - - Return: ~ - TSHighlighter Created highlighter object - TSHighlighter:destroy({self}) *TSHighlighter:destroy()* Removes all internal references to the highlighter @@ -1103,21 +1089,4 @@ LanguageTree:trees({self}) *LanguageTree:trees()* Parameters: ~ • {self} -new({source}, {lang}, {opts}) *vim.treesitter.languagetree.new()* - A |LanguageTree| holds the treesitter parser for a given language {lang} - used to parse a buffer. As the buffer may contain injected languages, the LanguageTree needs to store parsers for these child languages as well (which in turn - may contain child languages themselves, hence the name). - - Parameters: ~ - • {source} (integer|string) Buffer or a string of text to parse - • {lang} (string) Root language this tree represents - • {opts} (table|nil) Optional keyword arguments: - • injections table Mapping language to injection query - strings. This is useful for overriding the built-in - runtime file searching for the injection language query - per language. - - Return: ~ - |LanguageTree| parser object - vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: -- cgit From a4f443994bb91321b00f29af9e6357df9102ce75 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Sat, 4 Mar 2023 10:45:20 +0100 Subject: docs(luvref): update to version bump (#22508) --- runtime/doc/luvref.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/luvref.txt b/runtime/doc/luvref.txt index 66cee0649c..0fdd010880 100644 --- a/runtime/doc/luvref.txt +++ b/runtime/doc/luvref.txt @@ -3360,14 +3360,17 @@ file system operations, as well as `getaddrinfo` and `getnameinfo` requests. uv.new_work({work_callback}, {after_work_callback}) *uv.new_work()* Parameters: - - `work_callback`: `function` + - `work_callback`: `function` or `string` - `...`: `threadargs` passed to/from `uv.queue_work(work_ctx, ...)` - `after_work_callback`: `function` - `...`: `threadargs` returned from `work_callback` Creates and initializes a new `luv_work_ctx_t` (not - `uv_work_t`). Returns the Lua userdata wrapping it. + `uv_work_t`). + `work_callback` is a Lua function or a string containing Lua + code or bytecode dumped from a function. Returns the Lua + userdata wrapping it. Returns: `luv_work_ctx_t userdata` @@ -3468,16 +3471,16 @@ uv.new_thread([{options}, ] {entry}, {...}) *uv.new_thread()* Parameters: - `options`: `table` or `nil` - `stack_size`: `integer` or `nil` - - `entry`: `function` + - `entry`: `function` or `string` - `...`: `threadargs` passed to `entry` Creates and initializes a `luv_thread_t` (not `uv_thread_t`). Returns the Lua userdata wrapping it and asynchronously - executes `entry`, which can be either a Lua function or a Lua - function dumped to a string. Additional arguments `...` are - passed to the `entry` function and an optional `options` table - may be provided. Currently accepted `option` fields are - `stack_size`. + executes `entry`, which can be either a Lua function or a + string containing Lua code or bytecode dumped from a function. + Additional arguments `...` are passed to the `entry` function + and an optional `options` table may be provided. Currently + accepted `option` fields are `stack_size`. Returns: `luv_thread_t userdata` or `fail` -- cgit From 128b82103ba477482bdfaf10ec71e0986876cca1 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 4 Mar 2023 22:04:05 +0900 Subject: docs(treesitter): number → integer (#22513) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/doc/treesitter.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 94a93bdbbb..855fc6bdc6 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -748,7 +748,7 @@ add_directive({name}, {handler}, {force}) Parameters: ~ • {name} (string) Name of the directive, without leading # • {handler} function(match:table, pattern:string, - bufnr:number, predicate:string[], metadata:table) + bufnr:integer, predicate:string[], metadata:table) • match: see |treesitter-query| • node-level data are accessible via `match[capture_id]` @@ -765,7 +765,7 @@ add_predicate({name}, {handler}, {force}) Parameters: ~ • {name} (string) Name of the predicate, without leading # • {handler} function(match:table, pattern:string, - bufnr:number, predicate:string[]) + bufnr:integer, predicate:string[]) • see |vim.treesitter.add_directive()| for argument meanings • {force} (boolean|nil) @@ -776,7 +776,7 @@ get_node_text({node}, {source}, {opts}) Parameters: ~ • {node} |TSNode| - • {source} (number|string) Buffer or string from which the {node} is + • {source} (integer|string) Buffer or string from which the {node} is extracted • {opts} (table|nil) Optional parameters. • concat: (boolean) Concatenate result in a string (default @@ -872,8 +872,8 @@ Query:iter_captures({self}, {node}, {source}, {start}, {stop}) • {node} |TSNode| under which the search will occur • {source} (integer|string) Source buffer or string to extract text from - • {start} (number) Starting line for the search - • {stop} (number) Stopping line for the search (end-exclusive) + • {start} (integer) Starting line for the search + • {stop} (integer) Stopping line for the search (end-exclusive) • {self} Return: ~ -- cgit From ccd2cc1abd69f677edabd0b66dfd9689eeee54b9 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 4 Mar 2023 22:05:16 +0900 Subject: docs(uri): number → integer (#22515) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/doc/lua.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index e3e0665025..38ddff13bd 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2007,7 +2007,7 @@ uri_from_bufnr({bufnr}) *vim.uri_from_bufnr()* Get a URI from a bufnr Parameters: ~ - • {bufnr} (number) + • {bufnr} (integer) Return: ~ (string) URI @@ -2029,7 +2029,7 @@ uri_to_bufnr({uri}) *vim.uri_to_bufnr()* • {uri} (string) Return: ~ - (number) bufnr + (integer) bufnr uri_to_fname({uri}) *vim.uri_to_fname()* Get a filename from a URI -- cgit From 1f07307aeb6564fb794921cc1b2879f84a822921 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 4 Mar 2023 22:05:46 +0900 Subject: docs(inspect): number → integer (#22511) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/doc/lua.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 38ddff13bd..87498c7599 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1542,11 +1542,11 @@ inspect_pos({bufnr}, {row}, {col}, {filter}) *vim.inspect_pos()* Can also be pretty-printed with `:Inspect!`. *:Inspect!* Parameters: ~ - • {bufnr} (number|nil) defaults to the current buffer - • {row} (number|nil) row to inspect, 0-based. Defaults to the row of - the current cursor - • {col} (number|nil) col to inspect, 0-based. Defaults to the col of - the current cursor + • {bufnr} (integer|nil) defaults to the current buffer + • {row} (integer|nil) row to inspect, 0-based. Defaults to the row + of the current cursor + • {col} (integer|nil) col to inspect, 0-based. Defaults to the col + of the current cursor • {filter} (table|nil) a table with key-value pairs to filter the items • syntax (boolean): include syntax based highlight groups (defaults to true) @@ -1575,11 +1575,11 @@ show_pos({bufnr}, {row}, {col}, {filter}) *vim.show_pos()* Can also be shown with `:Inspect`. *:Inspect* Parameters: ~ - • {bufnr} (number|nil) defaults to the current buffer - • {row} (number|nil) row to inspect, 0-based. Defaults to the row of - the current cursor - • {col} (number|nil) col to inspect, 0-based. Defaults to the col of - the current cursor + • {bufnr} (integer|nil) defaults to the current buffer + • {row} (integer|nil) row to inspect, 0-based. Defaults to the row + of the current cursor + • {col} (integer|nil) col to inspect, 0-based. Defaults to the col + of the current cursor • {filter} (table|nil) see |vim.inspect_pos()| -- cgit From 82b77900d7f85088c676be886937628230d0d5c2 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 4 Mar 2023 22:06:20 +0900 Subject: docs(diagnostic): number → integer (#22512) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/doc/diagnostic.txt | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/diagnostic.txt b/runtime/doc/diagnostic.txt index c661bf02bf..cff73ad097 100644 --- a/runtime/doc/diagnostic.txt +++ b/runtime/doc/diagnostic.txt @@ -423,25 +423,25 @@ config({opts}, {namespace}) *vim.diagnostic.config()* severities are displayed before lower severities (e.g. ERROR is displayed before WARN). Options: • reverse: (boolean) Reverse sort order - • {namespace} (number|nil) Update the options for the given namespace. + • {namespace} (integer|nil) Update the options for the given namespace. When omitted, update the global diagnostic options. disable({bufnr}, {namespace}) *vim.diagnostic.disable()* Disable diagnostics in the given buffer. Parameters: ~ - • {bufnr} (number|nil) Buffer number, or 0 for current buffer. When - omitted, disable diagnostics in all buffers. - • {namespace} (number|nil) Only disable diagnostics for the given + • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. + When omitted, disable diagnostics in all buffers. + • {namespace} (integer|nil) Only disable diagnostics for the given namespace. enable({bufnr}, {namespace}) *vim.diagnostic.enable()* Enable diagnostics in the given buffer. Parameters: ~ - • {bufnr} (number|nil) Buffer number, or 0 for current buffer. When - omitted, enable diagnostics in all buffers. - • {namespace} (number|nil) Only enable diagnostics for the given + • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. + When omitted, enable diagnostics in all buffers. + • {namespace} (integer|nil) Only enable diagnostics for the given namespace. fromqflist({list}) *vim.diagnostic.fromqflist()* @@ -458,8 +458,8 @@ get({bufnr}, {opts}) *vim.diagnostic.get()* Get current diagnostics. Parameters: ~ - • {bufnr} (number|nil) Buffer number to get diagnostics from. Use 0 for - current buffer or nil for all buffers. + • {bufnr} (integer|nil) Buffer number to get diagnostics from. Use 0 + for current buffer or nil for all buffers. • {opts} (table|nil) A table with the following keys: • namespace: (number) Limit diagnostics to the given namespace. @@ -473,7 +473,7 @@ get_namespace({namespace}) *vim.diagnostic.get_namespace()* Get namespace metadata. Parameters: ~ - • {namespace} (number) Diagnostic namespace + • {namespace} (integer) Diagnostic namespace Return: ~ (table) Namespace metadata @@ -560,17 +560,17 @@ hide({namespace}, {bufnr}) *vim.diagnostic.hide()* |vim.diagnostic.disable()|. Parameters: ~ - • {namespace} (number|nil) Diagnostic namespace. When omitted, hide diagnostics from all + • {namespace} (integer|nil) Diagnostic namespace. When omitted, hide diagnostics from all namespaces. - • {bufnr} (number|nil) Buffer number, or 0 for current buffer. When - omitted, hide diagnostics in all buffers. + • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. + When omitted, hide diagnostics in all buffers. is_disabled({bufnr}, {namespace}) *vim.diagnostic.is_disabled()* Check whether diagnostics are disabled in a given buffer. Parameters: ~ - • {bufnr} (number|nil) Buffer number, or 0 for current buffer. - • {namespace} (number|nil) Diagnostic namespace. When omitted, checks if all diagnostics are + • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. + • {namespace} (integer|nil) Diagnostic namespace. When omitted, checks if all diagnostics are disabled in {bufnr}. Otherwise, only checks if diagnostics from {namespace} are disabled. @@ -663,7 +663,7 @@ open_float({opts}, {...}) *vim.diagnostic.open_float()* from |vim.diagnostic.config()|. Return: ~ - number|nil, number|nil: ({float_bufnr}, {win_id}) + integer|nil, integer|nil: ({float_bufnr}, {win_id}) reset({namespace}, {bufnr}) *vim.diagnostic.reset()* Remove all diagnostics from the given namespace. @@ -674,17 +674,17 @@ reset({namespace}, {bufnr}) *vim.diagnostic.reset()* re-displayed, use |vim.diagnostic.hide()|. Parameters: ~ - • {namespace} (number|nil) Diagnostic namespace. When omitted, remove diagnostics from all + • {namespace} (integer|nil) Diagnostic namespace. When omitted, remove diagnostics from all namespaces. - • {bufnr} (number|nil) Remove diagnostics for the given buffer. + • {bufnr} (integer|nil) Remove diagnostics for the given buffer. When omitted, diagnostics are removed for all buffers. set({namespace}, {bufnr}, {diagnostics}, {opts}) *vim.diagnostic.set()* Set diagnostics for the given namespace and buffer. Parameters: ~ - • {namespace} (number) The diagnostic namespace - • {bufnr} (number) Buffer number + • {namespace} (integer) The diagnostic namespace + • {bufnr} (integer) Buffer number • {diagnostics} (table) A list of diagnostic items |diagnostic-structure| • {opts} (table|nil) Display options to pass to @@ -723,9 +723,9 @@ show({namespace}, {bufnr}, {diagnostics}, {opts}) Display diagnostics for the given namespace and buffer. Parameters: ~ - • {namespace} (number|nil) Diagnostic namespace. When omitted, show diagnostics from all + • {namespace} (integer|nil) Diagnostic namespace. When omitted, show diagnostics from all namespaces. - • {bufnr} (number|nil) Buffer number, or 0 for current buffer. + • {bufnr} (integer|nil) Buffer number, or 0 for current buffer. When omitted, show diagnostics in all buffers. • {diagnostics} (table|nil) The diagnostics to display. When omitted, use the saved diagnostics for the given namespace and -- cgit From aa16590999a66798eca7d2ba09e971aacdeb54b4 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 4 Mar 2023 22:07:39 +0900 Subject: docs(lua): number → integer (#22517) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/doc/lua.txt | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 87498c7599..1eb5ab41e6 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1413,7 +1413,7 @@ notify({msg}, {level}, {opts}) *vim.notify()* Parameters: ~ • {msg} (string) Content of the notification to show to the user. - • {level} (number|nil) One of the values from |vim.log.levels|. + • {level} (integer|nil) One of the values from |vim.log.levels|. • {opts} (table|nil) Optional parameters. Unused by default. notify_once({msg}, {level}, {opts}) *vim.notify_once()* @@ -1424,7 +1424,7 @@ notify_once({msg}, {level}, {opts}) *vim.notify_once()* Parameters: ~ • {msg} (string) Content of the notification to show to the user. - • {level} (number|nil) One of the values from |vim.log.levels|. + • {level} (integer|nil) One of the values from |vim.log.levels|. • {opts} (table|nil) Optional parameters. Unused by default. Return: ~ @@ -1448,11 +1448,11 @@ on_key({fn}, {ns_id}) *vim.on_key()* argument. On each key press, Nvim passes the key char to fn(). |i_CTRL-V| If {fn} is nil, it removes the callback for the associated {ns_id} - • {ns_id} number? Namespace ID. If nil or 0, generates and returns a + • {ns_id} integer? Namespace ID. If nil or 0, generates and returns a new |nvim_create_namespace()| id. Return: ~ - (number) Namespace id associated with {fn}. Or count of all callbacks + (integer) Namespace id associated with {fn}. Or count of all callbacks if on_key() is called without arguments. Note: @@ -1507,7 +1507,7 @@ region({bufnr}, {pos1}, {pos2}, {regtype}, {inclusive}) *vim.region()* points Parameters: ~ - • {bufnr} (number) of buffer + • {bufnr} (integer) number of buffer • {pos1} integer[] (line, column) tuple marking beginning of region • {pos2} integer[] (line, column) tuple marking end of region @@ -1678,8 +1678,8 @@ list_extend({dst}, {src}, {start}, {finish}) *vim.list_extend()* Parameters: ~ • {dst} (table) List which will be modified and appended to • {src} (table) List from which values will be inserted - • {start} (number|nil) Start index on src. Defaults to 1 - • {finish} (number|nil) Final index on src. Defaults to `#src` + • {start} (integer|nil) Start index on src. Defaults to 1 + • {finish} (integer|nil) Final index on src. Defaults to `#src` Return: ~ (table) dst @@ -1693,8 +1693,8 @@ list_slice({list}, {start}, {finish}) *vim.list_slice()* Parameters: ~ • {list} (list) Table - • {start} (number|nil) Start range of slice - • {finish} (number|nil) End range of slice + • {start} (integer|nil) Start range of slice + • {finish} (integer|nil) End range of slice Return: ~ (list) Copy of table sliced from start to finish (inclusive) @@ -1794,7 +1794,7 @@ tbl_count({t}) *vim.tbl_count()* • {t} (table) Table Return: ~ - (number) Number of non-nil values in table + (integer) Number of non-nil values in table See also: ~ https://github.com/Tieske/Penlight/blob/master/lua/pl/tablex.lua -- cgit From ac69ba5fa0081026f2c5e6e29d5788802479b7b9 Mon Sep 17 00:00:00 2001 From: Jon Huhn Date: Sun, 5 Mar 2023 00:52:27 -0600 Subject: feat(lsp): implement workspace/didChangeWatchedFiles (#22405) --- runtime/doc/news.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index cda4792c9e..415195e27e 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -184,6 +184,11 @@ The following new APIs or features were added. • Vim's `has('gui_running')` is now supported as a way for plugins to check if a GUI (not the |TUI|) is attached to Nvim. |has()| +• Added preliminary support for the `workspace/didChangeWatchedFiles` capability + to the LSP client to notify servers of file changes on disk. The feature is + disabled by default and can be enabled by setting the + `workspace.didChangeWatchedFiles.dynamicRegistration=true` capability. + ============================================================================== CHANGED FEATURES *news-changes* -- cgit From 533d671271eb76373d9940161e7bfd201b7e7c2b Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 5 Mar 2023 18:15:29 -0500 Subject: docs: module-level docstrings (@defgroup) #22498 Problem: gen_vimdoc.py / lua2dox.lua does not support @defgroup or \defgroup except for "api-foo" modules. Solution: Modify `gen_vimdoc.py` to look for section names based on `helptag_fmt`. TODO: - Support @module ? https://github.com/LuaLS/lua-language-server/wiki/Annotations#module --- runtime/doc/treesitter.txt | 78 ++++++++++++++++++++++++---------------------- 1 file changed, 40 insertions(+), 38 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 855fc6bdc6..1f78e4d5d9 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -28,42 +28,6 @@ A parser can also be loaded manually using a full path: >lua vim.treesitter.require_language("python", "/path/to/python.so") < -============================================================================== -LANGUAGE TREES *treesitter-languagetree* - *LanguageTree* - -As buffers can contain multiple languages (e.g., Vimscript commands in a Lua -file), multiple parsers may be needed to parse the full buffer. These are -combined in a |LanguageTree| object. - -To create a LanguageTree (parser object) for a buffer and a given language, -use >lua - - tsparser = vim.treesitter.get_parser(bufnr, lang) -< -`bufnr=0` can be used for current buffer. `lang` will default to 'filetype'. -Currently, the parser will be retained for the lifetime of a buffer but this -is subject to change. A plugin should keep a reference to the parser object as -long as it wants incremental updates. - -Whenever you need to access the current syntax tree, parse the buffer: >lua - - tstree = tsparser:parse() -< -This will return a table of immutable |treesitter-tree|s that represent the -current state of the buffer. When the plugin wants to access the state after a -(possible) edit it should call `parse()` again. If the buffer wasn't edited, -the same tree will be returned again without extra work. If the buffer was -parsed before, incremental parsing will be done of the changed parts. - -Note: To use the parser directly inside a |nvim_buf_attach()| Lua callback, -you must call |vim.treesitter.get_parser()| before you register your callback. -But preferably parsing shouldn't be done directly in the change callback -anyway as they will be very frequent. Rather a plugin that does any kind of -analysis on a tree should use a timer to throttle too frequent updates. - -See |lua-treesitter-languagetree| for the list of available methods. - ============================================================================== TREESITTER TREES *treesitter-tree* *TSTree* @@ -221,7 +185,7 @@ Nvim looks for queries as `*.scm` files in a `queries` directory under purpose, e.g., `queries/lua/highlights.scm` for highlighting Lua files. By default, the first query on `runtimepath` is used (which usually implies that user config takes precedence over plugins, which take precedence over -queries bundled with Neovim). If a query should extend other queries instead +queries bundled with Nvim). If a query should extend other queries instead of replacing them, use |treesitter-query-modeline-extends|. See |lua-treesitter-query| for the list of available methods for working with @@ -321,7 +285,7 @@ Use |vim.treesitter.list_directives()| to list all available directives. TREESITTER QUERY MODELINES *treesitter-query-modeline* -Neovim supports to customize the behavior of the queries using a set of +Nvim supports to customize the behavior of the queries using a set of "modelines", that is comments in the queries starting with `;`. Here are the currently supported modeline alternatives: @@ -938,6 +902,44 @@ TSHighlighter:destroy({self}) *TSHighlighter:destroy()* ============================================================================== Lua module: vim.treesitter.languagetree *lua-treesitter-languagetree* + +A *LanguageTree* contains a tree of parsers: the root treesitter parser +for {lang} and any "injected" language parsers, which themselves may +inject other languages, recursively. For example a Lua buffer containing +some Vimscript commands needs multiple parsers to fully understand its +contents. + +To create a LanguageTree (parser object) for a given buffer and language, use: + +>lua + local parser = vim.treesitter.get_parser(bufnr, lang) +< + +(where `bufnr=0` means current buffer). `lang` defaults to 'filetype'. +Note: currently the parser is retained for the lifetime of a buffer but +this may change; a plugin should keep a reference to the parser object if +it wants incremental updates. + +Whenever you need to access the current syntax tree, parse the buffer: + +>lua + local tree = parser:parse() +< + +This returns a table of immutable |treesitter-tree| objects representing +the current state of the buffer. When the plugin wants to access the state +after a (possible) edit it must call `parse()` again. If the buffer wasn't +edited, the same tree will be returned again without extra work. If the +buffer was parsed before, incremental parsing will be done of the changed +parts. + +Note: To use the parser directly inside a |nvim_buf_attach()| Lua +callback, you must call |vim.treesitter.get_parser()| before you register +your callback. But preferably parsing shouldn't be done directly in the +change callback anyway as they will be very frequent. Rather a plugin that +does any kind of analysis on a tree should use a timer to throttle too +frequent updates. + LanguageTree:children({self}) *LanguageTree:children()* Returns a map of language to child tree. -- cgit From 0e7196438d8f856eecd7c90e160b79cbc8fb08dc Mon Sep 17 00:00:00 2001 From: Kelly Lin Date: Sun, 19 Feb 2023 22:33:57 +1100 Subject: feat(lua): add semver api --- runtime/doc/lua.txt | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ runtime/doc/news.txt | 4 +++ 2 files changed, 76 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 1eb5ab41e6..3c48cd37a6 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2497,4 +2497,76 @@ trust({opts}) *vim.secure.trust()* • true and full path of target file if operation was successful • false and error message on failure + +============================================================================== +Lua module: version *lua-version* + +cmp({v1}, {v2}, {opts}) *version.cmp()* + Compares two strings ( `v1` and `v2` ) in semver format. + + Parameters: ~ + • {v1} (string) Version. + • {v2} (string) Version to be compared with v1. + • {opts} (table|nil) Optional keyword arguments: + • strict (boolean): see `semver.parse` for details. Defaults + to false. + + Return: ~ + (integer) `-1` if `v1 < v2`, `0` if `v1 == v2`, `1` if `v1 > v2`. + +eq({version_1}, {version_2}) *version.eq()* + Returns `true` if `v1` are `v2` are equal versions. + + Parameters: ~ + • {version_1} (string) + • {version_2} (string) + + Return: ~ + (boolean) + +gt({version_1}, {version_2}) *version.gt()* + Returns `true` if `v1` is greater than `v2` . + + Parameters: ~ + • {version_1} (string) + • {version_2} (string) + + Return: ~ + (boolean) + +lt({version_1}, {version_2}) *version.lt()* + Returns `true` if `v1` is less than `v2` . + + Parameters: ~ + • {version_1} (string) + • {version_2} (string) + + Return: ~ + (boolean) + +parse({version}, {opts}) *version.parse()* + Parses a semantically formatted version string into a table. + + Supports leading "v" and leading and trailing whitespace in the version + string. e.g. `" v1.0.1-rc1+build.2"` , `"1.0.1-rc1+build.2"`, + `"v1.0.1-rc1+build.2"` and `"v1.0.1-rc1+build.2 "` will be parsed as: + + { major = 1, minor = 0, patch = 1, prerelease = 'rc1 , build = 'build.2' }` + + Parameters: ~ + • {version} (string) Version string to be parsed. + • {opts} (table|nil) Optional keyword arguments: + • strict (boolean): when set to `true` an error will be + thrown for version strings that do not conform to the + semver specification (v2.0.0) (see + semver.org/spec/v2.0.0.html for details). This means that + `semver.parse('v1.2)` will throw an error. When set to + `false`, `semver.parse('v1.2)` will coerce 'v1.2' to + 'v1.2.0' and return the table: `{ major = 1, minor = 2, + patch = 0 }`. Defaults to false. + + Return: ~ + (table|nil) parsed_version Parsed version table or `nil` if `version` + is not valid. + vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 415195e27e..b5cb975066 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -55,6 +55,10 @@ NEW FEATURES *news-features* The following new APIs or features were added. +• Added |version.parse()|, |version.cmp()|, |version.lt()|, |version.eq()| + and |version.gt()| to |vim.version| for parsing and comparing version numbers + according to the semver specification, see |lua-version|. + • A new environment variable named NVIM_APPNAME enables configuring the directories where Neovim should find its configuration and state files. See `:help $NVIM_APPNAME` . -- cgit From e31e49a8e3aac25e923dce15cc76dca4a447947f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 6 Mar 2023 13:23:03 +0100 Subject: refactor(vim.version): cleanup - version.cmp(): assert valid version - add test for loading vim.version (the other tests use shared.lua in the test runner) - reduce test scopes, reword test descriptions --- runtime/doc/lua.txt | 47 +++++++++++++++++++++-------------------------- runtime/doc/news.txt | 5 ++--- 2 files changed, 23 insertions(+), 29 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 3c48cd37a6..697cd86e8a 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -2501,12 +2501,12 @@ trust({opts}) *vim.secure.trust()* ============================================================================== Lua module: version *lua-version* -cmp({v1}, {v2}, {opts}) *version.cmp()* +cmp({v1}, {v2}, {opts}) *vim.version.cmp()* Compares two strings ( `v1` and `v2` ) in semver format. Parameters: ~ • {v1} (string) Version. - • {v2} (string) Version to be compared with v1. + • {v2} (string) Version to compare with v1. • {opts} (table|nil) Optional keyword arguments: • strict (boolean): see `semver.parse` for details. Defaults to false. @@ -2514,59 +2514,54 @@ cmp({v1}, {v2}, {opts}) *version.cmp()* Return: ~ (integer) `-1` if `v1 < v2`, `0` if `v1 == v2`, `1` if `v1 > v2`. -eq({version_1}, {version_2}) *version.eq()* +eq({v1}, {v2}) *vim.version.eq()* Returns `true` if `v1` are `v2` are equal versions. Parameters: ~ - • {version_1} (string) - • {version_2} (string) + • {v1} (string) + • {v2} (string) Return: ~ (boolean) -gt({version_1}, {version_2}) *version.gt()* +gt({v1}, {v2}) *vim.version.gt()* Returns `true` if `v1` is greater than `v2` . Parameters: ~ - • {version_1} (string) - • {version_2} (string) + • {v1} (string) + • {v2} (string) Return: ~ (boolean) -lt({version_1}, {version_2}) *version.lt()* +lt({v1}, {v2}) *vim.version.lt()* Returns `true` if `v1` is less than `v2` . Parameters: ~ - • {version_1} (string) - • {version_2} (string) + • {v1} (string) + • {v2} (string) Return: ~ (boolean) -parse({version}, {opts}) *version.parse()* - Parses a semantically formatted version string into a table. +parse({version}, {opts}) *vim.version.parse()* + Parses a semantic version string. - Supports leading "v" and leading and trailing whitespace in the version - string. e.g. `" v1.0.1-rc1+build.2"` , `"1.0.1-rc1+build.2"`, - `"v1.0.1-rc1+build.2"` and `"v1.0.1-rc1+build.2 "` will be parsed as: + Ignores leading "v" and surrounding whitespace, e.g. " + v1.0.1-rc1+build.2", "1.0.1-rc1+build.2", "v1.0.1-rc1+build.2" and + "v1.0.1-rc1+build.2 " are all parsed as: > - { major = 1, minor = 0, patch = 1, prerelease = 'rc1 , build = 'build.2' }` + { major = 1, minor = 0, patch = 1, prerelease = "rc1", build = "build.2" } +< Parameters: ~ • {version} (string) Version string to be parsed. • {opts} (table|nil) Optional keyword arguments: - • strict (boolean): when set to `true` an error will be - thrown for version strings that do not conform to the - semver specification (v2.0.0) (see - semver.org/spec/v2.0.0.html for details). This means that - `semver.parse('v1.2)` will throw an error. When set to - `false`, `semver.parse('v1.2)` will coerce 'v1.2' to - 'v1.2.0' and return the table: `{ major = 1, minor = 2, - patch = 0 }`. Defaults to false. + • strict (boolean): Default false. If `true` , no coercion is attempted on input not strictly + conforming to semver v2.0.0 ( https://semver.org/spec/v2.0.0.html ). E.g. `parse("v1.2")` returns nil. Return: ~ (table|nil) parsed_version Parsed version table or `nil` if `version` - is not valid. + is invalid. vim:tw=78:ts=8:sw=4:sts=4:et:ft=help:norl: diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index b5cb975066..28fdaa770d 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -55,9 +55,8 @@ NEW FEATURES *news-features* The following new APIs or features were added. -• Added |version.parse()|, |version.cmp()|, |version.lt()|, |version.eq()| - and |version.gt()| to |vim.version| for parsing and comparing version numbers - according to the semver specification, see |lua-version|. +• Added |vim.version| for parsing and comparing version strings conforming to + the semver specification, see |lua-version|. • A new environment variable named NVIM_APPNAME enables configuring the directories where Neovim should find its configuration and state files. See -- cgit From 1cc23e1109ed88275df5c986c352f73b99a0301c Mon Sep 17 00:00:00 2001 From: swarn Date: Mon, 6 Mar 2023 12:03:13 -0600 Subject: feat(lsp)!: add rule-based sem token highlighting (#22022) feat(lsp)!: change semantic token highlighting Change the default highlights used, and add more highlights per token. Add an LspTokenUpdate event and a highlight_token function. :Inspect now shows any highlights applied by token highlighting rules, default or user-defined. BREAKING CHANGE: change the default highlight groups used by semantic token highlighting. --- runtime/doc/lsp.txt | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++- runtime/doc/news.txt | 2 +- 2 files changed, 119 insertions(+), 3 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 7e46698614..0d7e8e7ab4 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -482,6 +482,71 @@ LspSignatureActiveParameter Used to highlight the active parameter in the signature help. See |vim.lsp.handlers.signature_help()|. +------------------------------------------------------------------------------ +LSP SEMANTIC HIGHLIGHTS *lsp-semantic-highlight* + +When available, the LSP client highlights code using |lsp-semantic_tokens|, +which are another way that LSP servers can provide information about source +code. Note that this is in addition to treesitter syntax highlighting; +semantic highlighting does not replace syntax highlighting. + +The server will typically provide one token per identifier in the source code. +The token will have a `type` such as "function" or "variable", and 0 or more +`modifier`s such as "readonly" or "deprecated." The standard types and +modifiers are described here: +https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_semanticTokens +LSP servers may also use off-spec types and modifiers. + +The LSP client adds one or more highlights for each token. The highlight +groups are derived from the token's type and modifiers: + • `@lsp.type..` for the type + • `@lsp.mod..` for each modifier + • `@lsp.typemod...` for each modifier +Use |:Inspect| to view the higlights for a specific token. Use |:hi| or +|nvim_set_hl()| to change the appearance of semantic highlights: >vim + + hi @lsp.type.function guifg=Yellow " function names are yellow + hi @lsp.type.variable.lua guifg=Green " variables in lua are green + hi @lsp.mod.deprecated gui=strikethrough " deprecated is crossed out + hi @lsp.typemod.function.async guifg=Blue " async functions are blue +< +The value |vim.highlight.priorities|`.semantic_tokens` is the priority of the +`@lsp.type.*` highlights. The `@lsp.mod.*` and `@lsp.typemod.*` highlights +have priorities one and two higher, respectively. + +You can disable semantic highlights by clearing the highlight groups: >lua + + -- Hide semantic highlights for functions + vim.api.nvim_set_hl(0, '@lsp.type.function', {}) + + -- Hide all semantic highlights + for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do + vim.api.nvim_set_hl(0, group, {}) + end +< +You probably want these inside a |ColorScheme| autocommand. + +Use |LspTokenUpdate| and |vim.lsp.semantic_tokens.highlight_token()| for more +complex highlighting. + +The following groups are linked by default to standard |group-name|s: +> + @lsp.type.class Structure + @lsp.type.decorator Function + @lsp.type.enum Structure + @lsp.type.enumMember Constant + @lsp.type.function Function + @lsp.type.interface Structure + @lsp.type.macro Macro + @lsp.type.method Function + @lsp.type.namespace Structure + @lsp.type.parameter Identifier + @lsp.type.property Identifier + @lsp.type.struct Structure + @lsp.type.type Type + @lsp.type.typeParameter TypeDef + @lsp.type.variable Identifier +< ============================================================================== EVENTS *lsp-events* @@ -516,6 +581,29 @@ callback in the "data" table. Example: >lua end, }) < + +LspTokenUpdate *LspTokenUpdate* + +When a visible semantic token is sent or updated by the LSP server, or when an +existing token becomes visible for the first time. The |autocmd-pattern| is +the name of the buffer. When used from Lua, the token and client ID are passed +to the callback in the "data" table. The token fields are documented in +|vim.lsp.semantic_tokens.get_at_pos()|. Example: >lua + + vim.api.nvim_create_autocmd('LspTokenUpdate', { + callback = function(args) + local token = args.data.token + if token.type == 'variable' and not token.modifiers.readonly then + vim.lsp.semantic_tokens.highlight_token( + token, args.buf, args.data.client_id, 'MyMutableVariableHighlight' + ) + end + end, + }) +< +Note: doing anything other than calling +|vim.lsp.semantic_tokens.highlight_token()| is considered experimental. + Also the following |User| |autocommand|s are provided: LspProgressUpdate *LspProgressUpdate* @@ -1332,7 +1420,8 @@ force_refresh({bufnr}) *vim.lsp.semantic_tokens.force_refresh()* highlighting (|vim.lsp.semantic_tokens.start()| has been called for it) Parameters: ~ - • {bufnr} (nil|number) default: current buffer + • {bufnr} (number|nil) filter by buffer. All buffers if nil, current + buffer if 0 *vim.lsp.semantic_tokens.get_at_pos()* get_at_pos({bufnr}, {row}, {col}) @@ -1345,7 +1434,34 @@ get_at_pos({bufnr}, {row}, {col}) • {col} (number|nil) Position column (default cursor position) Return: ~ - (table|nil) List of tokens at position + (table|nil) List of tokens at position. Each token has the following + fields: + • line (number) line number, 0-based + • start_col (number) start column, 0-based + • end_col (number) end column, 0-based + • type (string) token type as string, e.g. "variable" + • modifiers (table) token modifiers as a set. E.g., { static = true, + readonly = true } + + *vim.lsp.semantic_tokens.highlight_token()* +highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts}) + Highlight a semantic token. + + Apply an extmark with a given highlight group for a semantic token. The + mark will be deleted by the semantic token engine when appropriate; for + example, when the LSP sends updated tokens. This function is intended for + use inside |LspTokenUpdate| callbacks. + + Parameters: ~ + • {token} (table) a semantic token, found as `args.data.token` in + |LspTokenUpdate|. + • {bufnr} (number) the buffer to highlight + • {client_id} (number) The ID of the |vim.lsp.client| + • {hl_group} (string) Highlight group name + • {opts} (table|nil) Optional parameters. + • priority: (number|nil) Priority for the applied + extmark. Defaults to + `vim.highlight.priorities.semantic_tokens + 3` start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()* Start the semantic token highlighting engine for the given buffer with the diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 28fdaa770d..825496cff5 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -90,7 +90,7 @@ The following new APIs or features were added. `semanticTokensProvider` from the LSP client's {server_capabilities} in the `LspAttach` callback. - See |lsp-semantic_tokens| for more information. + See |lsp-semantic-highlight| for more information. • |vim.treesitter.inspect_tree()| and |:InspectTree| opens a split window showing a text representation of the nodes in a language tree for the current -- cgit From 79571b92ced968ad27bee2a7515a4a04e84dbad2 Mon Sep 17 00:00:00 2001 From: Björn Linse Date: Wed, 27 Jan 2021 09:00:28 +0100 Subject: feat(lua): omnifunc for builting lua interpreter also make implicit submodules "uri" and "_inspector" work with completion this is needed for `:lua=vim.uri_` wildmenu completion to work even before uri or _inspector functions are used. --- runtime/doc/lua.txt | 6 ++++++ runtime/doc/news.txt | 2 ++ 2 files changed, 8 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt index 1eb5ab41e6..cb309eaf1a 100644 --- a/runtime/doc/lua.txt +++ b/runtime/doc/lua.txt @@ -1404,6 +1404,12 @@ inspect({object}, {options}) *vim.inspect()* https://github.com/kikito/inspect.lua https://github.com/mpeterv/vinspect +lua_omnifunc({find_start}, {_}) *vim.lua_omnifunc()* + Omnifunc for completing lua values from from the runtime lua interpreter, + similar to the builtin completion for the `:lua` command. + + Activate using `set omnifunc=v:lua.vim.lua_omnifunc` in a lua buffer. + notify({msg}, {level}, {opts}) *vim.notify()* Display a notification to the user. diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 415195e27e..41b59681ae 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -189,6 +189,8 @@ The following new APIs or features were added. disabled by default and can be enabled by setting the `workspace.didChangeWatchedFiles.dynamicRegistration=true` capability. +• Added an omnifunc implementation for lua, |vim.lua_omnifunc()| + ============================================================================== CHANGED FEATURES *news-changes* -- cgit From 2882b1543a4f30ee3d7b039a5d51bb994fd6aa1d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 7 Mar 2023 11:04:36 +0800 Subject: vim-patch:8.2.3969: value of MAXCOL not available in Vim script Problem: Value of MAXCOL not available in Vim script. Solution: Add v:maxcol. (Naohiro Ono, closes vim/vim#9451) https://github.com/vim/vim/commit/56200eed62e59ad831f6564dcafe346e6f97ac20 The variable is always 2147483647, but introducing it makes functions easier to document. Co-authored-by: naohiro ono --- runtime/doc/builtin.txt | 22 +++++++++++++++------- runtime/doc/eval.txt | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index 7fab2ac6ff..dd5b77e8ac 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -2890,6 +2890,9 @@ getcharpos({expr}) Get the position for String {expr}. Same as |getpos()| but the column number in the returned List is a character index instead of a byte index. + If |getpos()| returns a very large column number, equal to + |v:maxcol|, then getcharpos() will return the character index + of the last character. Example: With the cursor on '세' in line 5 with text "여보세요": > @@ -3064,10 +3067,11 @@ getcompletion({pat}, {type} [, {filtered}]) *getcompletion()* *getcurpos()* getcurpos([{winid}]) Get the position of the cursor. This is like getpos('.'), but - includes an extra "curswant" in the list: + includes an extra "curswant" item in the list: [0, lnum, col, off, curswant] ~ The "curswant" number is the preferred column when moving the - cursor vertically. Also see |getcursorcharpos()| and + cursor vertically. After |$| command it will be a very large + number equal to |v:maxcol|. Also see |getcursorcharpos()| and |getpos()|. The first "bufnum" item is always zero. The byte position of the cursor is returned in "col". To get the character @@ -3389,12 +3393,12 @@ getpos({expr}) Get the position for String {expr}. For possible values of character. Note that for '< and '> Visual mode matters: when it is "V" (visual line mode) the column of '< is zero and the column of - '> is a large number. + '> is a large number equal to |v:maxcol|. The column number in the returned List is the byte position within the line. To get the character position in the line, use |getcharpos()|. - The column number can be very large, e.g. 2147483647, in which - case it means "after the end of the line". + A very large column number equal to |v:maxcol| can be returned, + in which case it means "after the end of the line". If {expr} is invalid, returns a list with all zeros. This can be used to save and restore the position of a mark: > let save_a_mark = getpos("'a") @@ -9407,10 +9411,14 @@ winsaveview() Returns a |Dictionary| that contains information to restore The return value includes: lnum cursor line number col cursor column (Note: the first column - zero, as opposed to what getpos() + zero, as opposed to what |getcurpos()| returns) coladd cursor column offset for 'virtualedit' - curswant column for vertical movement + curswant column for vertical movement (Note: + the first column is zero, as opposed + to what |getcurpos()| returns). After + |$| command it will be a very large + number equal to |v:maxcol|. topline first line in the window topfill filler lines, only in diff mode leftcol first column displayed; only used when diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index d79b446986..51e26cc28b 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1979,6 +1979,9 @@ v:lnum Line number for the 'foldexpr' |fold-expr|, 'formatexpr', v:lua Prefix for calling Lua functions from expressions. See |v:lua-call| for more information. + *v:maxcol* *maxcol-variable* +v:maxcol Maximum line length. + *v:mouse_win* *mouse_win-variable* v:mouse_win Window number for a mouse click obtained with |getchar()|. First window has number 1, like with |winnr()|. The value is -- cgit From 08d0f99ae122b21e9470d58224edd69d1615ee3d Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 7 Mar 2023 11:41:25 +0800 Subject: vim-patch:partial:944697ae196 Update runtime files https://github.com/vim/vim/commit/944697ae19683441981539cd4d2469df89d6ec82 Co-authored-by: Bram Moolenaar --- runtime/doc/builtin.txt | 2 ++ runtime/doc/eval.txt | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt index dd5b77e8ac..b0b7809e8c 100644 --- a/runtime/doc/builtin.txt +++ b/runtime/doc/builtin.txt @@ -6574,6 +6574,8 @@ screenpos({winid}, {lnum}, {col}) *screenpos()* as if 'conceallevel' is zero. You can set the cursor to the right position and use |screencol()| to get the value with |conceal| taken into account. + If the position is in a closed fold the screen position of the + first character is returned, {col} is not used. Returns an empty Dict if {winid} is invalid. Can also be used as a |method|: > diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index 51e26cc28b..fe15ba6115 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1980,7 +1980,9 @@ v:lua Prefix for calling Lua functions from expressions. See |v:lua-call| for more information. *v:maxcol* *maxcol-variable* -v:maxcol Maximum line length. +v:maxcol Maximum line length. Depending on where it is used it can be + screen columns, characters or bytes. The value currently is + 2147483647 on all systems. *v:mouse_win* *mouse_win-variable* v:mouse_win Window number for a mouse click obtained with |getchar()|. -- cgit From 706bcab75eaad2c370d61bf828531054439d3a3e Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Tue, 7 Mar 2023 15:17:52 +0900 Subject: docs(lsp): change type annotations from number → integer (#22510) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/doc/lsp.txt | 150 ++++++++++++++++++++++++++-------------------------- 1 file changed, 76 insertions(+), 74 deletions(-) (limited to 'runtime/doc') diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 0d7e8e7ab4..b73e2958ef 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -629,8 +629,8 @@ buf_attach_client({bufnr}, {client_id}) *vim.lsp.buf_attach_client()* Without calling this, the server won't be notified of changes to a buffer. Parameters: ~ - • {bufnr} (number) Buffer handle, or 0 for current - • {client_id} (number) Client id + • {bufnr} (integer) Buffer handle, or 0 for current + • {client_id} (integer) Client id buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()* Detaches client from the specified buffer. Note: While the server is @@ -638,15 +638,15 @@ buf_detach_client({bufnr}, {client_id}) *vim.lsp.buf_detach_client()* send notifications should it ignore this notification. Parameters: ~ - • {bufnr} (number) Buffer handle, or 0 for current - • {client_id} (number) Client id + • {bufnr} (integer) Buffer handle, or 0 for current + • {client_id} (integer) Client id buf_is_attached({bufnr}, {client_id}) *vim.lsp.buf_is_attached()* Checks if a buffer is attached for a particular client. Parameters: ~ - • {bufnr} (number) Buffer handle, or 0 for current - • {client_id} (number) the client id + • {bufnr} (integer) Buffer handle, or 0 for current + • {client_id} (integer) the client id buf_notify({bufnr}, {method}, {params}) *vim.lsp.buf_notify()* Send a notification to a server @@ -666,7 +666,7 @@ buf_request_all({bufnr}, {method}, {params}, {callback}) |vim.lsp.buf_request()| but the return result and callback are different. Parameters: ~ - • {bufnr} (number) Buffer handle, or 0 for current. + • {bufnr} (integer) Buffer handle, or 0 for current. • {method} (string) LSP method name • {params} (table|nil) Parameters to send to the server • {callback} (function) The callback to call when all requests are @@ -687,10 +687,10 @@ buf_request_sync({bufnr}, {method}, {params}, {timeout_ms}) result is different. Wait maximum of {timeout_ms} (default 1000) ms. Parameters: ~ - • {bufnr} (number) Buffer handle, or 0 for current. + • {bufnr} (integer) Buffer handle, or 0 for current. • {method} (string) LSP method name • {params} (table|nil) Parameters to send to the server - • {timeout_ms} (number|nil) Maximum time in milliseconds to wait for a + • {timeout_ms} (integer|nil) Maximum time in milliseconds to wait for a result. Defaults to 1000 Return: ~ @@ -759,7 +759,7 @@ client_is_stopped({client_id}) *vim.lsp.client_is_stopped()* Checks whether a client is stopped. Parameters: ~ - • {client_id} (number) + • {client_id} (integer) Return: ~ (boolean) stopped true if client is stopped, false otherwise. @@ -769,7 +769,7 @@ for_each_buffer_client({bufnr}, {fn}) Invokes a function for each LSP client attached to a buffer. Parameters: ~ - • {bufnr} (number) Buffer number + • {bufnr} (integer) Buffer number • {fn} (function) Function to run on each client attached to buffer {bufnr}. The function takes the client, client ID, and buffer number as arguments. Example: >lua @@ -823,7 +823,7 @@ get_client_by_id({client_id}) *vim.lsp.get_client_by_id()* not yet be fully initialized. Parameters: ~ - • {client_id} (number) client id + • {client_id} (integer) client id Return: ~ |vim.lsp.client| object, or nil @@ -838,11 +838,11 @@ omnifunc({findstart}, {base}) *vim.lsp.omnifunc()* Implements 'omnifunc' compatible LSP completion. Parameters: ~ - • {findstart} (number) 0 or 1, decides behavior - • {base} (number) findstart=0, text to match against + • {findstart} (integer) 0 or 1, decides behavior + • {base} (integer) findstart=0, text to match against Return: ~ - (number) Decided by {findstart}: + (integer) Decided by {findstart}: • findstart=0: column where the completion starts, or -2 or -3 • findstart=1: list of matches (actually just calls |complete()|) @@ -861,7 +861,7 @@ set_log_level({level}) *vim.lsp.set_log_level()* Use `lsp.log_levels` for reverse lookup. Parameters: ~ - • {level} (number|string) the case insensitive level name or number + • {level} (integer|string) the case insensitive level name or number See also: ~ |vim.lsp.log_levels| @@ -1052,7 +1052,7 @@ stop_client({client_id}, {force}) *vim.lsp.stop_client()* for this client, then force-shutdown is attempted. Parameters: ~ - • {client_id} number|table id or |vim.lsp.client| object, or list + • {client_id} integer|table id or |vim.lsp.client| object, or list thereof • {force} (boolean|nil) shutdown forcefully @@ -1326,7 +1326,7 @@ get_namespace({client_id}) *vim.lsp.diagnostic.get_namespace()* |vim.diagnostic|. Parameters: ~ - • {client_id} (number) The id of the LSP client + • {client_id} (integer) The id of the LSP client *vim.lsp.diagnostic.on_publish_diagnostics()* on_publish_diagnostics({_}, {result}, {ctx}, {config}) @@ -1365,22 +1365,23 @@ clear({client_id}, {bufnr}) *vim.lsp.codelens.clear()* Clear the lenses Parameters: ~ - • {client_id} (number|nil) filter by client_id. All clients if nil - • {bufnr} (number|nil) filter by buffer. All buffers if nil + • {client_id} (integer|nil) filter by client_id. All clients if nil + • {bufnr} (integer|nil) filter by buffer. All buffers if nil display({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.display()* Display the lenses using virtual text Parameters: ~ • {lenses} (table) of lenses to display (`CodeLens[] | null`) - • {bufnr} (number) - • {client_id} (number) + • {bufnr} (integer) + • {client_id} (integer) get({bufnr}) *vim.lsp.codelens.get()* Return all lenses for the given buffer Parameters: ~ - • {bufnr} (number) Buffer number. 0 can be used for the current buffer. + • {bufnr} (integer) Buffer number. 0 can be used for the current + buffer. Return: ~ (table) (`CodeLens[]`) @@ -1406,8 +1407,8 @@ save({lenses}, {bufnr}, {client_id}) *vim.lsp.codelens.save()* Parameters: ~ • {lenses} (table) of lenses to store (`CodeLens[] | null`) - • {bufnr} (number) - • {client_id} (number) + • {bufnr} (integer) + • {client_id} (integer) ============================================================================== @@ -1420,7 +1421,7 @@ force_refresh({bufnr}) *vim.lsp.semantic_tokens.force_refresh()* highlighting (|vim.lsp.semantic_tokens.start()| has been called for it) Parameters: ~ - • {bufnr} (number|nil) filter by buffer. All buffers if nil, current + • {bufnr} (integer|nil) filter by buffer. All buffers if nil, current buffer if 0 *vim.lsp.semantic_tokens.get_at_pos()* @@ -1429,16 +1430,16 @@ get_at_pos({bufnr}, {row}, {col}) arguments, returns the token under the cursor. Parameters: ~ - • {bufnr} (number|nil) Buffer number (0 for current buffer, default) - • {row} (number|nil) Position row (default cursor position) - • {col} (number|nil) Position column (default cursor position) + • {bufnr} (integer|nil) Buffer number (0 for current buffer, default) + • {row} (integer|nil) Position row (default cursor position) + • {col} (integer|nil) Position column (default cursor position) Return: ~ (table|nil) List of tokens at position. Each token has the following fields: - • line (number) line number, 0-based - • start_col (number) start column, 0-based - • end_col (number) end column, 0-based + • line (integer) line number, 0-based + • start_col (integer) start column, 0-based + • end_col (integer) end column, 0-based • type (string) token type as string, e.g. "variable" • modifiers (table) token modifiers as a set. E.g., { static = true, readonly = true } @@ -1455,11 +1456,11 @@ highlight_token({token}, {bufnr}, {client_id}, {hl_group}, {opts}) Parameters: ~ • {token} (table) a semantic token, found as `args.data.token` in |LspTokenUpdate|. - • {bufnr} (number) the buffer to highlight - • {client_id} (number) The ID of the |vim.lsp.client| + • {bufnr} (integer) the buffer to highlight + • {client_id} (integer) The ID of the |vim.lsp.client| • {hl_group} (string) Highlight group name • {opts} (table|nil) Optional parameters. - • priority: (number|nil) Priority for the applied + • priority: (integer|nil) Priority for the applied extmark. Defaults to `vim.highlight.priorities.semantic_tokens + 3` @@ -1477,10 +1478,10 @@ start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()* < Parameters: ~ - • {bufnr} (number) - • {client_id} (number) + • {bufnr} (integer) + • {client_id} (integer) • {opts} (nil|table) Optional keyword arguments - • debounce (number, default: 200): Debounce token + • debounce (integer, default: 200): Debounce token requests to the server by the given number in milliseconds @@ -1494,8 +1495,8 @@ stop({bufnr}, {client_id}) *vim.lsp.semantic_tokens.stop()* from the buffer. Parameters: ~ - • {bufnr} (number) - • {client_id} (number) + • {bufnr} (integer) + • {client_id} (integer) ============================================================================== @@ -1550,7 +1551,7 @@ apply_text_document_edit({text_document_edit}, {index}, {offset_encoding}) Parameters: ~ • {text_document_edit} (table) a `TextDocumentEdit` object - • {index} (number) Optional index of the edit, if from a + • {index} (integer) Optional index of the edit, if from a list of edits (or nil, if not from a list) See also: ~ @@ -1562,7 +1563,7 @@ apply_text_edits({text_edits}, {bufnr}, {offset_encoding}) Parameters: ~ • {text_edits} (table) list of `TextEdit` objects - • {bufnr} (number) Buffer id + • {bufnr} (integer) Buffer id • {offset_encoding} (string) utf-8|utf-16|utf-32 See also: ~ @@ -1580,14 +1581,14 @@ buf_clear_references({bufnr}) *vim.lsp.util.buf_clear_references()* Removes document highlights from a buffer. Parameters: ~ - • {bufnr} (number) Buffer id + • {bufnr} (integer) Buffer id *vim.lsp.util.buf_highlight_references()* buf_highlight_references({bufnr}, {references}, {offset_encoding}) Shows a list of document highlights for a certain buffer. Parameters: ~ - • {bufnr} (number) Buffer id + • {bufnr} (integer) Buffer id • {references} (table) List of `DocumentHighlight` objects to highlight • {offset_encoding} (string) One of "utf-8", "utf-16", "utf-32". @@ -1600,14 +1601,14 @@ character_offset({buf}, {row}, {col}, {offset_encoding}) Returns the UTF-32 and UTF-16 offsets for a position in a certain buffer. Parameters: ~ - • {buf} (number) buffer number (0 for current) + • {buf} (integer) buffer number (0 for current) • {row} 0-indexed line • {col} 0-indexed byte offset in line • {offset_encoding} (string) utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of `buf` Return: ~ - (number, number) `offset_encoding` index of the character in line + (integer, integer) `offset_encoding` index of the character in line {row} column {col} in buffer {buf} *vim.lsp.util.convert_input_to_markdown_lines()* @@ -1662,10 +1663,10 @@ get_effective_tabstop({bufnr}) *vim.lsp.util.get_effective_tabstop()* Returns indentation size. Parameters: ~ - • {bufnr} (number|nil) Buffer handle, defaults to current + • {bufnr} (integer|nil) Buffer handle, defaults to current Return: ~ - (number) indentation size + (integer) indentation size See also: ~ 'shiftwidth' @@ -1715,11 +1716,11 @@ make_floating_popup_options({width}, {height}, {opts}) table can be passed to |nvim_open_win()|. Parameters: ~ - • {width} (number) window width (in character cells) - • {height} (number) window height (in character cells) + • {width} (integer) window width (in character cells) + • {height} (integer) window height (in character cells) • {opts} (table, optional) - • offset_x (number) offset to add to `col` - • offset_y (number) offset to add to `row` + • offset_x (integer) offset to add to `col` + • offset_y (integer) offset to add to `row` • border (string or table) override `border` • focusable (string or table) override `focusable` • zindex (string or table) override `zindex`, defaults to 50 @@ -1748,11 +1749,11 @@ make_given_range_params({start_pos}, {end_pos}, {bufnr}, {offset_encoding}) similar to |vim.lsp.util.make_range_params()|. Parameters: ~ - • {start_pos} number[]|nil {row, col} mark-indexed position. + • {start_pos} integer[]|nil {row, col} mark-indexed position. Defaults to the start of the last visual selection. - • {end_pos} number[]|nil {row, col} mark-indexed position. + • {end_pos} integer[]|nil {row, col} mark-indexed position. Defaults to the end of the last visual selection. - • {bufnr} (number|nil) buffer handle or 0 for current, + • {bufnr} (integer|nil) buffer handle or 0 for current, defaults to current • {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to `offset_encoding` of first client of `bufnr` @@ -1767,7 +1768,7 @@ make_position_params({window}, {offset_encoding}) cursor position. Parameters: ~ - • {window} (number|nil) window handle or 0 for current, + • {window} (integer|nil) window handle or 0 for current, defaults to current • {offset_encoding} (string|nil) utf-8|utf-16|utf-32|nil defaults to `offset_encoding` of first client of buffer of @@ -1787,7 +1788,7 @@ make_range_params({window}, {offset_encoding}) `textDocument/rangeFormatting`. Parameters: ~ - • {window} (number|nil) window handle or 0 for current, + • {window} (integer|nil) window handle or 0 for current, defaults to current • {offset_encoding} "utf-8"|"utf-16"|"utf-32"|nil defaults to `offset_encoding` of first client of buffer of @@ -1802,7 +1803,7 @@ make_text_document_params({bufnr}) Creates a `TextDocumentIdentifier` object for the current buffer. Parameters: ~ - • {bufnr} (number|nil) Buffer handle, defaults to current + • {bufnr} (integer|nil) Buffer handle, defaults to current Return: ~ `TextDocumentIdentifier` @@ -1827,15 +1828,16 @@ open_floating_preview({contents}, {syntax}, {opts}) • {syntax} (string) of syntax to set for opened buffer • {opts} (table) with optional fields (additional keys are passed on to |nvim_open_win()|) - • height: (number) height of floating window - • width: (number) width of floating window + • height: (integer) height of floating window + • width: (integer) width of floating window • wrap: (boolean, default true) wrap long lines - • wrap_at: (number) character to wrap at for computing + • wrap_at: (integer) character to wrap at for computing height when wrap is enabled - • max_width: (number) maximal width of floating window - • max_height: (number) maximal height of floating window - • pad_top: (number) number of lines to pad contents at top - • pad_bottom: (number) number of lines to pad contents at + • max_width: (integer) maximal width of floating window + • max_height: (integer) maximal height of floating window + • pad_top: (integer) number of lines to pad contents at + top + • pad_bottom: (integer) number of lines to pad contents at bottom • focus_id: (string) if a popup with this id is opened, then focus it @@ -2008,13 +2010,13 @@ set_level({level}) *vim.lsp.log.set_level()* Sets the current log level. Parameters: ~ - • {level} (string|number) One of `vim.lsp.log.levels` + • {level} (string|integer) One of `vim.lsp.log.levels` should_log({level}) *vim.lsp.log.should_log()* Checks whether the level is sufficient for logging. Parameters: ~ - • {level} (number) log level + • {level} (integer) log level Return: ~ (bool) true if would log, false if not @@ -2029,7 +2031,7 @@ connect({host}, {port}) *vim.lsp.rpc.connect()* Parameters: ~ • {host} (string) - • {port} (number) + • {port} (integer) Return: ~ (function) @@ -2074,7 +2076,7 @@ rpc_response_error({code}, {message}, {data}) Creates an RPC response object/table. Parameters: ~ - • {code} (number) RPC error code defined in + • {code} (integer) RPC error code defined in `vim.lsp.protocol.ErrorCodes` • {message} (string|nil) arbitrary message to send to server • {data} any|nil arbitrary data to send to server @@ -2122,11 +2124,11 @@ compute_diff({___MissingCloseParenHere___}) Parameters: ~ • {prev_lines} (table) list of lines • {curr_lines} (table) list of lines - • {firstline} (number) line to begin search for first difference - • {lastline} (number) line to begin search in old_lines for last - difference - • {new_lastline} (number) line to begin search in new_lines for last - difference + • {firstline} (integer) line to begin search for first difference + • {lastline} (integer) line to begin search in old_lines for + last difference + • {new_lastline} (integer) line to begin search in new_lines for + last difference • {offset_encoding} (string) encoding requested by language server Return: ~ -- cgit From 1637bcce7ba52c4c5c451308f8a3adfedde18a2a Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 7 Mar 2023 09:39:08 +0100 Subject: build!: make libintl a required dependency Libintl being an optional dependency is not by design, but a workaround as it didn't use work on all platforms. That should be fixed by now. --- runtime/doc/news.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 2db1e75bf7..254ffc51b8 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -45,7 +45,7 @@ The following changes may require adaptations in user config or plugins. - `printheader` - `printmbcharset` -• libiconv is now a required build dependency. +• libiconv and intl are now required build dependencies. • Unsaved changes are now preserved rather than discarded when |channel-stdio| is closed. -- cgit From 304477ff3504373a336c83127654e65eddfa2ef9 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 7 Mar 2023 15:13:09 +0100 Subject: fix(man.lua): tests, naming --- runtime/doc/news.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index 254ffc51b8..f5b9f39d93 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -162,6 +162,8 @@ The following new APIs or features were added. • |:highlight| now supports an additional attribute "altfont". +• |:Man| manpage viewer supports manpage names containing spaces. + • Treesitter captures can now be transformed by directives. This will allow more complicated dynamic language injections. -- cgit From ddd257f75301a50c177fc24a693d39a45b47a689 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 8 Mar 2023 11:03:11 +0000 Subject: feat(treesitter): use upstream format for injection queries --- runtime/doc/news.txt | 4 ++++ runtime/doc/treesitter.txt | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'runtime/doc') diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt index f5b9f39d93..04ae9360a0 100644 --- a/runtime/doc/news.txt +++ b/runtime/doc/news.txt @@ -196,6 +196,10 @@ The following new APIs or features were added. • Added an omnifunc implementation for lua, |vim.lua_omnifunc()| +• Treesitter injection queries now use the format described at + https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection . + Support for the previous format will be removed in a future release. + ============================================================================== CHANGED FEATURES *news-changes* diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index 1f78e4d5d9..3b0936941f 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -441,7 +441,53 @@ individual query pattern manually by setting its `"priority"` metadata attribute: > (super_important_node) @ImportantHighlight (#set! "priority" 105) + +============================================================================== +TREESITTER LANGUAGE INJECTIONS *treesitter-language-injections* < + +Note the following information is adapted from: + https://tree-sitter.github.io/tree-sitter/syntax-highlighting#language-injection + +Some source files contain code written in multiple different languages. +Examples include: + + • HTML files, which can contain JavaScript inside of `