如何在 Vim 中解开文本? [英] How to unwrap text in Vim?
问题描述
我通常在编辑文件时设置 tw=80
选项,尤其是 LaTeX 源.但是,假设我想在 Vim 中使用 tw=80
选项撰写一封电子邮件,然后将其复制并粘贴到 Web 浏览器.在复制和粘贴之前,我想解开文本,这样每 80 个字符左右就没有换行符.我已经尝试了 tw=0
和 gq
,但这只是将文本换行为 80 个字符的默认宽度.我的问题是:如何解开文本,使我的电子邮件的每一段都显示为一行?有没有简单的命令?
I usually have the tw=80
option set when I edit files, especially LaTeX sources. However, say, I want to compose an email in Vim with the tw=80
option, and then copy and paste it to a web browser. Before I copy and paste, I want to unwrap the text so that there isn't a line break every 80 characters or so. I have tried tw=0
and then gq
, but that just wraps the text to the default width of 80 characters. My question is: How do I unwrap text, so that each paragraph of my email appears as a single line? Is there an easy command for that?
推荐答案
到你段落的开头并输入:
Go to the beginning of you paragraph and enter:
v我pJ
(J
是大写字母以防不清楚)
(The J
is a capital letter in case that's not clear)
对于整个文档,将其与规范结合起来:
For whole document combine it with norm:
:%norm vipJ
这个命令只会解开段落.我想这就是你想要的行为.
This command will only unwrap paragraphs. I guess this is the behaviour you want.
这篇关于如何在 Vim 中解开文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!