左右移动或随机移动vsplit窗口

时间:2013-08-19 20:52:10

标签: linux vim

我正在使用vim编辑器并使用vsplit拆分窗口。我按A B C顺序排列了3个垂直分割窗口。是否可以将窗口改为B A C订单?

3 个答案:

答案 0 :(得分:4)

使用<ctrl-w> + H将当前选定的窗口移动到最左侧(大写字母H)

因此,如果光标在窗格B中,您可以<c-w>H向左移动B而A将在中间位置

请查看:h window-moving以了解移动窗户的其他选项。

5. Moving windows around                                window-moving


CTRL-W x                                        CTRL-W_x CTRL-W_CTRL-X
CTRL-W CTRL-X   Without count: Exchange current window with next one.  If there
                is no next window, exchange with previous window.
                With count: Exchange current window with Nth window (first
                window is 1).  The cursor is put in the other window.
                When vertical and horizontal window splits are mixed, the
                exchange is only done in the row or column of windows that the
                current window is in.

...

                                                CTRL-W_H
CTRL-W H        Move the current window to be at the far left, using the
                full height of the screen.  This works like closing the
                current window and then creating another one with
                ":vert topleft split", except that the current window contents
                is used for the new window.
                {not available when compiled without the +vertsplit feature}

答案 1 :(得分:3)

如果要实现ABC->BAC,光标在B中,请执行@Fdinoff建议,如果光标在A,<c-w> +x与下一个窗口交换当前窗口。

当我并排打开两扇窗户时,我个人经常使用它,并希望交换位置。

<c-w> H对于将H-split两个窗口切换为V-split也很有用。

答案 2 :(得分:0)

有趣的问题。如果我真的想让vim洗窗户,我 会这样做:

au VimEnter * exe (localtime()%winnr('$')+1). "wincmd R|1wincmd w"