diff options
Diffstat (limited to 'runtime/doc')
-rw-r--r-- | runtime/doc/api.txt | 81 | ||||
-rw-r--r-- | runtime/doc/change.txt | 10 | ||||
-rw-r--r-- | runtime/doc/lsp.txt | 2 | ||||
-rw-r--r-- | runtime/doc/options.txt | 2 | ||||
-rw-r--r-- | runtime/doc/treesitter.txt | 58 |
5 files changed, 114 insertions, 39 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 755e7becb3..c4b4594290 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -376,7 +376,7 @@ on writing and loading a buffer to file, nor in undo/redo cycles. Highlights are registered using the |nvim_buf_add_highlight()| function. If an external highlighter plugin wants to add many highlights in a batch, performance can be improved by calling |nvim_buf_add_highlight()| as an -asynchronous notification, after first (synchronously) reqesting a source id. +asynchronous notification, after first (synchronously) requesting a source id. Example using the Python API client (|pynvim|): > @@ -646,6 +646,9 @@ nvim_create_namespace({name}) *nvim_create_namespace()* nvim_del_current_line() *nvim_del_current_line()* Deletes the current line. + Attributes: ~ + not allowed when |textlock| is active + nvim_del_keymap({mode}, {lhs}) *nvim_del_keymap()* Unmaps a global |mapping| for the given mode. @@ -755,6 +758,15 @@ nvim_feedkeys({keys}, {mode}, {escape_csi}) *nvim_feedkeys()* feedkeys() vim_strsave_escape_csi +nvim_get_all_options_info() *nvim_get_all_options_info()* + Gets the option information for all options. + + The dictionary has the full option names as keys and option + metadata dictionaries as detailed at |nvim_get_option_info|. + + Return: ~ + dictionary of all options + nvim_get_api_info() *nvim_get_api_info()* Returns a 2-tuple (Array), where item 0 is the current channel id and item 1 is the |api-metadata| map (Dictionary). @@ -937,22 +949,18 @@ nvim_get_option_info({name}) *nvim_get_option_info()* Gets the option information for one option Resulting dictionary has keys: - • name (string): Name of the option - • shortname (shortname): Shortened name of the option - • type (string): Name of the type of option - • default (Any): The default value for the option - - Script-Related Keys: - • was_set (bool): Whether the option was set. - • last_set_sid (int): Last set script id - • last_set_linenr (int): Last set script id, -1 if invalid. - • last_set_lchan (int): Last set script id, -1 if invalid. - - Flag-Related Keys: - • win (bool): Window-local option - • buf (bool): Buffer-local option - • global_local (bool): Global or Buffer local option - • flaglist (bool): List of single char flags + • name: Name of the option (like 'filetype') + • shortname: Shortened name of the option (like 'ft') + • type: type of option ("string", "integer" or "boolean") + • default: The default value for the option + • was_set: Whether the option was set. + • last_set_sid: Last set script id (if any) + • last_set_linenr: line number where option was set + • last_set_chan: Channel where option was set (0 for local) + • scope: one of "global", "win", or "buf" + • global_local: whether win or buf option has a global value + • commalist: List of comma separated values + • flaglist: List of single char flags Parameters: ~ {name} Option name @@ -960,12 +968,6 @@ nvim_get_option_info({name}) *nvim_get_option_info()* Return: ~ Option Information -nvim_get_options_info() *nvim_get_options_info()* - Gets the option information for all options. - - Return: ~ - Map<option_name, option_info> - nvim_get_proc({pid}) *nvim_get_proc()* Gets info describing process `pid` . @@ -1174,6 +1176,9 @@ nvim_open_win({buffer}, {enter}, {config}) *nvim_open_win()* {relative='win', width=12, height=3, bufpos={100,10}}) < + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {buffer} Buffer to display, or 0 for current buffer {enter} Enter the window (make it the current window) @@ -1352,6 +1357,9 @@ nvim_paste({data}, {crlf}, {phase}) *nvim_paste()* calls are ignored ("drained") until the next paste is initiated (phase 1 or -1). + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {data} Multiline input. May be binary (containing NUL bytes). @@ -1372,6 +1380,9 @@ nvim_put({lines}, {type}, {after}, {follow}) *nvim_put()* Compare |:put| and |p| which are always linewise. + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {lines} |readfile()|-style list of lines. |channel-lines| @@ -1489,6 +1500,9 @@ nvim_set_client_info({name}, {version}, {type}, {methods}, {attributes}) nvim_set_current_buf({buffer}) *nvim_set_current_buf()* Sets the current buffer. + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {buffer} Buffer handle @@ -1501,18 +1515,27 @@ nvim_set_current_dir({dir}) *nvim_set_current_dir()* nvim_set_current_line({line}) *nvim_set_current_line()* Sets the current line. + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {line} Line contents nvim_set_current_tabpage({tabpage}) *nvim_set_current_tabpage()* Sets the current tabpage. + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {tabpage} Tabpage handle nvim_set_current_win({window}) *nvim_set_current_win()* Sets the current window. + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {window} Window handle @@ -1859,6 +1882,9 @@ nvim_buf_del_var({buffer}, {name}) *nvim_buf_del_var()* nvim_buf_delete({buffer}, {opts}) *nvim_buf_delete()* Deletes the buffer. See |:bwipeout| + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {buffer} Buffer handle, or 0 for current buffer {opts} Optional parameters. Keys: @@ -2155,6 +2181,9 @@ nvim_buf_set_lines({buffer}, {start}, {end}, {strict_indexing}, {replacement}) Out-of-bounds indices are clamped to the nearest valid value, unless `strict_indexing` is set. + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {buffer} Buffer handle, or 0 for current buffer {start} First line index @@ -2232,6 +2261,9 @@ Window Functions *api-window* nvim_win_close({window}, {force}) *nvim_win_close()* Closes the window (like |:close| with a |window-ID|). + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {window} Window handle, or 0 for current window {force} Behave like `:close!` The last window of a @@ -2357,6 +2389,9 @@ nvim_win_is_valid({window}) *nvim_win_is_valid()* nvim_win_set_buf({window}, {buffer}) *nvim_win_set_buf()* Sets the current buffer in a window, without side-effects + Attributes: ~ + not allowed when |textlock| is active + Parameters: ~ {window} Window handle, or 0 for current window {buffer} Buffer handle diff --git a/runtime/doc/change.txt b/runtime/doc/change.txt index 5c67359002..f3ed086933 100644 --- a/runtime/doc/change.txt +++ b/runtime/doc/change.txt @@ -954,9 +954,13 @@ inside of strings can change! Also see 'softtabstop' option. > delete and yank) ({.%#:} only work with put). *:reg* *:registers* -:reg[isters] Display the contents of all numbered and named - registers. If a register is written to for |:redir| - it will not be listed. +:reg[isters] Display the type and contents of all numbered and + named registers. If a register is written to for + |:redir| it will not be listed. + Type can be one of: + "c" for |characterwise| text + "l" for |linewise| text + "b" for |blockwise-visual| text :reg[isters] {arg} Display the contents of the numbered and named diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index ea9072841c..67e2815715 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1120,7 +1120,7 @@ get_line_diagnostics({bufnr}, {line_nr}, {opts}, {client_id}) diagnostics. get_next({opts}) *vim.lsp.diagnostic.get_next()* - Get the previous diagnostic closest to the cursor_position + Get the next diagnostic closest to the cursor_position Parameters: ~ {opts} table See |vim.lsp.diagnostic.goto_next()| diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 6c42dd6739..e740a45bec 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2438,7 +2438,7 @@ A jump table for the options with a short description can be found at |Q_op|. 'foldcolumn' 'fdc' string (default "0") local to window When and how to draw the foldcolumn. Valid values are: - "auto": resize to the maximum amount of folds to display. + "auto": resize to the minimum amount of folds to display. "auto:[1-9]": resize to accommodate multiple folds up to the selected level 0: to disable foldcolumn diff --git a/runtime/doc/treesitter.txt b/runtime/doc/treesitter.txt index cd6186834d..911e7b8b47 100644 --- a/runtime/doc/treesitter.txt +++ b/runtime/doc/treesitter.txt @@ -197,11 +197,11 @@ query:iter_captures({node}, {bufnr}, {start_row}, {end_row}) as the node, i e to get syntax highlight matches in the current viewport) - The iterator returns two values, a numeric id identifying the capture - and the captured node. The following example shows how to get captures - by name: + The iterator returns three values, a numeric id identifying the capture, + the captured node, and metadata from any directives processing the match. + The following example shows how to get captures by name: > - for id, node in query:iter_captures(tree:root(), bufnr, first, last) do + for id, node, metadata in query:iter_captures(tree:root(), bufnr, first, last) do local name = query.captures[id] -- name of the capture in the query -- typically useful info about the node: local type = node:type() -- type of the captured node @@ -213,16 +213,19 @@ query:iter_matches({node}, {bufnr}, {start_row}, {end_row}) *query:iter_matches()* Iterate over all matches within a node. The arguments are the same as for |query:iter_captures()| but the iterated values are different: - an (1-based) index of the pattern in the query, and a table mapping - capture indices to nodes. If the query has more than one pattern - the capture table might be sparse, and e.g. `pairs` should be used and not - `ipairs`. Here an example iterating over all captures in - every match: + an (1-based) index of the pattern in the query, a table mapping + capture indices to nodes, and metadata from any directives processing the match. + If the query has more than one pattern the capture table might be sparse, + and e.g. `pairs()` method should be used over `ipairs`. + Here an example iterating over all captures in every match: > - for pattern, match in cquery:iter_matches(tree:root(), bufnr, first, last) do - for id,node in pairs(match) do + for pattern, match, metadata in cquery:iter_matches(tree:root(), bufnr, first, last) do + for id, node in pairs(match) do local name = query.captures[id] -- `node` was captured by the `name` capture in the match + + local node_data = metadata[id] -- Node level metadata + ... use the info here ... end end @@ -265,6 +268,29 @@ Here is a list of built-in predicates : Each predicate has a `not-` prefixed predicate that is just the negation of the predicate. +Treesitter Query Directive *lua-treesitter-directives* + +Treesitter queries can also contain `directives`. Directives store metadata for a node +or match and perform side effects. for example, the |set!| predicate sets metadata on +the match or node : > + ((identifier) @foo (#set! "type" "parameter")) + +Here is a list of built-in directives: + + `set!` *ts-directive-set!* + Sets key/value metadata for a specific node or match : > + ((identifier) @foo (#set! @foo "kind" "parameter")) + ((node1) @left (node2) @right (#set! "type" "pair")) +< + `offset!` *ts-predicate-offset!* + Takes the range of the captured node and applies the offsets + to it's range : > + ((idenfitier) @constant (#offset! @constant 0 1 0 -1)) +< This will generate a range object for the captured node with the + offsets applied. The arguments are + `({capture_id}, {start_row}, {start_col}, {end_row}, {end_col}, {key?})` + The default key is "offset". + *vim.treesitter.query.add_predicate()* vim.treesitter.query.add_predicate({name}, {handler}) @@ -277,6 +303,16 @@ vim.treesitter.query.list_predicates() This lists the currently available predicates to use in queries. + *vim.treesitter.query.add_directive()* +vim.treesitter.query.add_directive({name}, {handler}) + +This adds a directive with the name {name} to be used in queries. +{handler} should be a function whose signature will be : > + handler(match, pattern, bufnr, predicate, metadata) +Handlers can set match level data by setting directly on the metadata object `metadata.key = value` +Handlers can set node level data by using the capture id on the metadata table +`metadata[capture_id].key = value` + Treesitter syntax highlighting (WIP) *lua-treesitter-highlight* NOTE: This is a partially implemented feature, and not usable as a default |