Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!

like image 726
Tim Avatar asked Jun 19 '15 17:06

Tim


1 Answers

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.

like image 89
Tim Avatar answered Sep 18 '22 15:09

Tim