Is there an option I can set in Vim and Neovim to force the gq motion to wrap text strictly at 80 characters, without addings hanging indents after lines that begin with common programming keywords such as for, while, and if?
For instance, let's say I use the motion gq) on the each of the following sentences in normal mode with textwidth set to 20 (I choose 20 characters here so the original sentences fit in SO's code boxes without overflowing; I normally wrap at 80 characters):
if i am correct, this text should wrap without a hanging indent
while i would like to wrap without a hanging indent, vim has other plans
for now, i have to avoid starting sentences with certain words
After rewrapping at 20 characters:
if i am correct,
this text should
wrap without a
hanging indent
while i would like
to wrap without
a hanging
indent, vim has
other plans
for now, i have to
avoid starting
sentences with
certain words
Based on both the Vim and Neovim documentation for gq, I would expect words like if and while to have no impact on text rewrapping.
Is there an option I can set to disable this behavior? And where is this behavior documented?
Notes for completeness:
- My
formatoptionsoption istcqj. - My
linebreakoption is not set (but this issue occurs when it is set, also). - Both my
formatexprandformatprgoptions are empty. - I am using
NVIM v0.12.0-dev-999+ge6e1e71abf.
autoindentorsmartindent(I don't remember the exact names).:set filetype?say? Yourformatoptionsare probably set for some programming language while you're editing plain text. See:help 'formatoptions'and the linked:help fo-table.:set filetype?saysfiletype=text. This also happens whenfiletype=markdownandfiletype=plaintex. I had checkedfo-table; none of the options appear directly connected to the issue I am facing (i.e., none of them directly mention certain keywords affecting wrapping behavior).