我安装了 NerdTree 插件。
我如何打开一个文件在右侧作为 vsplit 从左侧 NerdTree 面板?
There's a s command, but it opens a file split to the left of current buffer. Though you can press Ctrl+W r to swap windows then.
To make vsplit put the new buffer on the right of the current buffer:
vsplit
set splitright
Similarly, to make split put the new buffer below the current buffer:
split
set splitbelow
I haven't tried this with NerdTree, however.
This is a bit of a hack, but how I do it is this:
<leader>n<leader>n
On my system this opens it on the last window I was just on if the file isn't already open on my screen.
Start in the window you want to open your file into.
Hit <leader>n<leader>n to close and reopen NERDTree
Select the file you want!
A quick C-w = will get your windows back to proper proportions.
C-w =
Not sure if anyone else is still struggling with this, but here's how I dealt with it.
You can use
:ls
to list the available buffers. Which would look something like:
1 "foo.txt" 2 "blame_the_user.java"
:b1 to select foo.txt
:b1
:b2 for blame_the_user.java
:b2
This method can be done from any window setup using :sp or :vs.
:sp
:vs
Open the buffers you want to split first.