I like to use the vim embedded terminal, but I do not know how I could adjust its height. Sometimes, I need it to be lower so that I could concentrate on my editor how could I adjust it ?

  • 1
    :h window-resize – Christian Brabandt Sep 13 '18 at 8:51
  • @ChristianBrabandt Sorry, I do not quite understand the meanings of the doc, would show me with an example, if I would like to adjust the terminal height to 20 row ? – coin cheung Sep 13 '18 at 8:55
  • @coincheung From inside the terminal, press <Ctrl-W> N to enter terminal-normal mode. Then use the standard window-resizing commands to change the window. e.g. 10<Ctrl-W>_ or :res 10. Then press i or a to get back into regular terminal mode. – Rich Sep 13 '18 at 13:26

To open a terminal for running command with height 20 you can do

:new +resize20 term://command

If the terminal is ready created, you either use :resize 20 or 20<c-w>_ for height. :vertical resize 20 or 20<c-w>| for width.

| improve this answer | |
  • :20sp term://command and :80vs term://command – rofrol Jan 2 at 15:54

There are several options:

(1) The simple way is to drag the bar separating the two split windows using the mouse. As far as I know this works by default, but I've only been using neovim, not standard vim so you may need to enable the mouse first.

(2) In normal mode, type 10<C-W>+ to increase the size of the current split by 10 lines. Or make a binding for this, e.g. nmap <Leader>b 10<C-W>+<CR> (b for bigger; Leader is \ by default but should be rebound to space in my opinion)

(3) A more automatic solution to the problem of the current split being too small is to add this to your vimrc:

set winheight=38

This will make the currently active window 38 lines tall, with the terminal filling the remaining space. But when you switch to the terminal, this is swapped around so that you can see the command output better.

| improve this answer | |
  • It does not work since the height of the upper window may affect the terminal height. – coin cheung Sep 13 '18 at 11:54
  • which of the options does not work, and what unexpected result do you get? – TamaMcGlinn Sep 13 '18 at 12:50
  • 1
    You can also use the ++rows option to specify height, e.g. :terminal ++rows=10. See :h :terminal – Peter Rincker Sep 13 '18 at 14:33
:h termwinsize

You need to set termwinsize option. It's argument like {row}x{columns}. So if you want your terminal appear 30 row and 200 column, you should use:

:set termwinsize=30x200
| improve this answer | |

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.