diff options
Diffstat (limited to 'runtime/doc/api.txt')
-rw-r--r-- | runtime/doc/api.txt | 96 |
1 files changed, 46 insertions, 50 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt index 7ac7f7d7ea..b80ca9edd7 100644 --- a/runtime/doc/api.txt +++ b/runtime/doc/api.txt @@ -70,7 +70,7 @@ Nvim instance: nvim = MessagePack::RPC::Client.new(MessagePack::RPC::UNIXTransport.new, ENV['NVIM_LISTEN_ADDRESS']) result = nvim.call(:nvim_command, 'echo "hello world!"') < -A better way is to use the Python REPL with the `neovim` package, where API +A better way is to use the Python REPL with the "pynvim" package, where API functions can be called interactively: > >>> from pynvim import attach @@ -336,7 +336,7 @@ callbacks. These callbacks are called frequently in various contexts; |textlock| prevents changing buffer contents and window layout (use |vim.schedule| to defer such operations to the main loop instead). -|nvim_buf_attach| will take keyword args for the callbacks. "on_lines" will +|nvim_buf_attach()| will take keyword args for the callbacks. "on_lines" will receive parameters ("lines", {buf}, {changedtick}, {firstline}, {lastline}, {new_lastline}, {old_byte_size}[, {old_utf32_size}, {old_utf16_size}]). Unlike remote channel events the text contents are not passed. The new text can @@ -355,7 +355,7 @@ was changed. The parameters recieved are ("changedtick", {buf}, {changedtick}). *api-lua-detach* In-process Lua callbacks can detach by returning `true`. This will detach all -callbacks attached with the same |nvim_buf_attach| call. +callbacks attached with the same |nvim_buf_attach()| call. ============================================================================== @@ -537,6 +537,12 @@ nvim__put_attr({id}, {start_row}, {start_col}, {end_row}, {end_col}) should probably be derived from a reformed bufhl/virttext interface with full support for multi-line ranges etc +nvim__screenshot({path}) *nvim__screenshot()* + TODO: Documentation + + Attributes: ~ + {fast} + nvim__stats() *nvim__stats()* Gets internal stats. @@ -1565,12 +1571,6 @@ affected. You can use |nvim_buf_is_loaded()| or |nvim_buf_line_count()| to check whether a buffer is loaded. - *nvim__buf_add_decoration()* -nvim__buf_add_decoration({buffer}, {ns_id}, {hl_group}, {start_row}, - {start_col}, {end_row}, {end_col}, - {virt_text}) - TODO: Documentation - *nvim__buf_redraw_range()* nvim__buf_redraw_range({buffer}, {first}, {last}) TODO: Documentation @@ -1603,19 +1603,20 @@ nvim_buf_add_highlight({buffer}, {src_id}, {hl_group}, {line}, marks do. Namespaces are used for batch deletion/updating of a set of - highlights. To create a namespace, use |nvim_create_namespace| - which returns a namespace id. Pass it in to this function as - `ns_id` to add highlights to the namespace. All highlights in - the same namespace can then be cleared with single call to - |nvim_buf_clear_namespace|. If the highlight never will be - deleted by an API call, pass `ns_id = -1` . + highlights. To create a namespace, use + |nvim_create_namespace()| which returns a namespace id. Pass + it in to this function as `ns_id` to add highlights to the + namespace. All highlights in the same namespace can then be + cleared with single call to |nvim_buf_clear_namespace()|. If + the highlight never will be deleted by an API call, pass + `ns_id = -1` . As a shorthand, `ns_id = 0` can be used to create a new namespace for the highlight, the allocated id is then returned. If `hl_group` is the empty string no highlight is added, but a new `ns_id` is still returned. This is supported for backwards compatibility, new code should use - |nvim_create_namespace| to create a new empty namespace. + |nvim_create_namespace()| to create a new empty namespace. Parameters: ~ {buffer} Buffer handle, or 0 for current buffer @@ -1766,13 +1767,16 @@ nvim_buf_get_commands({buffer}, {opts}) *nvim_buf_get_commands()* Map of maps describing commands. *nvim_buf_get_extmark_by_id()* -nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}) +nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts}) Returns position for a given extmark id Parameters: ~ {buffer} Buffer handle, or 0 for current buffer {ns_id} Namespace id from |nvim_create_namespace()| {id} Extmark id + {opts} Optional parameters. Keys: + • limit: Maximum number of marks to return + • details Whether to include the details dict Return: ~ (row, col) tuple or empty list () if extmark id was absent @@ -1821,6 +1825,7 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts}) extmark id (whose position defines the bound) {opts} Optional parameters. Keys: • limit: Maximum number of marks to return + • details Whether to include the details dict Return: ~ List of [extmark_id, row, col] tuples in "traversal @@ -1919,28 +1924,6 @@ nvim_buf_get_var({buffer}, {name}) *nvim_buf_get_var()* Return: ~ Variable value - *nvim_buf_get_virtual_text()* -nvim_buf_get_virtual_text({buffer}, {line}) - Get the virtual text (annotation) for a buffer line. - - The virtual text is returned as list of lists, whereas the - inner lists have either one or two elements. The first element - is the actual text, the optional second element is the - highlight group. - - The format is exactly the same as given to - nvim_buf_set_virtual_text(). - - If there is no virtual text associated with the given line, an - empty list is returned. - - Parameters: ~ - {buffer} Buffer handle, or 0 for current buffer - {line} Line to get the virtual text from (zero-indexed) - - Return: ~ - List of virtual text chunks - nvim_buf_is_loaded({buffer}) *nvim_buf_is_loaded()* Checks if a buffer is valid and loaded. See |api-buffer| for more info about unloaded buffers. @@ -1974,22 +1957,35 @@ nvim_buf_line_count({buffer}) *nvim_buf_line_count()* Line count, or 0 for unloaded buffer. |api-buffer| *nvim_buf_set_extmark()* -nvim_buf_set_extmark({buffer}, {ns_id}, {id}, {line}, {col}, {opts}) +nvim_buf_set_extmark({buffer}, {ns_id}, {line}, {col}, {opts}) Creates or updates an extmark. To create a new extmark, pass id=0. The extmark id will be - returned. It is also allowed to create a new mark by passing - in a previously unused id, but the caller must then keep track - of existing and unused ids itself. (Useful over RPC, to avoid + returned. To move an existing mark, pass its id. + + It is also allowed to create a new mark by passing in a + previously unused id, but the caller must then keep track of + existing and unused ids itself. (Useful over RPC, to avoid waiting for the return value.) + Using the optional arguments, it is possible to use this to + highlight a range of text, and also to associate virtual text + to the mark. + Parameters: ~ {buffer} Buffer handle, or 0 for current buffer {ns_id} Namespace id from |nvim_create_namespace()| - {id} Extmark id, or 0 to create new {line} Line number where to place the mark {col} Column where to place the mark - {opts} Optional parameters. Currently not used. + {opts} Optional parameters. + • id : id of the extmark to edit. + • end_line : ending line of the mark, 0-based + inclusive. + • end_col : ending col of the mark, 0-based + inclusive. + • hl_group : name of the highlight group used to + highlight this mark. + • virt_text : virtual text to link to this mark. Return: ~ Id of the created/updated extmark @@ -2066,12 +2062,12 @@ nvim_buf_set_virtual_text({buffer}, {src_id}, {line}, {chunks}, Namespaces are used to support batch deletion/updating of virtual text. To create a namespace, use - |nvim_create_namespace|. Virtual text is cleared using - |nvim_buf_clear_namespace|. The same `ns_id` can be used for + |nvim_create_namespace()|. Virtual text is cleared using + |nvim_buf_clear_namespace()|. The same `ns_id` can be used for both virtual text and highlights added by - |nvim_buf_add_highlight|, both can then be cleared with a - single call to |nvim_buf_clear_namespace|. If the virtual text - never will be cleared by an API call, pass `ns_id = -1` . + |nvim_buf_add_highlight()|, both can then be cleared with a + single call to |nvim_buf_clear_namespace()|. If the virtual + text never will be cleared by an API call, pass `ns_id = -1` . As a shorthand, `ns_id = 0` can be used to create a new namespace for the virtual text, the allocated id is then |