19

Vim 8.1 added the :terminal command, which opens up a new bash terminal as a split. However, it always seems to be a horizontal split, and I prefer vertical splits. Is there a way to open a terminal as a vertical split without using:

:vsp
:terminal
<c-w>j
:q

Alternatively, is there a way I could add it as a command in my .vimrc, like so:

command Vterm :vsp | :terminal | <c-w>j | :q

The command above chokes on trying to execute <c-w>j, opens a new vim split with the following:

executing job failed: No such file or directory

Just having:

command Vterm :vsp | :terminal

Works fine, but leaves the original split.

6

I'm not sure about regular vim, but the help says the ++curwin option doesn't split the current window. So you should be able to do something like:

:vs|:term ++curwin

Or you could use Neovim and just do :vs|:terminal or :vs term://bash :)

  • 1
    Perfect, works like a charm as a command. – Schiem May 18 '18 at 21:15
34

You can use the :vert[ical] command modifier:

:vert term

:vertical works with any command that splits a window, for example:

:vert copen
:vert help vert
1

For neovim, to open a vertical terminal, the following work:

  • :vnew term://bash
  • :vsplit term://bash
  • :vnew term://zsh
  • :vsplit term://zsh

More documentation can be found by using :h :terminal inside neovim.

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.