Vim NERDTree re-size vsplit

16,680

Solution 1

For vertical resizing use the following command:

CTRL-W -        Decrease current window height by N (default 1).
CTRL-W +        Increase current window height by N (default 1).

Explanation:

  • In command mode, press a number N then press CTRL+W then press - or + to resize the window by N rows.
  • Or just press CTRL+W and then press - or + to resize the window by 1 row.

Or, you can type :res +/-N. Like: :res +10


For Horizontal resizing use the following command:

CTRL-W < Decrease current window width by N (default 1).
CTRL-W > Increase current window width by N (default 1).

Explanation:

  • In command mode, press a number N then press CTRL+W then press < or > to resize the window by N columns.
  • Or just press CTRL+W and then press < or > to resize the window by 1 column.

Or, you can type :vertical res +/-N. Like: :vertical res +10

Solution 2

You can set the default width of NERDTree through NERDTreeWinSize.

For example: let NERDTreeWinSize = 1 in .vimrc.

You can adjust the size of the windows through the normal VIM commands, see :help window-resize.

Solution 3

Check your settings for equalalways and eadirection, as they dictate what size new windows start out as. If equalalways is set, then all new windows will be created equal in width, height, or both, depending on the value of eadirection.

Also, the NERDTree setting: NERDTreeWinSize defaults to a width of 31 characters, you may want to adjust that (after checking the equalalways and eadirection options in vim too)

Share:
16,680

Related videos on Youtube

Mat
Author by

Mat

Updated on September 18, 2022

Comments

  • Mat
    Mat over 1 year

    I am using the NERDTree plugin for Vim. When using the s: open vsplit command, is it possible to resize the windows so that the file takes up a larger portion of the screen than the directory tree?

    • Admin
      Admin over 12 years
      Weird, so you are saying the directory tree has the same width as the document? How many documents do you have opened? If just one then you should use Enter, not s.
  • LeOn - Han Li
    LeOn - Han Li over 4 years
    Great example and explanation. Thanks for sharing!
  • uroboros
    uroboros about 2 years
    I had the problem where my NERDTree window kept changing width when closing other windows and this pointed me to noequalalways which fixed that