4

Since 2019, Vim introduces a new command called :terminal, which allow user to open terminal inside of Vim.

To open it in a new tab, I have to type two commands:

:tabnew
:terminal

Is there a one-command way to achieve the same purpose?

Edit: I'm aware of this similar question, but the accepted answer is outdated.

Edit 2: This might be a bug related to Neovim.

Wong Jia Hau
  • 2,639
  • 2
  • 18
  • 30

1 Answers1

16

This is :tab command. So one can do :tab term and no worries.

Please, when you feel you miss some bit of Vim, don't hesitate to search through builtin help first. In particular, :h :tabnew and :h :tab topics stay very close to each other, residing within the same help file. As it contains more topics and advices on the subject, you may want to display it by typing :h tabpage and read it from the start till the end.

Upd.: If we talk about Neovim specifically (please, note that as long as your question only has "Vim" tag everyone assumes it's NOT Neovim specific), then one should remember that in Neovim :term command always reuses the current buffer. Currently this is considered as a feature, not a bug.

Hence for Neovim we may want to have (at least) two commands: one to create a new empty buffer, and another one to re-use it for terminal. How you prefer this, it's fully upon you. :tabnew | term, or :tabnew +term, or :tabnew term://sh and so on.

Matt
  • 13,674
  • 1
  • 18
  • 27