Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from Sep 11 '12 at 19:16

This question came from our site for professional and enthusiast programmers.

This isn't exactly what you ask but you may be able to pull ideas from it's source: – Randy Morris Sep 10 '12 at 19:13
Thanks, that is interesting. – slarpspark Sep 11 '12 at 12:31
up vote 4 down vote accepted
: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.

share|improve this answer
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 '12 at 12:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.