import { nvim_buf_call } from "https://deno.land/x/denops_std@v6.5.0/function/nvim/mod.ts";
call a function with buffer as temporary current buffer
This temporarily switches current buffer to "buffer". If the current window already shows "buffer", the window is not switched If a window inside the current tabpage (including a float) already shows the buffer One of these windows will be set as current window temporarily. Otherwise a temporary scratch window (called the "autocmd window" for historical reasons) will be used.
This is useful e.g. to call vimL functions that only work with the current
buffer/window currently, like termopen()
.
Attributes:
Lua vim.api
only
Parameters:
- {buffer} Buffer handle, or 0 for current buffer
- {fun} Function to call inside the buffer (currently lua callable only)
Return: Return value of function. NB: will deepcopy lua values currently, use upvalues to send lua references in and out.