When I enter vim and open :terminal I want to :wq or :q without first having to switch to the terminal window and typing exit

Any autocmds for this? Can't seem to find any.


  • I have the terminal to launch in my .vimrc.
  • qa! etc, doesn't work either, I'll get an error any time I try to quit; 'job running' meaning the terminal.

What my vim looks like (for clarity)


  • doesn't work, says "job running" meaning the terminal
    – Nickotine
    Commented Oct 13, 2022 at 7:21
  • 2
    Try this: vim --clean "+term" "+qa!". It should exit immediately. If it doesn't, then there is a bug in Vim (my v0.9.57 exits immediately). But if it does work, then your vimrc is the culprit, which you can debug.
    – 3N4N
    Commented Oct 13, 2022 at 7:37
  • I could have that in my .vimrc as autocmd vimleave * vim --clean "+term" "+qa!", I'll try it, your vim looks ancient, I'm on vim8 :).
    – Nickotine
    Commented Oct 13, 2022 at 22:06
  • with no .vimrc and just launching terminal I can't get this to work unfortunately
    – Nickotine
    Commented Oct 14, 2022 at 0:39
  • also tried with a .vimrc with only an autocmd for terminal and the autocmd above you suggested, and yes I sourced .vimrc, also tried on the terminal (outside vim)
    – Nickotine
    Commented Oct 14, 2022 at 0:45


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.