Home Explore Blog CI



neovim

68th chunk of `runtime/doc/vimfn.txt`
e2ecd54e7f949286355108cfd72b07fdf3d44ad621b74a420000000100000fb1
 variable name:value
			      pairs extending (or replace with "clear_env")
			      the current environment. |jobstart-env|
		  height:     (number) Height of the `pty` terminal.
		  |on_exit|:    (function) Callback invoked when the job exits.
		  |on_stdout|:  (function) Callback invoked when the job emits
			      stdout data.
		  |on_stderr|:  (function) Callback invoked when the job emits
			      stderr data.
		  overlapped: (boolean) Sets FILE_FLAG_OVERLAPPED for the
			      stdio passed to the child process. Only on
			      MS-Windows; ignored on other platforms.
		  pty:	      (boolean) Connect the job to a new pseudo
			      terminal, and its streams to the master file
			      descriptor. `on_stdout` receives all output,
			      `on_stderr` is ignored. |terminal-start|
		  rpc:	      (boolean) Use |msgpack-rpc| to communicate with
			      the job over stdio. Then `on_stdout` is ignored,
			      but `on_stderr` can still be used.
		  stderr_buffered: (boolean) Collect data until EOF (stream closed)
			      before invoking `on_stderr`. |channel-buffered|
		  stdout_buffered: (boolean) Collect data until EOF (stream
			      closed) before invoking `on_stdout`. |channel-buffered|
		  stdin:      (string) Either "pipe" (default) to connect the
			      job's stdin to a channel or "null" to disconnect
			      stdin.
		  term:	    (boolean) Spawns {cmd} in a new pseudo-terminal session
		          connected to the current (unmodified) buffer. Implies "pty".
		          Default "height" and "width" are set to the current window
		          dimensions. |jobstart()|. Defaults $TERM to "xterm-256color".
		  width:      (number) Width of the `pty` terminal.

		{opts} is passed as |self| dictionary to the callback; the
		caller may set other keys to pass application-specific data.

		Returns:
		  - |channel-id| on success
		  - 0 on invalid arguments
		  - -1 if {cmd}[0] is not executable.
		See also |job-control|, |channel|, |msgpack-rpc|.

                Parameters: ~
                  • {cmd} (`string|string[]`)
                  • {opts} (`table?`)

                Return: ~
                  (`integer`)

jobstop({id})                                                        *jobstop()*
		Stop |job-id| {id} by sending SIGTERM to the job process. If
		the process does not terminate after a timeout then SIGKILL
		will be sent. When the job terminates its |on_exit| handler
		(if any) will be invoked.
		See |job-control|.

		Returns 1 for valid job id, 0 for invalid id, including jobs have
		exited or stopped.

                Parameters: ~
                  • {id} (`integer`)

                Return: ~
                  (`integer`)

jobwait({jobs} [, {timeout}])                                        *jobwait()*
		Waits for jobs and their |on_exit| handlers to complete.

		{jobs} is a List of |job-id|s to wait for.
		{timeout} is the maximum waiting time in milliseconds. If
		omitted or -1, wait forever.

		Timeout of 0 can be used to check the status of a job: >vim
			let running = jobwait([{job-id}], 0)[0] == -1
<
		During jobwait() callbacks for jobs not in the {jobs} list may
		be invoked. The screen will not redraw unless |:redraw| is
		invoked by a callback.

		Returns a list of len({jobs}) integers, where each integer is
		the status of the corresponding job:
			Exit-code, if the job exited
			-1 if the timeout was exceeded
			-2 if the job was interrupted (by |CTRL-C|)
			-3 if the job-id is invalid

                Parameters: ~
                  • {jobs} (`integer[]`)
                  • {timeout} (`integer?`)

                Return: ~
                  (`integer[]`)

join({list} [, {sep}])                                                  *join()*
		Join the items in {list} together into one String.
		When {sep} is specified it is put in between the items.  If
		{sep} is omitted a single space is used.
		Note that {sep} is not added at the end.  You might want to
		add it there too: >vim
			let lines = join(mylist,

Title: Detailed Options for jobstart(), jobstop(), jobwait(), and join()
Summary
This section elaborates on the `jobstart()` function's options, including `stderr_buffered`, `stdout_buffered`, `stdin`, `term`, and `width`, detailing how they affect job behavior and communication. It then describes the `jobstop()` function, which sends SIGTERM and then SIGKILL to a job process, and the `jobwait()` function, which waits for specified jobs to complete, returning their status codes or timeout/interruption indicators. Finally, it introduces the `join()` function, which concatenates list items into a single string with an optional separator.