Alternative Width: Textwidth of centered buffer instead of width of paddings
From a typographical point of view, a line length should no longer be than 75 characters (e.g. R. Bringhurst, The Elements of Typographic Style). Maybe more importantly many coding guidelines suggest a textwidth (typically from 79 to 120).
So IMHO, setting the padding width is not what a user wants but the actual width of the centered window (either following a coding guideline, .editorconfig, modeline, a typographical recommendation, ...).
To achieve a desired buffer window width, the user must know the current total width and calculate the necessary padding to achieve it with :Centerpad <padding width>.
It is easier to give the desired text width (either implicity by the vim setting textwidth, .editorconfig, modeline, ... or explicitly) and the width of the padding is calculated.
I have following suggestions/ideas
- Add a similar option similar to
g:venter_use_textwidthof https://github.com/JMcKiern/vim-venter - Add an explicit function, e.g.
:CenterWindow <text width> - Provide a configuration example for a mapping with a fallback width (if
textwidthis not set)