windows_remember_size.vim : Expands the current window when focused to the size you last gave it.
| script karma
Downloaded by 937
Comments, bugs, improvements
script versions (upload new version)
|== New version: tries to automatically keep up without whatever layout changes
you make, by storing an unfocused and focused size for each window. ==
Explanation: Whenever you leave a window, it remembers what size it was, and
whenever you enter a window, it remembers what size it was before entering.
Thus it records "focused" and "unfocused" sizes for each window, and it will
try to grow/shrink windows on entering/leaving, to match the recorded value.
Note: This system is not perfect, specifically when adding a new window
(changing the layout) it makes no attempt to redistribute the space, so
other windows will act greedily until they are adjusted.
Solution: The best approach appears to be, as soon as your layout breaks in
some way, fix it immediately with 20<C-W>+ or whatever, to minimize the
damage (before the new broken values get recorded). This is a small overhead
for the user, in exchange for the benefit gained with a fixed number of windows.
If you want to start afresh you can :call ForgetWindowSizes() and then Ctrl-=.
New feature: Set a default height for newly split windows, as percentage of
the size of the original window. Without it Vim usually splits 50-50.
let g:wrs_default_height_pct = 90
We "detect" when a split is about to occur by mapping <Ctrl-W>s and :h
below. You may want to add more mappings for other splitting actions.
|Drop in plugin/ folder|
Click on the package to download.
ip used for rating: 220.127.116.11