vim - 为这段代码寻找正确的cinoptions

标签 vim indentation

我可以设置哪些 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

最佳答案

怎么样i0,+2,t0 ? ( tN 用于“函数返回类型声明”)。

这对我有用,但是,我尝试过的 vim(7.0 和 7.3)做了两件不同的事情,和你的都不一样,i0,+2 .

关于vim - 为这段代码寻找正确的cinoptions,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5424205/

相关文章:

python - 在 Cygwin 中从源代码构建 Vim

c++ - 如何配置 Vim 插件 YouCompleteMe 来读取 Makefile?

vim - 在 Vim 中,我可以在不离开当前行的情况下将一行移动到当前行吗?

vim - 从 Vim 中的用户定义命令切换到 **插入** 模式

php - 编辑 NetBeans 源格式标准

ubuntu - ubuntu 上的错误 "Only one file name allowed"Dmenu + Vim

haskell - 使用防护装置正确的缩进规则

javascript - 这是可读的,如果不是我应该改变什么?

python - 由于IndentationError : unexpected indent Python而无法写新行

vim - 在 Vim 中按括号列索引缩进代码?