Most of the time I have my window split, after editing some code, I :terminal to run some commands to check if my changes make sense. when I exit the terminal, I don't have the window split anymore, I just lose the buffer that was there before running :terminal. When I remember before I close the terminal (cause my fingers are faster than my brain), is that I go in normal mode, and ctrl-o to jump back to the previous buffer. does that leave the terminal still running? is there a better way to go close the terminal and go back to my previous split window with buffers?

1 Answer 1


here's what works for me. Ctrl-o doesn't close the buffer, it just jumps to the previous one. but :buffer # seems to do it. so in my init.vim I have

tnoremap <ESC> <C-\><C-n>:buffer #<CR>

which closes the terminal buffer and jump back to the previous one, the window is still split. I mapped it to ESC cause it makes sense to me, but that's personal preference.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.