-1

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
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) – D. Ben Knoble Nov 6 '20 at 14:17
1

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

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.