Cuando lo hago vimdiff file2 file1
, file2
naturalmente va a la izquierda y file1
a la derecha.
A veces encuentro que los puse al revés, así que me gustaría poder cambiarlos sin dejar a Vim. ¿Es eso posible?
Puedes usar Ctrlw- x. De :he CTRL-W_x
:
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.
Como cambiarías cualquier otra ventana, <c-w>x
o <c-w>r
son dos opciones.
Tener solo dos ventanas abiertas las <c-w>k
cambiará y dejará el cursor en la ventana donde estaba antes del interruptor (es decir, si antes del interruptor la ventana enfocada está a la izquierda, después del interruptor estará a la izquierda).
<c-w>x
cambiará las ventanas y moverá el cursor en la ventana cambiada (es decir, la ventana enfocada permanecerá a la izquierda si estaba a la izquierda).
Consulte :help window-moving
para obtener más comandos para mover ventanas en voz alta.
Los siguientes comandos me parecen mucho más intuitivos que Ctrlw- x.
:help CTRL-W_K
The following commands can be used to change the window layout. For example,
when there are two vertically split windows, CTRL-W K will change that in
horizontally split windows. CTRL-W H does it the other way around.
*CTRL-W_K*
CTRL-W K Move the current window to be at the very top, using the full
width of the screen. This works like closing the current
window and then creating another one with ":topleft split",
except that the current window contents is used for the new
window.
*CTRL-W_J*
CTRL-W J Move the current window to be at the very bottom, using the
full width of the screen. This works like closing the current
window and then creating another one with ":botright split",
except that the current window contents is used for the new
window.
*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}
*CTRL-W_L*
CTRL-W L Move the current window to be at the far right, using the full
height of the screen. This works like closing the
current window and then creating another one with
":vert botright split", except that the current window
contents is used for the new window.
{not available when compiled without the |+vertsplit| feature}
Sin embargo, estos comandos pueden cambiar el tamaño de la ventana, así que tenga en cuenta eso.