3

Here is my document; the entire text is on a single line:

enter image description here

However, I would like it to be not so wide; for example by using set textwidth=40 and gq I get my desired results:

enter image description here

The problem with this is that it affects the actual contents of the buffer, whereas I want the changes to be just visual.

I looked at changing columns, but that changes the width of my terminal as well, and this seems like a hack in the first place.

Is there any good way to add a margin to the right side? (The example is slightly exaggerated; in reality I'd want more like 4-5 characters)

Related:

  • 3
    all those distraction free plugins just create empty windows around the main window (which you usually cannot enter) to have it look like a single window. There is no other possibility as far as I know. I believe there is even an entry in the todo list about a wrapmargin setting. But so far this has not been done yet. (I started working on a patch several years ago, but never really got around finishing it up to be ready for inclusion and I believe the neovim devs have a similar PR open) – Christian Brabandt Jun 29 '17 at 11:11
1

If you can't find a decent solution that actually rearranges text perhaps you'll be in the market for a way to make the margin stand out visually. I use the colorcolumn option.

:h 'colorcolumn'

'colorcolumn' is a comma separated list of screen columns that are highlighted with ColorColumn |hl-ColorColumn|. Useful to align text. Will make screen redrawing slower.

The screen column can be an absolute number, or a number preceded with '+' or '-', which is added to or subtracted from 'textwidth'.

I take it to the extreme and color "all" columns right of my textwidth setting with this

let &colorcolumn='+' . join(range(1,256), ',+')

(I've not had any issues with slow screen redraws but this might not work well with slower gfx configurations.)

Here is an example with a subtle color choice. Color can be changed by changing appropriate highlight: :highlight ColorColumn ctermbg=4 ...

enter image description here

0

I would simply just :rightbelow vnew together with :set wrap and adjust the windows at will

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.