Hi,
On Sat, Jan 4, 2020 at 3:12 AM surge <
ger...@gmail.com> wrote:
>
> The ":ls" command in Vim output the current buffers in Vim. If one of the buffers is a terminal, there are some useful flags to examine there. For example, if the command was
>
> :term echo "test"
>
> :ls will contain an entry similar to:
>
> 7 %aF "!echo "test" [finished]" line 1
>
> Question: is there a vimscript function that could return such extended information about a buffer?
>
Yes. You can use the term_getstatus() function to get the status of
the terminal.
You can use the getbufinfo(), term_getjob() and job_info() functions to get
additional details about the job running in a terminal window.
Example (assuming the buffer number for the terminal is 2):
:echo term_getjob(2)->job_info()
:echo term_getstatus(2)
:echo term_getjob(2)->job_status()
:echo getbufinfo(2)[0].name
- Yegappan