Vim 缩进基类和成员初始化列表

Vim 缩进基类和成员初始化列表,vim,Vim,缩进基类和成员初始化列表的文档说明(:help cino-i): 我在cinoptions和shiftwidth=3中使用i2s。当我缩进以下内容时 class Foo : public Bar, public Baz { }; 我希望是这样 class Foo : public Bar, public Baz { }; 但我明白了 class Foo : public Bar, public Baz { }; Foo(int x, int y) : x

缩进基类和成员初始化列表的文档说明(
:help cino-i
):

我在
cinoptions
shiftwidth=3
中使用
i2s
。当我缩进以下内容时

class Foo : public Bar,
public Baz
{
};
我希望是这样

class Foo : public Bar,
            public Baz
{
};
但我明白了

class Foo : public Bar,
      public Baz
{
};
Foo(int x, int y) : x_(x),
      y_(y)
{
}
同样,当我缩进

Foo(int x, int y) : x_(x),
y_(y)
{
}
我想去

Foo(int x, int y) : x_(x),
                    y_(y)
{
}
但我明白了

class Foo : public Bar,
      public Baz
{
};
Foo(int x, int y) : x_(x),
      y_(y)
{
}
我想,如果不是在“:”的右侧对齐,那么措辞
将完全符合我的要求。看来我误解了这句话

有没有办法得到想要的缩进

附加信息 平台:Windows 10
vim版本:8.1

我的设置:

autoindent fileformat=dos nolangremap scrolloff=5 tabstop=3 ttymouse=xterm
背景=暗文件类型=cpp laststatus=2 NOSHELLTEM textmode visualbell
cindent helplang=en mousemodel=popup shiftwidth=3 textwidth=100 wildmenu
剪贴板=未命名hlsearch nrformats=bin,十六进制showcmd ttimeout nowrap
显示=截断搜索标尺显示匹配ttimeoutlen=100
expandtab langnoremap scroll=24语法=cpp ttyfast
退格=缩进、下线、开始
cinkeys=0{,0},:,o,o,0#,!
cinoptions=>1s,e0,n0,f0,{0,}0,^0,:s,=s,ps,ts,c3,i2s,+s,(0,u0,)20,*30,gs,hs,W2s
注释=sr://*,mb:*,el:*,://
fileencoding=utf-8
文件编码=ucs bom,utf-8,默认值,拉丁文1
formatoptions=crql
keymodel=开始选择、停止选择
omnifunc=ccomplete#Complete
选择=独占
选择模式=鼠标,按键
状态行=%f%h%m%r[%{&ff}]({strftime(“%h:%m%d/%m/%Y”,getftime(expand(“%:p”)))})=%l,%c%V%p
后缀sadd=.h、.cc、.C、.cpp、.xml、.scm
whichwrap=b,s,,[,]
wildmode=列表:最长,最长:完整

您在
:help[…]
中键入了什么内容以获取引用的段落?“我使用
i2s
”到底是什么意思?@mkrieger1
:help cino-I
啊,我假设你指的是
:help cinoptions values
,并且已经使用了
:set cinoptions=i2s
@mkrieger1,这是正确的。简单地使用
:set cino=i2s
就可以给我你想要的行为。您确定Vim是用
+cindent
选项编译的吗?您可以使用
:echo has('cindent')
进行检查。