Relationship between wrapmargin and textwidth setting in vimrc and goyo mode formatting/rendering
Nobody has claimed this yet.
- Dominant language
- Vim Script
- Stars
- 4.7k
- Forks
- 118
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
Currently, my vimrc is as follows:
set colorcolumn=80
set number relativenumber
set textwidth=0
set wrapmargin=5
set linebreak
set formatoptions=at
I performed the experiment whose animaged gif is available here: https://imgur.com/quLvk6R
In this experiment, beginning with my terminal maximized to full screen, I wrote out a few long sentences in a paragraph. Due to the settings above, vim automatically wraps at 5 columns to the left of the right edge of the terminal. This is as expected.
Then, I entered Goyo mode. At this stage, with what format options does Goyo format/render the paragraph above? Specifically, does Goyo respect wrapmargin settings or textwidth settings from the user's vimrc? I notice that the default settings are:
g:goyo_width (default: 80)
What is the relationship between the textwidth setting in the user's vimrc and the Goyo default of 80? If I understand correctly, both settings should be the same. With g:goyo_linenr set to 1, however, g:goyo_width should be 2 to 3 column widths more as compared to the user's textwidth setting in vimrc so that toggling to Goyo mode does not render the width of an 80 column wide paragraph in an artificial fashion because the line number takes away 2 or 3 columns. Is my understanding correct?
Continuing with the experiment in the gif, I then selected the long paragraph and formatted it by issuing gq over the visual selection of the paragraph. When I toggle Goyo off, I expected that the original formatting before entering Goyo mode would be returned back and displayed. However, it is not preserved and the original formatting before entering Goyo mode is lost. The Goyo mode's formatting (after having issued gq) is what is preserved. This is not necessarily a problem, but I am trying to wrap my head around the wrapmargin, textwidth, g:goyo_linenr and g:goyo_width settings and how these interact and affect the display as one toggles in and out of Goyo mode.
Thanks for the very useful plugin.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reproducing the reported sequence with the listed vimrc settings, Goyo mode, and visual-selection gq formatting; then inspect how Goyo handles width, line numbers, wrapmargin, and textwidth. Done means documenting whether the observed formatting persistence is expected and identifying the relevant behavior or change needed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- vim
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100