aerial.nvim
aerial.nvim copied to clipboard
With vertical split windows, when aerial window is opened, the invoking buffer gets squished up (becomes small in width than the irrelevant buffer without corresponding symbols))
Description
Let's say we have two files opened in vertical splits. If we open the symbols outline with any suitable :Aerialxxx
command (or keymapping), that window gets squished up (i.e. becomes smaller than the other window which doesn't correspond to the aerial symbols).
The expected behaviour is that the two originally opened windows should retain their width proportions after opening/closing aerial window(s). Examples:
- If the two original windows were at 50% widths before opening 1 aerial window, they should remain equal in width after opening it. They should restore to 50% of screen widths after closing the single aerial window.
- If the two original windows were at 50% widths before opening 2 aerial windows, they should remain equal in width after opening them. They should still be equal size after closing 1 aerial window. Each should restore to 50% of screen width after closing both the aerial windows.
- If one of them was at 40%, and other at 60% width before opening 1 aerial window, they should remain at 2:3 proportion after opening the aerial window, and restore to the original widths after closing the aerial window.
- The logic should scale to any number of regular (or aerial) windows.
Preliminary Ideas
- Extract the currently open vertical window widths into an array. Ignore any horizontal splits in further width calculations.
- Calculate the ratio/proportion of each vertical split
- When an aerial window is opened, resize the remaining available screen area based on the above ratio (use the nearest integer multiple/rounding if necessary for the new widths). Of course, each aerial window will respect the
max_width
,width
, andmin_width
setting tables as usual. - Repeat 3: above when additional aerial windows are used.
System information
- OS: Linux
- Neovim version:
- AerialInfo:
Filetype: lua
Configured backends:
treesitter (supported) (attached)
lsp (not supported) [LSP client not attached]
markdown (not supported) [Filetype is not markdown]
Show symbols: Array, Boolean, Class, Constant, Constructor, Enum, EnumMember, Event, Field, File, Function, Interface, Key, Method, Module, Namespace, Null, Number, Object, Operator, Package, Property, String, Struct, TypeParameter, Variable
- Aerial config: defailt config
Screenshots
Before opening aerial window
After opening aerial window (the buffer from which the :AerialOpen
was triggered gets squished up in width).
I agree that the windows (especially the active window) getting squished is not ideal. I've pushed up a change that should fix that. This won't produce the exact behavior you're asking for when windows have a manually-set width, but it's far simpler and should cover the common cases.
Hmm. If you have carefully constructed your window splits layouts (and saved them to a session using a session management plugin), equalising all the other splits after opening an aerial window might not be desirable at all.
This window equalising strategy will also not play well with plugins that provide a golden-ratio layout for the splits.
All in all, while preventing the squishing up is great, it would be respectful of user's custom layouts if the plugin can adhere to the pre-aerial split proportions if it is technically feasible to do so.