This questions sounds ridicolous, but is there any (mental?!) aid for my struggle when resizing windows?
Since the earliest days of my vi/m usage, I have struggle shrinking windows in the correct direction.
Does any/~greybeard~one have an advice how to solve my misery?
EDIT: I associated the keys <
/>
with "moving a window" - Instead, it is about increasing/decreasing its width. Therefore, the entire following text is useless and I got cured!
Thankfully
Demands:
- built-in solution.
- keyboard only.
- proven.
- bigger window on the left.
Preamble: I find myself working on my integrated screen most of the time; 1377 x 768 px resolution. But I like to open reference splits. These occupy to much screen real-estate.
Problem: After switching focus to, or opening, a new vertical tab I need to resize my panes. Even with my default workflow, where I am opening my first split, I am messing up the direction about half of the times when resizing. This results in resizing the pane in the opposite direction. Then, I double the count, but fail again miserably, because now I am thinking about the direction.
Result:
1.: | | |
2.: | | |
3.: | | |
Execution:
CTRL-W_v
"I'm in the new split to the right
20 CTRL-W_>
"please shrink the window by the amount of 20 colums
Now I want to fix this by doing the opposite, but I find myself again failing about half of the times: I just want to move the right pane 40 to the right ('>')
Why I'm stuck:
- replacing the arrows with the addition/substraction operation does not result in the same behaviour.
- on some days, I am archiving my desired result perfectly.
- help does not suggest any hints about this behavior:
*CTRL-W_<*
CTRL-W < Decrease current window width by N (default 1).
*CTRL-W_>*
CTRL-W > Increase current window width by N (default 1).
:vert[ical] res[ize] [N] *:vertical-resize* *CTRL-W_bar*
CTRL-W | Set current window width to N (default: widest possible).
You can also resize a window by dragging a status line up or down with the
mouse. Or by dragging a vertical separator line left or right. This only
works if the version of Vim that is being used supports the mouse and the
'mouse' option has been set to enable it.
The option 'winheight' ('wh') is used to set the minimal window height of the
current window. This option is used each time another window becomes the
current window. If the option is '0', it is disabled. Set 'winheight' to a
very large value, e.g., '9999', to make the current window always fill all
available space. Set it to a reasonable value, e.g., '10', to make editing in
the current window comfortable.
The equivalent 'winwidth' ('wiw') option is used to set the minimal width of
the current window.
When the option 'equalalways' ('ea') is set, all the windows are automatically
made the same size after splitting or closing a window. If you don't set this
option, splitting a window will reduce the size of the current window and
leave the other windows the same. When closing a window, the extra lines are
given to the window above it.
The 'eadirection' option limits the direction in which the 'equalalways'
option is applied. The default "both" resizes in both directions. When the
value is "ver" only the heights of windows are equalized. Use this when you
have manually resized a vertically split window and want to keep this width.
Likewise, "hor" causes only the widths of windows to be equalized.
The option 'cmdheight' ('ch') is used to set the height of the command-line.
If you are annoyed by the |hit-enter| prompt for long messages, set this
option to 2 or 3.
If there is only one window, resizing that window will also change the command
line height. If there are several windows, resizing the current window will
also change the height of the window below it (and sometimes the window above
it).
The minimal height and width of a window is set with 'winminheight' and
'winminwidth'. These are hard values, a window will never become smaller.
The thing is, I am using the <
/>
always, when writing, correctly (history of learning on a typewriter, probably.).
<C-left>
<C-right>
(default)<M-left>
<M-right>
(terminal-multiplexer) are occupied.I am using the arrow keys to navigate, but
H
J
K
L
(uppercase only) to position windows.Often I am using horizontal splits in the reference window..
I am using a keyboard layout, where
<
and>
are mapped to the same key (<
/<ctrl-<
)
:[vertical] resize
? It accepts relative numbers (so, -10, +10).nnoremap <C-w>< :<C-u>execute "vertical resize -" . v:count<CR> nnoremap <C-w>> :<C-u>execute "vertical resize +" . v:count<CR>
I will wait a few days for an answer, before accepting my own. Gratefully,20 CTRL-W <
exactly the same as:vert resize -20
? I wonder if these mappings aren't just replicating the actual default behavior of these keys... Isn't that the case?