help textwith and
help fo-table, I expected that when I set
set textwidth=20 " for demonstration set formatoptions=tcq
then inserting text would always eventually cause a line to wrap, but that isn't the case. Wrapping only happens at (or before) my cursor. And if I paste, wrapping doesn't happen at all.
Example (Vim 7.4):
12345678901234567890 This is a long line
The line will auto-wrap if I hit
A and start typing.
But if I hit
02wi and type "still ", it doesn't wrap:
12345678901234567890 This is still a long line
I have to type another 7 characters before it will wrap, and then the problem continues on the next line:
12345678901234567890 This is still more <-- it wraps here typing and again a long line
Pasting doesn't trigger a wrap either:
12345678901234567890 This is a long line This text is pasted and not wrapped
I think what I want is
set fo+=a but that applies at the paragraph level, whereas I don't want auto-formatting of one line to spread to other lines.
Or am I missing an option?
To be clear, after launching
vim -u NONE, this is what I type (less comments):
:set textwidth=20<CR> :set formatoptions=tcq<CR> iThis is a long line<ESC> 02wistill <ESC> " no wrap happens, but I'd like it to u :let @r = "This text is pasted and not wrapped"<CR> $"rp " no wrap happens, but I'd like it to