centerpad.nvim icon indicating copy to clipboard operation
centerpad.nvim copied to clipboard

Alternative Width: Textwidth of centered buffer instead of width of paddings

Open kiryph opened this issue 2 years ago • 0 comments

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_textwidth of 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 textwidth is not set)

kiryph avatar Mar 23 '23 09:03 kiryph