aboutsummaryrefslogtreecommitdiff
path: root/runtime/doc/api.txt
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/doc/api.txt')
-rw-r--r--runtime/doc/api.txt24
1 files changed, 16 insertions, 8 deletions
diff --git a/runtime/doc/api.txt b/runtime/doc/api.txt
index 4ed0a6aba0..57a72e6173 100644
--- a/runtime/doc/api.txt
+++ b/runtime/doc/api.txt
@@ -462,7 +462,7 @@ We can get a mark by its id: >
We can get all marks in a buffer for our namespace (or by a range): >
- echo nvim_buf_get_extmarks(0, g:mark_ns, 0, -1, -1)
+ echo nvim_buf_get_extmarks(0, g:mark_ns, 0, -1, {})
=> [[1, 0, 2]]
Deleting all text surrounding an extmark does not remove the extmark. To
@@ -1516,6 +1516,13 @@ nvim_buf_attach({buffer}, {send_buffer}, {opts}) *nvim_buf_attach()*
Activates buffer-update events on a channel, or as Lua
callbacks.
+ Example (Lua): capture buffer updates in a global `events` variable (use "print(vim.inspect(events))" to see its
+ contents): >
+ events = {}
+ vim.api.nvim_buf_attach(0, false, {
+ on_lines=function(...) table.insert(events, {...}) end})
+<
+
Parameters: ~
{buffer} Buffer handle, or 0 for current buffer
{send_buffer} True if the initial notification should
@@ -1804,21 +1811,22 @@ nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
range ends can be specified as (row, col) tuples, as well as
extmark ids in the same namespace. In addition, 0 and -1 works
as shorthands for (0,0) and (-1,-1) respectively, so that all
- marks in the buffer can be quieried as:
+ marks in the buffer can be queried as:
- all_marks = nvim_buf_get_extmarks(0, my_ns, 0, -1, -1)
+ all_marks = nvim_buf_get_extmarks(0, my_ns, 0, -1, {})
If end is a lower position than start, then the range will be
- traversed backwards. This is mostly used with limited amount,
- to be able to get the first marks prior to a given position.
+ traversed backwards. This is mostly useful with limited
+ amount, to be able to get the first marks prior to a given
+ position.
Parameters: ~
{buffer} The buffer handle
{ns_id} An id returned previously from
nvim_create_namespace
- {lower} One of: extmark id, (row, col) or 0, -1 for
+ {start} One of: extmark id, (row, col) or 0, -1 for
buffer ends
- {upper} One of: extmark id, (row, col) or 0, -1 for
+ {end} One of: extmark id, (row, col) or 0, -1 for
buffer ends
{opts} additional options. Supports the keys:
• amount: Maximum number of marks to return
@@ -1845,7 +1853,7 @@ nvim_buf_set_extmark({buffer}, {ns_id}, {id}, {line}, {col}, {opts})
{ns_id} a identifier returned previously with
nvim_create_namespace
{id} The extmark's id or 0 to create a new mark.
- {row} The row to set the extmark to.
+ {line} The row to set the extmark to.
{col} The column to set the extmark to.
{opts} Optional parameters. Currently not used.