I recently discovered that I can use
gq} instead of
!}fmt to break up long paragraphs into lines. This works great.
Unfortunately, I ran into a bit of a problem. GNU fmt uses a default max line width of 75 columns. This works great.
gq} on the other hand uses a line width of something like 79 columns (I think). Since I have
set number enabled in my vim config, and the default terminal size in most GUI environments (MacOS, Linux) is 80x24, a line of 79 characters, plus the gutter bar that shows the line numbers, doesn't actually fit on my screen of 80 characters, and most lines wrap around.
It seems like using
set textwidth=75 is an easy way to replicate the GNU fmt behaviour, and I was happy with that, until I found out that the
textwidth setting affects other things, and not just
gq}. It also forces vim to insert newlines while I type when I hit the textwidth number of characters on my line, which is super annoying.
Is there a way to make
gq}, but not force vim to insert newlines as I type?
Automatically moving to the next line when the user hits
textwidth characters seems like the kind of thing that would be nice for people who mainly write text (paragraphs), but terrible for coding, and most of what I do in vim is code.