I could create a terminal with vim by running :term in the vim normal mode. However, this terminal is opened at the top of the window and I would like to open it in the bottom. How could I open it at the bottom? By the way, how could I change the height of this window?

  • 1
    Have a look at the great documentation: :help window-resize and read up on the comand modifiers, start reading at :help :vertical Commented Jul 19, 2018 at 6:33
  • In neovim :term doesn't open terminals in split buffer; I don't know about vim. And you could look at splitbelow option.
    – 3N4N
    Commented Jul 19, 2018 at 7:25

3 Answers 3


This question is a couple of years old now but I found it when I was looking for a way to open a terminal inside vim below a bunch of vertical splits. What I want looks something like this:

¦    ¦    ¦    ¦
¦ f1 ¦ f2 ¦ f3 ¦
¦   terminal   ¦

What you get with :below terminal or with :set splitbelow and then :terminal is:

¦ f1 ¦    ¦    ¦
¦    ¦    ¦    ¦
+----+ f2 ¦ f3 ¦
¦term¦    ¦    ¦

After a bunch of googling, I pieced this together. To get what I want above is actually pretty simple. Type :botright terminal or :bo term. (See :help :botright for more details.)

You can save a few keystrokes by putting this in your vimrc:

" open terminal below all splits
cabbrev bterm bo term

Then just type :bterm to open a terminal at the bottom.

I hope someone finds this useful.

  • Welcome to Vi and Vim and thanks for writing the answer! I did some small edits, please suggest a further edit if you disagree with any of the changes... Again, welcome!
    – filbranden
    Commented Jul 10, 2020 at 4:16
  • 2
    Better might be :command Bterm botright terminal—the abbreviation also triggers when searching, where the command does not.
    – D. Ben Knoble
    Commented Jul 10, 2020 at 12:18

In your ~/.vimrc add the line

set splitbelow

This will cause all splits to happen below (including terminal).

To change the height of the terminal (row x col)

set termwinsize=10x0 " 'termsize' didn't work - this did for me (GVIM 8.2)
  • Thanks a lot, how could I change the height of the terminal, and I seem to observe that I could not copy contents in the vim-terminal as I did in pure terminal ? Commented Jul 20, 2018 at 3:35
  • Read :help termwinsize to answer the first question. It will tell you how to modify that. You can always look up things by :help command in this case term and scroll. For the second I don't actually know the answer but the help page would likely help. Commented Jul 20, 2018 at 14:08
  • I tried but failed before I asked. I simply add the following lines in my vimrc: set termwinsize = "10*0" and when I open vim and run command :ter, the terminal still occupies half the screen. What mistake did I made then? Commented Jul 21, 2018 at 2:34
  • 3
    See also the :below command, e.g. :below terminal
    – Rich
    Commented Sep 13, 2018 at 13:15
  • @coincheung 10*0 means at least ten rows high. If you want 10 rows exactly, try :set termwinsize=10x0.
    – Rich
    Commented Sep 13, 2018 at 13:17

I wanted a way to easily toggle a single terminal that would keep the same size and content.

My solution lies in two functions: the main one controls whether a terminal should be opened, the second opens a terminal split where we want on the screen.

If one or more terminal splits exist, they are hidden. Else, a terminal split is opened, either a new one or the first hidden terminal.

function! PutTermPanel(buf, side, size) abort
  " new term if no buffer
  if a:buf == 0
    execute "sp" bufname(a:buf)
  " default side if wrong argument
  if stridx("hjklHJKL", a:side) == -1
    execute "wincmd" "J"
    execute "wincmd" a:side
  " horizontal split resize
  if stridx("jkJK", a:side) >= 0
    if ! a:size > 0
      resize 6
      execute "resize" a:size
  " vertical split resize
  if stridx("hlHL", a:side) >= 0
    if ! a:size > 0
      vertical resize 6
      execute "vertical resize" a:size

function! s:ToggleTerminal(side, size) abort
  let tpbl=[]
  let closed = 0
  let tpbl = tabpagebuflist()
  " hide visible terminals
  for buf in filter(range(1, bufnr('$')), 'bufexists(bufname(v:val)) && index(tpbl, v:val)>=0')
    if getbufvar(buf, '&buftype') ==? 'terminal'
      silent execute bufwinnr(buf) . "hide"
      let closed += 1
  if closed > 0
  " open first hidden terminal
  for buf in filter(range(1, bufnr('$')), 'bufexists(v:val) && index(tpbl, v:val)<0')
    if getbufvar(buf, '&buftype') ==? 'terminal'
      call PutTermPanel(buf, a:side, a:size)
  " open new terminal
  call PutTermPanel(0, a:side, a:size)

" Toggle terminal - bottom
nnoremap <silent> yot :call <SID>ToggleTerminal('J', 6)<CR>

" Toggle terminal - right
nnoremap <silent> yo<c-t> :call <SID>ToggleTerminal('L', 60)<CR>

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.