Assume I’ve got some arbitrary layout of splits in vim.

____________________
| one       | two  |
|           |      |
|           |______|
|           | three|
|           |      |
|___________|______|

Is there a way to swap one and two and maintain the same layout? It’s simple in this example, but I’m looking for a solution that will help for more complex layouts.

UPDATE:

I guess I should be more clear. My previous example was a simplification of the actual use-case. With an actual instance:
alt text

How could I swap any two of those splits, maintaining the same layout?

Update! 3+ years later…

I put sgriffin’s solution in a Vim plugin you can install with ease! Install it with your favorite plugin manager and give it a try: WindowSwap.vim

a little demo

12 Answers
12

Leave a Reply

Your email address will not be published. Required fields are marked *