寻找这段代码的正确cinoptions
我可以设置哪些 cinoptions 来使下面的块缩进,如图所示?
f(int *p)
: a(p)
, b(0)
{
std::cerr << blah
<< foo << std::endl;
}
我得到的最接近的是:
f(int* p)
: a(p)
, b(0)
{
std::cerr << blah
<< foo << std::endl;
}
这几乎就是我想要的,只是 :
之后的所有内容都缩进:)
为此,我使用了:set cino=i0,+2
What cinoptions can I set for getting the block below indented as shown?
f(int *p)
: a(p)
, b(0)
{
std::cerr << blah
<< foo << std::endl;
}
The closest I've got was to:
f(int* p)
: a(p)
, b(0)
{
std::cerr << blah
<< foo << std::endl;
}
That's almost what I want, only that everything after :
is indented :)
For that, I used: set cino=i0,+2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
i0,+2,t0
怎么样? (tN
表示“函数返回类型声明”)。这对我有用,但是,我尝试过的 vims(7.0 和 7.3)使用
i0,+2
做了两种不同的事情,与你的不同。How about
i0,+2,t0
? (tN
is for "a function return type declaration").That worked for me, but, the vims I tried (7.0 and 7.3) did two different things, neither the same as yours, with
i0,+2
.看起来您只需要一个附加选项。通过将
p0
添加到cinoptions
中,我得到了您期望的结果:这会调整 K&R 样式缩进。 来自文档:
It looks like you only need one additional option. I got the results you expected by adding
p0
to thecinoptions
:This adjusts the K&R style indentation. From the docs: