How do I reopen a terminal window with an active job if I hide the terminal window? This is similar to the following question: Close vim 8.1+ terminal buffer without unloading. In this case, however, the terminal is still active.

More detailed steps:

Open Vim with default options:

gvim -u NONE -U NONE

Within Vim:

:set hidden
:term bash

This should open up a split window with an active bash terminal on the top. Click on the bottom window. Issue the command:

:wincmd o

This hides the terminal window, but I can see that it is still there if I issue:


It shows something like:

  1 %a   "[No Name]"                    line 1
  2  hR  "!bash [/tmp]" line 0 

But if I attempt to reopen buffer #2 above with

:spl #2

I get a completely different non-terminal buffer. In fact, if I do


I get

  1 %a   "[No Name]"                    line 1
  2  hR  "!bash [/local-ssd/savadhan/slci]" line 0
  3 #a   "!bash"                        line 0 

It seems to have opened up a brand new buffer instead of the original terminal buffer. The only way to get back to the terminal window seems to be to attempt to close Vim, which takes me to the terminal window. Is there a way to recover the terminal window which was hidden with the wincmd o command?


You can use the :sbuffer or :sb command to split a new window with a specific existing buffer in it.

In your specific case:

:sb 2

And if you wanted to have a vertical split instead, then use the :vertical or :vert modifier:

:vert sb 2

The reason why :spl #2 doesn't work is that #2 simply expands to the name of the buffer. For a buffer that is holding an open file, the name of the buffer is the file name, so this will work just fine and end up splitting into that same buffer. But that's not the case for a terminal window, in which case the name of the buffer is just something like !bash (or whichever shell or command gets executed.) Referring to that name won't really recall that buffer, it will simply have Vim try to open (or, in this case, create) a file by that name.

Your Answer

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

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