diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/autocmd.txt | 2 | ||||
-rw-r--r-- | runtime/doc/eval.txt | 1 | ||||
-rw-r--r-- | runtime/doc/nvim_terminal_emulator.txt | 4 |
3 files changed, 7 insertions, 0 deletions
diff --git a/runtime/doc/autocmd.txt b/runtime/doc/autocmd.txt index 87c2e11a1e..03e182cb33 100644 --- a/runtime/doc/autocmd.txt +++ b/runtime/doc/autocmd.txt @@ -914,6 +914,8 @@ TermLeave After leaving |Terminal-mode|. After TermClose. *TermClose* TermClose When a |terminal| job ends. + Sets these |v:event| keys: + status *TermResponse* TermResponse After the response to t_RV is received from the terminal. The value of |v:termresponse| diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index a76298c86c..e02d80252f 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1641,6 +1641,7 @@ v:event Dictionary of event data for the current |autocommand|. Valid |v:false| if not. changed_window Is |v:true| if the the event fired while changing window (or tab) on |DirChanged|. + status Job status or exit code, -1 means "unknown". |TermClose| *v:exception* *exception-variable* v:exception The value of the exception most recently caught and not diff --git a/runtime/doc/nvim_terminal_emulator.txt b/runtime/doc/nvim_terminal_emulator.txt index 6dbc54463c..e0589ba7b8 100644 --- a/runtime/doc/nvim_terminal_emulator.txt +++ b/runtime/doc/nvim_terminal_emulator.txt @@ -134,6 +134,10 @@ Example: > programs can set this by emitting an escape sequence. - |'channel'| Terminal PTY |job-id|. Can be used with |chansend()| to send input to the terminal. +- The |TermClose| event gives the terminal job exit code in the |v:event| + "status" field. For example, this autocmd closes terminal buffers if the job + exited without error: > + autocmd TermClose * if !v:event.status | exe 'bdelete! '..expand('<abuf>') | endif Use |jobwait()| to check if the terminal job has finished: > let running = jobwait([&channel], 0)[0] == -1 |