我知道我们可以使用:set tw = 80来限制文本宽度.但是,如果我们在结束之前插入文本,则此函数根本不起作用.
例如,假设我们输入“您希望通过电子邮件向您发送问题的回复吗?”
如果我们继续在“?”之后输入,则tw工作正常.但是如果我们在说“have”之前插入它,即使它超过指定的文本宽度也不会中断.
有没有办法在后一种情况下使这项工作?
解决方法
这可能是使用
另一种解决方案是在视线选择上使用gq手动格式化,即如果文本宽度> = tw则添加断裂线.
formatoptions
或
formatexpr
配置的,但我不知道如何.
另一种解决方案是在视线选择上使用gq手动格式化,即如果文本宽度> = tw则添加断裂线.
>在另一个文本块中键入您喜欢的任何文本,从而使其宽度为80个字符或更多
>使用V(Shiftv)选择您认为格式错误的文本
> gq
从:h gq
:
Format the lines that {motion} moves over. Formatting is done with one of three methods: 1. If 'formatexpr' is not empty the expression is evaluated. This can differ for each buffer. 2. If 'formatprg' is not empty an external program is used. 3. Otherwise formatting is done internally. In the third case the 'textwidth' option controls the length of each formatted line (see below). If the 'textwidth' option is 0,the formatted line length is the screen width (with a maximum width of 79). The 'formatoptions' option controls the type of formatting fo-table. [..]
有关Vim文本宽度如何工作的更多信息,请查看
How to use Vim’s textwidth like a pro
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。