Vim NERDTree re-size vsplit
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 pressCTRL+W
then press-
or+
to resize the window byN
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 pressCTRL+W
then press<
or>
to resize the window byN
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)
Related videos on Youtube
Mat
Updated on September 18, 2022Comments
-
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 over 12 yearsWeird, 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
, nots
.
-
-
LeOn - Han Li over 4 yearsGreat example and explanation. Thanks for sharing!
-
uroboros about 2 yearsI had the problem where my
NERDTree
window kept changing width when closing other windows and this pointed me tonoequalalways
which fixed that