*nvim_set_decoration_provider()*
nvim_set_decoration_provider({ns_id}, {opts})
Set or change decoration provider for a |namespace|
This is a very general purpose interface for having Lua callbacks being
triggered during the redraw code.
The expected usage is to set |extmarks| for the currently redrawn buffer.
|nvim_buf_set_extmark()| can be called to add marks on a per-window or
per-lines basis. Use the `ephemeral` key to only use the mark for the
current screen redraw (the callback will be called again for the next
redraw).
Note: this function should not be called often. Rather, the callbacks
themselves can be used to throttle unneeded callbacks. the `on_start`
callback can return `false` to disable the provider until the next redraw.
Similarly, return `false` in `on_win` will skip the `on_line` calls for
that window (but any extmarks set in `on_win` will still be used). A
plugin managing multiple sources of decoration should ideally only set one
provider, and merge the sources internally. You can use multiple `ns_id`
for the extmarks set/modified inside the callback anyway.
Note: doing anything other than setting extmarks is considered
experimental. Doing things like changing options are not explicitly
forbidden, but is likely to have unexpected consequences (such as 100% CPU
consumption). Doing `vim.rpcnotify` should be OK, but `vim.rpcrequest` is
quite dubious for the moment.
Note: It is not allowed to remove or update extmarks in `on_line`
callbacks.
Attributes: ~
Lua |vim.api| only
Since: 0.5.0
Parameters: ~
• {ns_id} Namespace id from |nvim_create_namespace()|
• {opts} Table of callbacks:
• on_start: called first on each screen redraw >
["start", tick]
<
• on_buf: called for each buffer being redrawn (once per
edit, before window callbacks) >
["buf", bufnr, tick]
<
• on_win: called when starting to redraw a specific window. >
["win", winid, bufnr, toprow, botrow]
<
• on_line: called for each buffer line being redrawn. (The
interaction with fold lines is subject to change) >
["line", winid, bufnr, row]
<
• on_end: called at the end of a redraw cycle >
["end", tick]
<
nvim__ns_get({ns_id}) *nvim__ns_get()*
EXPERIMENTAL: this API will change in the future.
Get the properties for namespace
Parameters: ~
• {ns_id} Namespace
Return: ~
Map defining the namespace properties, see |nvim__ns_set()|
nvim__ns_set({ns_id}, {opts}) *nvim__ns_set()*
EXPERIMENTAL: this API will change in the future.
Set some properties for namespace
Parameters: ~
• {ns_id} Namespace
• {opts} Optional parameters to set:
• wins: a list of windows to be scoped in
==============================================================================
Window Functions *api-window*
nvim_win_call({window}, {fun}) *nvim_win_call()*
Calls a function with window as temporary current window.
Attributes: ~
Lua |vim.api| only
Since: 0.5.0
Parameters: ~
• {window} |window-ID|, or 0 for current window
• {fun} Function to call inside the window (currently Lua callable
only)
Return: ~
Return value of function.
See also: ~
• |win_execute()|
• |nvim_buf_call()|
nvim_win_close({window}, {force}) *nvim_win_close()*
Closes the window (like |:close| with a |window-ID|).
Attributes: ~
not allowed when |textlock| is active
Since: 0.4.0