How to move a vertical split window to horizontal split if there is a horizontal split?

In Vim, I try to open buffers in new vertical splits (with random horizontal splits). I save my code up to 80 characters, so this works well on large monitors.

I often find myself in this window:

  ---------------------
 |  |  |  |  |
 |  |  |  |  |
 ------ |  A |  B |
 |  |  |  |  |
 |  |  |  |  |
 ---------------------

Four or five columns wide, it may start to get too narrow, so I want to move the windows so that it looks like this:

  ----------------
 |  |  |  A |
 |  |  |  |
 ------ ------
 |  |  |  B |
 |  |  |  |
 ----------------

As far as I know, this cannot be done by moving windows in Vim.

The only way to get the location of the window I found is to close window A and then open A again as a new horizontal split from window B.

Is this correct, or is there a way to move or rearrange windows like this in Vim? Maybe a plugin?

I still need to find something, so I thought I would ask because I find that opening / closing windows causes it to break and interrupt my stream.

FWIW, I find Ctrl-W + J / Ctrl-W + K shortcuts to be useless because they make the new horizontal split as wide as the whole screen, rather than breaking into an adjacent window. That is, Ctrl-W + J would give me this:

  ----------------
 |  |  |  |
 |  |  |  |
 ------ |  A |
 |  |  |  |
 |  |  |  |
 ----------------
 |  |
 |  B |
 ----------------

This is usually not what I want.

If anyone has any ideas let me know!

+4
source share
1 answer

There is a plugin that can do exactly what you want. Here's the link: https://github.com/fabi1cazenave/suckless.vim .

+3
source

Source: https://habr.com/ru/post/1438330/


All Articles