In Vim, I don't want to have a text width at all. I would like lines to go on forever. I tried set textwidth=0
but fq
will still wrap the lines up to a certain number. The only way I can do this now is to set textwidth
to a very large (but not too large) number. Is there a way to say that I want an unlimited text width?
Asked
Active
Viewed 399 times
1

Raffi Khatchadourian
- 3,042
- 3
- 31
- 37
-
1Try vi.stackexchange.com. – chepner Jul 21 '21 at 21:39
1 Answers
4
Setting textwidth
to 0 is the right way to not have a limit on the text width. As for gq
, it's documented that it uses the screen width if textwidth
is set to 0.
If you want to just join lines and not wrap them at all, then you can just use J
instead of gq
, which will join the lines into one line, and may provide what you're looking for in terms of formatting.

bk2204
- 64,793
- 6
- 84
- 100
-
1`J` doesn't quite do what I want, i.e., `gq` with `tw=999999` (or some very large number). I can see the difference in the comment lines being joined to normal lines with `J`, which doesn't happen with `gq`. Perhaps the answer then is just to set `tw` to a very large number. – Raffi Khatchadourian Jul 23 '21 at 14:35