import { nvim_open_term } from "https://deno.land/x/denops_std@v6.1.0/function/nvim/mod.ts";
Open a terminal instance in a buffer
By default (and currently the only option) the terminal will not be connected to an external process. Instead, input send on the channel will be echoed directly by the terminal. This is useful to display ANSI terminal sequences returned as part of a rpc message, or similar.
Note: to directly initiate the terminal using the right size, display the
buffer in a configured window before calling this. For instance, for a
floating display, first create an empty buffer using nvim_create_buf()
,
then display it using nvim_open_win()
, and then call this function. Then
nvim_chan_send()
can be called immediately to process sequences in a
virtual terminal having the intended size.
Parameters:
- {buffer} the buffer to use (expected to be empty)
- {opts} Optional parameters.
- on_input: lua callback for input sent, i e keypresses in
terminal mode. Note: keypresses are sent raw as they would
be to the pty master end. For instance, a carriage return
is sent as a "\r", not as a "\n".
textlock
applies. It is possible to callnvim_chan_send()
directly in the callback however. ["input", term, bufnr, data]
Return: Channel id, or 0 on error