Switch Horizontal/Vertical View in Vimdiff

2,243 views
Skip to first unread message

Roy Fulbright

unread,
Jun 14, 2011, 4:07:23 AM6/14/11
to Vim User Group
How can I switch between horizontal and vertical view of vimdiff display without exiting and re-running vimdiff with the other (horizontal/vertical) display option?

Karol Samborski

unread,
Jun 14, 2011, 4:23:44 AM6/14/11
to vim...@googlegroups.com
2011/6/14 Roy Fulbright <rful...@hotmail.com>:

> How can I switch between horizontal and vertical view of vimdiff display
> without exiting and re-running vimdiff with the other (horizontal/vertical)
> display option?
>

Did you try <C-w>J (or <C-w>K) when you are in vertical split and
<C-w>H (<C-w>L) in horizontal?

Best regards,
Karol Samborski

Roy Fulbright

unread,
Jun 14, 2011, 6:42:08 AM6/14/11
to Vim User Group
I think you may have misunderstood my question. I do not want to switch _between_ the display panes, but rather switch from vertically aligned panes to horizontally aligned panes.
 
> Date: Tue, 14 Jun 2011 10:23:44 +0200
> Subject: Re: Switch Horizontal/Vertical View in Vimdiff
> From: edv....@gmail.com
> To: vim...@googlegroups.com
> --
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php

Karol Samborski

unread,
Jun 14, 2011, 6:51:12 AM6/14/11
to vim...@googlegroups.com
2011/6/14 Roy Fulbright <rful...@hotmail.com>:

> I think you may have misunderstood my question. I do not want to switch
> _between_ the display panes, but rather switch from vertically aligned panes
> to horizontally aligned panes.
>

If I would mean switch between panes I would wrote <C-w>j but I wrote
<C-w>J. Use uppercase letters (with capslock or shift).

Regards,
Karol Samborski

Christian Brabandt

unread,
Jun 14, 2011, 7:08:32 AM6/14/11
to vim...@googlegroups.com
On Tue, June 14, 2011 12:42 pm, Roy Fulbright wrote:
> I think you may have misunderstood my question. I do not want to switch
> _between_ the display panes, but rather switch from vertically aligned
> panes to horizontally aligned panes.

:h window-moving


regards,
Christian

rameo

unread,
Jun 17, 2011, 3:32:04 AM6/17/11
to vim_use
On Jun 14, 10:07 am, Roy Fulbright <rfulb...@hotmail.com> wrote:
> How can I switch between horizontal and vertical view of vimdiff display without exiting and re-running vimdiff
with the other (horizontal/vertical) display option?

Hi Roy,

I use these 2:

Vertical Split to Horizontal Split: <C-W>t<C-W>K
Horizontal Split to Vertical Split: <C-W>t<C-W>H

Regards,
rameo

Charles Campbell

unread,
Jun 21, 2011, 10:46:59 AM6/21/11
to vim...@googlegroups.com
" vertical -> horizontal
:windo wincmd H

" horizontal -> vertical
:windo wincmd K

These will handle multiple vertical or horizontal windows. To make this
even easier, try :TWL with the following plugin:

" twl.vim: Toggle Window Layout
" Author: Charles E. Campbell, Jr.
" Date: Nov 10, 2005
" Version: 1a ASTRO-ONLY
" ---------------------------------------------------------------------

" Load Once: {{{1
if &cp || exists("g:loaded_twl")
finish
endif
let s:keepcpo = &cpo
let g:loaded_twl= "v1a"
set cpo&vim

" ---------------------------------------------------------------------
" Public Interface: {{{1
com! -nargs=0 TWL :call s:ToggleWinLayout()

" ---------------------------------------------------------------------
" ToggleWinLayout: toggles between all-horizontal and all-vertical {{{1
" window layouts. Based on the vimtip
" http://vim.sourceforge.net/tips/tip.php?tip_id=862
" W
" W | W | W <=> W
" W
fun! s:ToggleWinLayout()
" call Dfunc("ToggleWinLayout()")
let curwin= winnr()
if curwin == 1
" try to go down one window
wincmd j
let isvert= winnr() != curwin
wincmd k
else
" try to go up one window
wincmd k
let isvert= winnr() != curwin
wincmd j
endif
if isvert
windo wincmd H
else
windo wincmd K
endif
" call Dret("ToggleWinLayout : (isvert=".isvert.")")
endfun

" ---------------------------------------------------------------------
" Restore cpo: {{{1
let &cpo= s:keepcpo
unlet s:keepcpo

" ---------------------------------------------------------------------
" vim: fdm=marker

Reply all
Reply to author
Forward
0 new messages