I've noticed that gq does not work when I paste in a long line. For example, with a textwidth=72
and formatoptions=tcroqbnl
, gq refuses to wrap this (in insert mode, I pasted the entire label contents, and then exited insert mode with ESC):
<label for="contact_reason_1">To get assistance with or to confirm a tire replacement recommendation</label>
If I add a line break in (after "to", for example), it'll wrap then. The funny thing is if I join the line back together, it'll happily wrap it again. So VIM seems to somehow be remembering "oh, this is one paste, don't wrap it".
How do I turn that feature off? I'd like gq in command mode to always work. Taking l
out of formatoptions
did not seem to help (and it shouldn't, this isn't insert mode).
clarification
Yes, I'm using a motion command, in particular, gq<Right>. formatexpr
and formatprog
are both unset. If it matters, this is in gvim on Debian GNU/Linux, vim version 7.2p284.
steps to reproduce
- Pop up gvim on an open file.
- Press i to get into insert mode, then type
This is a long line. A long line. But not wrappable yet. Or yet. Soon.
- Press ESC, then I. Type
Now putting text in front of the long line.
note: there is a space after the final period, can't get SO to show it, except when this note is here. FUN. - Press ESC, then A. Type
And some after.
note: space before the And, same SO problem. - Press ESC one last time. Now try gq<Left>, note it only wraps
And some after.
; I can't get vim to wrap the rest of the line (without going into insert mode and doing a line break by hand, then it works).
Fixing this state is doable; putting a newline after "now" and then hitting undo makes line wrap work again. WTF.