0.3.2
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
• {ns_id} Namespace to clear, or -1 to clear all namespaces.
• {line_start} Start of range of lines to clear
• {line_end} End of range of lines to clear (exclusive) or -1 to
clear to end of buffer.
nvim_buf_del_extmark({buffer}, {ns_id}, {id}) *nvim_buf_del_extmark()*
Removes an |extmark|.
Attributes: ~
Since: 0.5.0
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
• {ns_id} Namespace id from |nvim_create_namespace()|
• {id} Extmark id
Return: ~
true if the extmark was found, else false
*nvim_buf_get_extmark_by_id()*
nvim_buf_get_extmark_by_id({buffer}, {ns_id}, {id}, {opts})
Gets the position (0-indexed) of an |extmark|.
Attributes: ~
Since: 0.5.0
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
• {ns_id} Namespace id from |nvim_create_namespace()|
• {id} Extmark id
• {opts} Optional parameters. Keys:
• details: Whether to include the details dict
• hl_name: Whether to include highlight group name instead
of id, true if omitted
Return: ~
0-indexed (row, col) tuple or empty list () if extmark id was absent
*nvim_buf_get_extmarks()*
nvim_buf_get_extmarks({buffer}, {ns_id}, {start}, {end}, {opts})
Gets |extmarks| in "traversal order" from a |charwise| region defined by
buffer positions (inclusive, 0-indexed |api-indexing|).
Region can be given as (row,col) tuples, or valid extmark ids (whose
positions define the bounds). 0 and -1 are understood as (0,0) and (-1,-1)
respectively, thus the following are equivalent: >lua
vim.api.nvim_buf_get_extmarks(0, my_ns, 0, -1, {})
vim.api.nvim_buf_get_extmarks(0, my_ns, {0,0}, {-1,-1}, {})
<
If `end` is less than `start`, marks are returned in reverse order.
(Useful with `limit`, to get the first marks prior to a given position.)
Note: For a reverse range, `limit` does not actually affect the traversed
range, just how many marks are returned
Note: when using extmark ranges (marks with a end_row/end_col position)
the `overlap` option might be useful. Otherwise only the start position of
an extmark will be considered.
Note: legacy signs placed through the |:sign| commands are implemented as
extmarks and will show up here. Their details array will contain a
`sign_name` field.
Example: >lua
local api = vim.api
local pos = api.nvim_win_get_cursor(0)
local ns = api.nvim_create_namespace('my-plugin')
-- Create new extmark at line 1, column 1.
local m1 = api.nvim_buf_set_extmark(0, ns, 0, 0, {})
-- Create new extmark at line 3, column 1.
local m2 = api.nvim_buf_set_extmark(0, ns, 2, 0, {})
-- Get extmarks only from line 3.
local ms = api.nvim_buf_get_extmarks(0, ns, {2,0}, {2,0}, {})
-- Get all marks in this buffer + namespace.
local all = api.nvim_buf_get_extmarks(0, ns, 0, -1, {})
vim.print(ms)
<
Attributes: ~
Since: 0.5.0
Parameters: ~
• {buffer} Buffer id, or 0 for current buffer
• {ns_id} Namespace id from |nvim_create_namespace()| or -1 for all
namespaces
• {start} Start of range: a 0-indexed (row, col) or valid extmark id
(whose position defines the bound). |api-indexing|
• {end} End of range (inclusive): a 0-indexed (row, col) or valid
extmark id (whose position defines the bound).
|api-indexing|
• {opts} Optional parameters. Keys:
• limit: Maximum number of marks to return
• details: Whether to include