vim格式化命令

发布于 2024-08-13 05:38:19 字数 433 浏览 2 评论 0原文

今天,当光标位于很长的行上时,我无意中输入了一些内容,这通过将其分成几行有限长度的行来格式化我的行。这行看起来像:

Foo("This is very long line (left '%s' right '%s) and it will never never never end", pNode->left.c_str(), pNode->right.c_str());

格式化之前和行后:

Foo("This is very long line (left '%s' right '%s) and it "
    "will never never never end", pNode->left.c_str(), 
    pNode->right.c_str());

我按了什么?

Today unintentionally I typed something when the cursor was on very long line and this formatted my line, by braking it several lines of limited length. This line looks something like:

Foo("This is very long line (left '%s' right '%s) and it will never never never end", pNode->left.c_str(), pNode->right.c_str());

before formatting and after line this:

Foo("This is very long line (left '%s' right '%s) and it "
    "will never never never end", pNode->left.c_str(), 
    pNode->right.c_str());

What I pressed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

在你怀里撒娇 2024-08-20 05:38:19

Vgq(同时设置 tw=60)或

设置换行(也许)?

Vgq (while having set tw=60) or

set wrap (maybe) ?

不语却知心 2024-08-20 05:38:19

致 Idigas: 我不这么认为 - 引号 (") 让我感到困惑。vim 是否知道该行中有一个字符串,因此应该添加额外的引号?

我尝试了一下,我的 vim 没有在格式化行中添加额外的引号。

to Idigas: I don't think so - the quotes (") confuses me. Does vim know that there is a string on the line so it should add extra quotes?

I tryed it and my vim did not put extra quotes to formated lines.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文