Set resize "size" #124

Closed
opened 2026-01-05 14:48:27 +01:00 by adam · 1 comment
Owner

Originally created by @ziombo on GitHub (Aug 4, 2022).

Is it possible to set how much the resize-axis command will move the windows? The use case for me is when I have two windows, both taking half the screen, changing their size is a bit cumbersome as I have to trigger the command multiple times (also it's quite janky for me, not sure if that's me or that's how it is). With the size parameter I could at least adjust this to my own needs.

Even better solution would be to to have a "smart" resize, that would adjust this value based on some predefined conditions.

For example, here's a function I use to resize windows in my neovim:

unction! SmartWindowResize(orientation, direction) abort
    if a:orientation == "v"
        let s:size = winwidth(0)
    endif
    if a:orientation == "h"
        let s:size = winheight(0) * 2
    endif

    let s:incr = 5
    if s:size < 70
        let s:incr = 4
    endif
    if s:size < 60
        let s:incr = 3
    endif
    if s:size < 50
        let s:incr = 2
    endif
    if s:size < 40
        let s:incr = 1
    endif

    if a:orientation == "h"
        if a:direction < 1
            execute "resize -" . s:incr
        else
            execute "resize +" . s:incr
        endif
    endif
    if a:orientation == "v"
        if a:direction < 1
            execute "vert resize -" . s:incr
        else
            execute "vert resize +" . s:incr
        endif
    endif
endfunction

Although it's in vimscript(yuck), it boils down to:

  1. check window size on selected axis
  2. the bigger it is, the bigger will the resize be
Originally created by @ziombo on GitHub (Aug 4, 2022). Is it possible to set how much the resize-axis command will move the windows? The use case for me is when I have two windows, both taking half the screen, changing their size is a bit cumbersome as I have to trigger the command multiple times (also it's quite janky for me, not sure if that's me or that's how it is). With the size parameter I could at least adjust this to my own needs. Even better solution would be to to have a "smart" resize, that would adjust this value based on some predefined conditions. For example, here's a function I use to resize windows in my neovim: ``` unction! SmartWindowResize(orientation, direction) abort if a:orientation == "v" let s:size = winwidth(0) endif if a:orientation == "h" let s:size = winheight(0) * 2 endif let s:incr = 5 if s:size < 70 let s:incr = 4 endif if s:size < 60 let s:incr = 3 endif if s:size < 50 let s:incr = 2 endif if s:size < 40 let s:incr = 1 endif if a:orientation == "h" if a:direction < 1 execute "resize -" . s:incr else execute "resize +" . s:incr endif endif if a:orientation == "v" if a:direction < 1 execute "vert resize -" . s:incr else execute "vert resize +" . s:incr endif endif endfunction ``` Although it's in vimscript(yuck), it boils down to: 1. check window size on selected axis 2. the bigger it is, the bigger will the resize be
adam closed this issue 2026-01-05 14:48:27 +01:00
Author
Owner

@LGUG2Z commented on GitHub (Aug 4, 2022):

I believe this function does what you are asking for:

Set the resize delta (used by resize-edge and resize-axis)

USAGE:
    komorebic.exe resize-delta <PIXELS>

ARGS:
    <PIXELS>    The delta of pixels by which to increase or
                decrease window dimensions when resizing

OPTIONS:
    -h, --help    Print help information
@LGUG2Z commented on GitHub (Aug 4, 2022): I believe this function does what you are asking for: ``` Set the resize delta (used by resize-edge and resize-axis) USAGE: komorebic.exe resize-delta <PIXELS> ARGS: <PIXELS> The delta of pixels by which to increase or decrease window dimensions when resizing OPTIONS: -h, --help Print help information ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/komorebi#124