Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
    
This isn't exactly what you ask but you may be able to pull ideas from it's source: github.com/spolu/dwm.vim –  Randy Morris Sep 10 '12 at 19:13
    
Thanks, that is interesting. –  slarpspark Sep 11 '12 at 12:31
add comment

migrated from stackoverflow.com Sep 11 '12 at 19:16

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

1 Answer

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
add comment

Your Answer

 
discard

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.