Vim:如何将一组线重新格式化为一行(如果该行是单个句子)? [英] Vim: How to reformat a set of lines into a single line (if the line is a single sentence)?

查看:203
本文介绍了Vim:如何将一组线重新格式化为一行(如果该行是单个句子)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不要重复在Vim中,将文件中的所有行连接到一行中最简单的方法是什么?,具体来说,使用<$ c $



我用来在vim中使用80个字符写胶乳 textwidth 。但是,我现在已经切换到无限的 textwidth ,所以我的行永远。



Vim的重新格式化gqap),将几行合并成一个段落,以80个字符包装它们。

 <$> 

c $ c>在HIR中没有\clang {goto}语句,我们必须使用条件
语句来检查迭代数。

应重新格式化为

 在HIR中没有\clang {goto}语句,我们必须改为使用条件语句来检查迭代数。突出显示时,

,并按下 gq

解决方案

如果您不喜欢depesz建议的J,请执行

 :set tw = 9999 

'gq'。根据您的需求调整tw。


Not a dup of In Vim, what is the simplest way to join all lines in a file into a single line?, as I specifically mean to use the gq reformatting functionality.

I used to write latex in vim using 80 character textwidth. However, I've now switched to an infinite textwidth, so my lines go on forever.

Vim's reformatting (gqap for example), combines a few lines into a paragraph, wrapping them at 80 characters. I'd like it to instead combine them into a single line.

ie

Without a \clang{goto} statement in the HIR, we must instead use conditional
statements to check the iteration number.

should reformat into

Without a \clang{goto} statement in the HIR, we must instead use conditional statements to check the iteration number.

when it is highlighted and gq is pressed.

解决方案

If you don't like "J" as depesz suggested then do

:set tw=9999

Then do 'gq'. Adjust tw to your needs.

这篇关于Vim:如何将一组线重新格式化为一行(如果该行是单个句子)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆