How do I toggle between a Vertical and a Horizontal split in vimdiff?

drapkin11 picture drapkin11 · Apr 16, 2011 · Viewed 22.5k times · Source

I already know how to use the diffopt variable to start diff mode with horizontal/vertical splits but not how to toggle between the two when I already have two files open for comparison.

I tried the accepted answer found in this older post, but to no avail. The Ctrl+W commands didn't work for me. Perhaps because I'm running gVim in Windows-friendly mode?

Answer

Peter Rincker picture Peter Rincker · Apr 16, 2011

The following command will change a vertical split into a horizontal split:

ctrl+w then J

To change back to a vertical split use either:

ctrl+w H or ctrl+w L

For more information about moving windows:

:h window-moving
:h ctrl-w_J
:h ctrl-w_K
:h ctrl-w_H
:h ctrl-w_L