简体   繁体   中英

Why don't my cinoptions work?

I am running Vim 7.3 on Debian Wheezy i686 x86.

There is no ~/.vimrc, only /etc/vim/vimrc.

I have set cinoptions=L0:s=sl1b1

I can verify with ':verbose set cinoptions?'

that cinoptions is set to the string above from /etc/vim/vimrc.

My switch/case indent is still something like 8 shiftwidths.

What I am trying to achieve:

switch (foo) {
  case 0:
    bar();
  break;

What I get instead:

switch (foo) {
  case 0:
                  // blargh!

Why doesn't Vim respect my cinoptions?

This is likely because your 'shiftwidth' is set to 8 (or maybe higher). Try the following to see if it addresses the behavior:

set shiftwidth=2 tabstop=2

In case anyone else ever does this: quit all instances of vim before expecting to see your changes reflected. That's the only thing I can think of.

I was editing vimrc with vim, and 10-15 minutes after playing with settings, it 'just worked' automagically after I saved vimrc, quit vim, and started editing my c file (in another terminal).

I must have spent an hour changing cinoptions without any visible results (with vimrc opened).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM