1

I am using vim (7.3) with a four way window split. I want to do the following:

Select a file to open. Put it in window 1. Move file that was occupying window 1 to window 2, 2->3, 3->4 and discard window 4 out of view (unless there are unwritten changes).

How can I accomplish this?

1

1 Answer 1

4
:topleft split file5 | wincmd b | close | wincmd t | wincmd =

Explanation: Do a :split at the top, so file5 becomes the first window. All existing windows move down, but now there's one too many. To :close that, we go to the bottom window, close it, then back to the top. The last command makes all windows equally large again; this is not necessary when 'equalalways' is set.

1
  • Thanks. This answers the question, so I will gladly accept it. Doesn't work for me because I have a four way grid split, but I will try to work that out (which will be hard due to vim's seeming inability to move windows between columns of my grid.)
    – slarpspark
    Sep 11, 2012 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .