MacVim+NERDTree: How to open a file as a split in furthest horizontal split
Asked Answered
B

1

32

I've been browsing mvim docs and have tested out the various commands, but I can't seem to find one that solves my issue.

Here is what I have:

/========================================================\
|          |                      |                      |
|          |                      |                      |
|          |     file 1           |                      |
|          |                      |                      |
|          |______________________|                      |
| NERDTree |                      |     File 3           |
|          |                      |                      |
|          |    file 2            |                      |
|          |                      |                      |
\__________|______________________|______________________/

What I'd like to have:

/========================================================\
|          |                      |                      |
|          |                      |                      |
|          |     file 1           |       File 4         |
|          |                      |                      |
|          |______________________|______________________|
| NERDTree |                      |                      |
|          |                      |                      |
|          |    file 2            |      File 3          |
|          |                      |                      |
\__________|______________________|______________________/

I'm able to move things far right, into a new vsplit, as well as far top and far bottom.

New NERDTree files are opening by default in the File 1/File 2 vsplit.

Any help is appreciated, thanks!

Bogus answered 19/6, 2015 at 17:18 Comment(0)
B
69

It seems as though my particular setup at that time may have been the issue, and I think I understand why. First, how to do what I asked:

  1. Open up nerdtree with :NERDTree
  2. Open your first file with or o
  3. Open second file in horizontal split pane with i
  4. From each of 2 horizontal panes create your third and fourth panes with s. This will open the selected files in vertical split of the last buffer you interacted with, splitting them each in half.
    Bare in mind that you'll need to be in the pane you'd like to split, previous to selecting your file to open from NERDTree.

My issue arose primarily from my panes already being in an orientation of my top most diagram above. Everytime I tried to create a horizontal split with File 3 the split would just wind up in the first column of files.

I think I may see why now, though. With mvim you can interact through your mouse - and that's the only way to get directly from that furthest column to NERDTree, without touching any other buffers (as far as I can tell). Whereas with regular vim, you wouldn't be able to have the furthest column as the last interacted window, and therefore would never be able to split it.

Bogus answered 27/6, 2015 at 23:1 Comment(4)
that really sucks.. i don't like mvim.. and one of the points of using vi in the first place is to avoid using the mouse. in my case what i do is that i split the screen anyways (using :vsplit or :split) then i simply run :FZF and select teh file i want.. obviously not as convenient as jumping to nerdree and simply typing o or iArdeb
followed up to question here: vi.stackexchange.com/questions/14796/…Ardeb
To omit mouse usage I use open/close of NERDTree, what gets me to NERDTree directly from my last location. I have open/close mapped on F2 so only I do is getting to screen part I need then F2 + F2, navigate to file I need and o. Voala no mouse and I have opened the file in needed screen part. Still not perfect, but at least no mouse ;)Doublecheck
sorry for the stupid follow up, but how can I navigate the split? with <C-ww> i can go in circle between tabs but can I go up down left right? If not, can I go in reverse circular order? ThanksGrammer

© 2022 - 2024 — McMap. All rights reserved.