In Vim, when I run, for example, :terminal python3, and, when I'm done, exit python, the terminal window stays open as a readonly buffer, which I can inspect freely.

In Neovim, I always get "[Process exited with {Number}]", and when I press any key, it just closes the Terminal window. Is there any way to prevent this? The documentation doesn't list anything, is there a patch I could apply to the source code for this?

EDIT: I can inspect the terminal buffer by exiting terminal mode (<C-\><C-n>), however, I'd like that to happen automatically when the process exits. Is there a way to achieve that?

EDIT EDIT: After spending some more time, I've worked up this au-hack, which makes :terminal behave more like I'm used to from Vim:

if has('nvim')
    tnoremap <Esc> <C-\><C-n>
    au TermOpen  * setlocal nonumber | startinsert
    au TermClose * setlocal   number | call feedkeys("\<C-\>\<C-n>")

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.