3

In order to execute :term in nvim without causing the current window in a tab to close on exit, I execute the following command:

:vnew +term

This splits the current window into two, one of which executes :term.

However, I really don't want to split the window, I just want to open a temporary window, inside the original window in a tab, to execute :term, so that when :term exits, I return to the original window.

Is that possible?

8
  • have you tried :sh then?
    – Maxim Kim
    Commented May 26, 2020 at 12:51
  • by the way what vim do you use? looks like neovim as vim auto split on :term
    – Maxim Kim
    Commented May 26, 2020 at 12:52
  • @MaximKim - it says "not an editor command" for :sh.
    – Shuzheng
    Commented May 26, 2020 at 12:52
  • @MaximKim - I tagged the question nvim.
    – Shuzheng
    Commented May 26, 2020 at 12:52
  • ah, missed it. :sh wasn't ported to nvim
    – Maxim Kim
    Commented May 26, 2020 at 12:53

1 Answer 1

2

In general that is how tab pages work in vim/neovim:

Excerpt from neovim help (:h :tabc and then one pageup):

CLOSING A TAB PAGE:

Closing the last window of a tab page closes the tab page too, unless there is
only one tab page.

When you have term as the only window in a tab page and "exit" it you close the last window.

I don't know your use case, but maybe floaterm might be useful? If not as a plugin to use right away then maybe as inspiration to use rather big floating window with terminal inside?

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.