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

时间:2019-10-09 16:10:50

标签: vim

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

iN      Indent C++ base class declarations and constructor
        initializations, if they start in a new line (otherwise they
        are aligned at the right side of the ':').
        (default 'shiftwidth').

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

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)
{
}

我认为otherwise they are aligned at the right side of the ':'这句话完全可以满足我的要求。看来我在误解那条线。

有什么方法可以得到所需的压痕?

其他信息

平台:Windows 10
vim版本:8.1

我的设置:

  autoindent          fileformat=dos    nolangremap           scrolloff=5         tabstop=3           ttymouse=xterm
  background=dark     filetype=cpp        laststatus=2      noshelltemp           textmode            visualbell
  cindent             helplang=en         mousemodel=popup    shiftwidth=3        textwidth=100       wildmenu
  clipboard=unnamed   hlsearch            nrformats=bin,hex   showcmd             ttimeout          nowrap
  display=truncate    incsearch           ruler               showmatch           ttimeoutlen=100
  expandtab           langnoremap         scroll=24           syntax=cpp          ttyfast
  backspace=indent,eol,start
  cinkeys=0{,0},:,o,O,0#,!<Tab>
  cinoptions=>1s,e0,n0,f0,{0,}0,^0,:s,=s,ps,ts,c3,i2s,+s,(0,u0,)20,*30,gs,hs,W2s
  comments=sr:/*,mb:*,el:*/,://
  fileencoding=utf-8
  fileencodings=ucs-bom,utf-8,default,latin1
  formatoptions=crql
  keymodel=startsel,stopsel
  omnifunc=ccomplete#Complete
  selection=exclusive
  selectmode=mouse,key
  statusline=%f%h%m%r [%{&ff}] (%{strftime("%H:%M %d/%m/%Y",getftime(expand("%:p")))})%=%l,%c%V %P
  suffixesadd=.h,.cc,.C,.cpp,.xml,.scm
  whichwrap=b,s,<,>,[,]
  wildmode=list:longest,longest:full

0 个答案:

没有答案
相关问题