diff options
Diffstat (limited to 'runtime/doc/nvim_terminal_emulator.txt')
-rw-r--r-- | runtime/doc/nvim_terminal_emulator.txt | 4 |
1 files changed, 4 insertions, 0 deletions
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 |