Skip to content

Conversation

@lanej
Copy link

@lanej lanej commented Nov 13, 2025

Summary

Adds equalise_min_cols and equalise_min_rows config options to use equal-size splits when the terminal has sufficient columns and/or rows. This allows users to prefer equal splits on large terminals while keeping golden ratio autoresize on smaller displays.

Changes

  • Added equalise_min_cols config option (default: 0)
  • Added equalise_min_rows config option (default: 0)
  • Modified autoresize logic to check terminal size against thresholds
  • When thresholds are met: uses wincmd = for equal splits (all windows equal size)
  • When thresholds are not met: uses golden ratio autoresize (focused window larger)

Configuration Examples

Equal splits on wide terminals:

require("focus").setup({
    autoresize = {
        equalise_min_cols = 120, -- Equal splits when terminal >= 120 columns
    },
})

Equal splits on tall terminals:

require("focus").setup({
    autoresize = {
        equalise_min_rows = 40, -- Equal splits when terminal >= 40 rows
    },
})

Equal splits only when BOTH wide AND tall:

require("focus").setup({
    autoresize = {
        equalise_min_cols = 120, -- Equal splits when terminal >= 120 columns
        equalise_min_rows = 40,  -- AND >= 40 rows
    },
})

Behavior Logic

  • If only equalise_min_cols is set: triggers when columns >= threshold
  • If only equalise_min_rows is set: triggers when rows >= threshold
  • If both are set: triggers when BOTH conditions are met (AND logic)
  • Otherwise: uses golden ratio autoresize

Use Case

Users with large terminals often prefer equal-size splits for better code visibility across all windows, but still want focused window autoresizing on smaller displays. These options provide the best of both worlds based on available screen space.

Backward Compatibility

Default values are 0 (disabled), preserving existing golden ratio behavior for all current users.

@lanej lanej force-pushed the feature/width-min-columns branch from 45a10af to 097166e Compare November 13, 2025 22:39
@lanej lanej changed the title feat(autoresize): add width_min_cols config option feat(autoresize): add equalise_min_cols config option Nov 13, 2025
…options

Adds new configuration options to use equal-size splits when the terminal
has sufficient columns and/or rows.

When thresholds are met:
- Uses equal splits for all windows (via wincmd =)
- All windows have equal width and height

When thresholds are not met:
- Uses golden ratio autoresize
- Focused window gets more space

Configuration:
- equalise_min_cols: Use equal splits when columns >= this value (0 = ignore)
- equalise_min_rows: Use equal splits when rows >= this value (0 = ignore)
- If both are set, both conditions must be met (AND logic)
- If only one is set, only that condition needs to be met

Default: 0 (feature disabled, always use golden ratio)

This allows users to prefer equal splits on large terminals while using
focused window resizing on smaller terminals.
@lanej lanej force-pushed the feature/width-min-columns branch from 097166e to df432dd Compare November 13, 2025 22:41
@lanej lanej changed the title feat(autoresize): add equalise_min_cols config option feat(autoresize): add equalise_min_cols and equalise_min_rows config options Nov 13, 2025
@cryptomilk
Copy link
Collaborator

Thank you very much for your contribution. If you want to get this upstream, you also need to add tests :-)

@cryptomilk
Copy link
Collaborator

You can use make format to fix formatting. You could also run make lint and check if selene finds anything.

Thanks! :-)

@lanej
Copy link
Author

lanej commented Nov 16, 2025

😌 got it !

@cryptomilk
Copy link
Collaborator

Thank you very much. This is still on my TODO list, but I just haven't had time for it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants