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>
如果我添加换行符(例如,在“to”之后),它就会换行。有趣的是,如果我把线重新连接在一起,它会很高兴地再次包裹它。所以 VIM 似乎在某种程度上记住了“哦,这是一个粘贴,不要包裹它”。
我如何关闭该功能?我希望 gq 在命令模式下always工作。服用l
out of formatoptions
似乎没有帮助(也不应该,这不是插入模式)。
澄清
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.
重现步骤
- 在打开的文件上弹出 gvim。
- 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).
修复这种状态是可行的;在“now”后面添加一个换行符,然后单击“撤消”可以使换行再次起作用。 WTF。