Skip to main content
Module

x/denops_std/function/vim/mod.ts>term_start

📚 Standard module for denops.vim
Go to Latest
function term_start
import { term_start } from "https://deno.land/x/denops_std@v6.4.0/function/vim/mod.ts";

Open a terminal window and run {cmd} in it.

{cmd} can be a string or a List, like with job_start(). The string "NONE" can be used to open a terminal window without starting a job, the pty of the terminal can be used by a command like gdb.

Returns the buffer number of the terminal window. If {cmd} cannot be executed the window does open and shows an error message. If opening the window fails zero is returned.

{options} are similar to what is used for job_start(), see job-options. However, not all options can be used. These are supported: all timeout options "stoponexit", "cwd", "env" "callback", "out_cb", "err_cb", "exit_cb", "close_cb" "in_io", "in_top", "in_bot", "in_name", "in_buf" "out_io", "out_name", "out_buf", "out_modifiable", "out_msg" "err_io", "err_name", "err_buf", "err_modifiable", "err_msg" However, at least one of stdin, stdout or stderr must be connected to the terminal. When I/O is connected to the terminal then the callback function for that part is not used.

There are extra options: "term_name" name to use for the buffer name, instead of the command name. "term_rows" vertical size to use for the terminal, instead of using 'termwinsize'; valid range is from zero to 1000 "term_cols" horizontal size to use for the terminal, instead of using 'termwinsize' "vertical" split the window vertically; note that other window position can be defined with command modifiers, such as :belowright. "curwin" use the current window, do not split the window; fails if the current buffer cannot be abandoned "hidden" do not open a window "norestore" do not add the terminal window to a session file "term_kill" what to do when trying to close the terminal window, see term_setkill() "term_finish" What to do when the job is finished: "close": close any windows "open": open window if needed Note that "open" can be interruptive. See term++close and term++open. "term_opencmd" command to use for opening the window when "open" is used for "term_finish"; must have "%d" where the buffer number goes, e.g. "10split|buffer %d"; when not specified "botright sbuf %d" is used "term_highlight" highlight group to use instead of "Terminal" "eof_chars" Text to send after all buffer lines were written to the terminal. When not set CTRL-D is used on MS-Windows. For Python use CTRL-Z or "exit()". For a shell use "exit". A CR is always added. "ansi_colors" A list of 16 color names or hex codes defining the ANSI palette used in GUI color modes. See g:terminal_ansi_colors. "tty_type" (MS-Windows only): Specify which pty to use. See 'termwintype' for the values. "term_api" function name prefix for the terminal-api function. See term_setapi().

Can also be used as a method:

GetCommand()->term_start()

Parameters

denops: Denops
cmd: unknown
optional
options: unknown

Returns

Promise<number>