1

I have the following options set (in ~/.config/vim/ftplugin/asciidoc.vim):

setlocal wrap
setlocal textwidth=0
setlocal wrapmargin=0
setlocal formatoptions=l

And when I'm writing text, it's not hard-wrapped automatically at all.

However, when I need to reformat an existing paragraph, and press gqap, it's hard-wrapped to fit 79 columns.

From help gq:

Format the lines that {motion} moves over.
Formatting is done with one of three methods:

In the third case the 'textwidth' option controls the
length of each formatted line (see below).
If the 'textwidth' option is 0, the formatted line
length is the screen width (with a maximum width of
79).

Is there a way to work around this 79 columns limitation?

VIM 8.1.

1

It turns out a negative value for wrapmargin helps:

setlocal wrapmargin=-1000

As per :help wrapmargin:

Number of characters from the right window border where wrapping
starts.

So it seems that the :help gq docs are not entirely correct, and with textwidth=0, wrapmargin is also considered when picking a column to wrap at.

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.