在Vim中重新格式化,这是明智之举
发布时间:2020-12-15 21:15:51 所属栏目:安全 来源:网络整理
导读:我不经常重新格式化文本,除了普通的gq之外所以这可能是简单的事情,但似乎没有在帮助中找到它的运气. 无论如何,我的文字看起来像这样 Funnily enough,that was exciting. "I've just about had enough of this," said a voice beside him. He looked up. A gi
我不经常重新格式化文本,除了普通的gq之外所以这可能是简单的事情,但似乎没有在帮助中找到它的运气.
无论如何,我的文字看起来像这样 Funnily enough,that was exciting. "I've just about had enough of this," said a voice beside him. He looked up. A girl had come down the other path. Her face was red with exertion under the pale make-up,her hair hung over her eyes in ridiculous ringlets,and she wore a dress which,while clearly made for her size,was designed for someone who was ten years younger and keen on lace edging. She was quite attractive,although this fact was not immediately apparent. "And you know what they say when you complain?" she demanded. This was not really addressed to Victor. He was just a convenient pair of ears. 在Vim读书真是太痛苦了.所以我尝试用gq重新格式化它,这给了我这个 Funnily enough,that was exciting. "I've just about had enough of this," said a voice beside him. He looked up. A girl had come down the other path. Her face was red with exertion under the pale make-up,her hair hung over her eyes in ridiculous ringlets,while clearly made for her size,was designed for someone who was ten years younger and keen on lace edging. She was quite attractive,although this fact was not immediately apparent. "And you know what they say when you complain?" she demanded. This was not really addressed to Victor. He was just a convenient pair of ears. 这是相当无用的,因为在这种情况下,原始行结尾具有特殊含义.我想要完成的是这个 Funnily enough," said a voice beside him. He looked up. A girl had come down the other path. Her face was red with exertion under the pale make-up,her hair hung over her eyes in ridiculous ringlets,was designed for someone who was ten years younger and keen on lace edging. She was quite attractive,although this fact was not immediately apparent. "And you know what they say when you complain?" she demanded. This was not really addressed to Victor. He was just a convenient pair of ears. 即保持原始行结束,但要将每行比文本宽度“断开”成几行.因此它符合预定义的列宽限制. 任何人对如何做到这一点都有任何想法?这是一个相当大的文档,我需要一些处理它的方法. 解决方法
在视觉上选择所有行然后在ex模式下执行:
:norm gqq gqq重新格式化一行. :带范围的范数在范围内单独应用普通代码.这意味着您可以单独在每一行上应用gqq.并且因为您的textwidth设置为一定长度(例如80),这意味着较短的行不会被连接/包裹. 我已经在您的示例文本上对此进行了测试,它只是给出了您想要的内容. 顺便说一下,你可以使用vim:formatprg用外部prg修改它.这样可以更好地控制您希望使用外部应用程序修改的内容.欲了解更多信息,请阅读:h formatprg (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |