vim-C ++构造函数初始化列表问题的缩进 [英] vim - indentation of C++ constructor initialization list problem

查看:77
本文介绍了vim-C ++构造函数初始化列表问题的缩进的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用vim 7.0.

I'm using vim 7.0.

我希望以下代码以以下方式缩进(初始化列表与构造函数的缩进相同):

I want the following code be indented in the following way (initialization list in the same indentation as constructor):

  A::A() :
  a1(10),
  a2(10),
  a3(10)
  {
  }

根据vim帮助,可以通过设置以下内容来实现:

According to vim help this can be done by setting:

set cino+=i0

但是此设置会产生效果(仅正确缩进a1):

But this setting yields (only a1 is indented correctly):

A::A() :
a1(10),
    a2(10),
    a3(10)
{
}

设置cino + = i1可以使a1..a3正确缩进1个空格.

Setting cino+=i1 indents correctly a1..a3 with 1 space indentation.

推荐答案

根据文档和一个小实验,以下方法可能会有所帮助:

According to documentation and a little experiment, the following could help:

:set cino=i-s

似乎完全按照您的意愿缩进了init列表.

Seems to be indenting init list exactly as you wanted.

这篇关于vim-C ++构造函数初始化列表问题的缩进的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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