0

In VScode ,we are using ctrl+j to hide the terminal. Then if we press ctrl+j again, it will open the same terminal.

Is it possible in VIM/NEOVIM? I tried :Terminal ,but there is no straightforward way to toggle it. I have seen some plugins are there to do. Is there any shortcut to hide the terminal when not needed?

2
  • Relevant todo item and gist. Commented Nov 6, 2020 at 13:46
  • Welcome to Vi and Vim! Commented Nov 6, 2020 at 14:19

2 Answers 2

1

Option 1 (not in Gvim): Use CTRL-Z to suspend Vim. That will give you Vim's parent shell. To go back to Vim, enter fg in the command line.

Option 2: Spawn a terminal in a Vim window with :ter (or :terminal). Now, go back to the original window with CTRL-W CTRL-W and press CTRL-W _ to maximize its height. Note that the terminal window will still occupy one line. To get back the terminal window, you can use CTRL-W = to restore both windows to half of the screen, and then CTRL-W CTRL-W to move focus to the terminal again. You will want to read :help window-resize.

1
  • You can also close the terminal and re-open it, but you have to re-open by buffer number, which is not terribly intuitive (at least to me) Commented Nov 6, 2020 at 14:17
2

You could open the terminal in a new tab page (:tab terminal) and then use :tabnext / :tabprevious to switch between them.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.