Vim: Move window left/right?

In Vim, is it possible to “move” a window to the left or right? Eg, similar to <cw> r or <cw> x , but left/right instead of up/down?

For example, if I've got this layout:

+---+---+---+
|   |   +---+
| A +---+---+
|   |   |   |
+---+---+---+

I'd like to turn it into this:

+---+---+---+
|   |   +---+
+---+ A +---+
|   |   |   |
+---+---+---+

Which is difficult/annoying to do with <cw> {H,J,K,L} .


Ctrl W gives you the "windows command mode", allowing the following modifiers:

  • Ctrl W + R - To rotate windows up/left.

  • Ctrl W + r - To rotate windows down/right.

  • You can also use the "windows command mode" with navigation keys to change a window's position:

  • Ctrl W + L - Move the current window to the "far right"

  • Ctrl W + H - Move the current window to the "far left"

  • Ctrl W + J - Move the current window to the "very bottom"

  • Ctrl W + K - Move the current window to the "very top"

  • Check out :help window-moving for more information


    This one is the most useful for me (and is probably the right answer to the question):

  • Ctrl W + x OR Ctrl W + Ctrl x - Rotates the current focused window with the closest window to the right.

  • Do you want to move the window itself or just your cursor position?

    Next to rotating or cycling like you already mentioned, it's only possible to move the window itself to the far top, bottom, left or right, with respectively:

    ^W K
    ^W J
    ^W H
    ^W L
    

    I don't think there is a default builtin way to moving a window one place to the right.

    链接地址: http://www.djcxy.com/p/1106.html

    上一篇: 如何跳转到GIT difftool中的next / prev diff?

    下一篇: Vim:左右移动窗口?