如何禁用开关的情况下vim的缩进? [英] How to disable vim's indentation of switch case?

查看:177
本文介绍了如何禁用开关的情况下vim的缩进?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前,我正在用Vim的战斗,我似乎无法使压痕选择做我想做的。

下面是我的设置,我把他们的.vimrc处的底部,以确保他们采取precedence。正如你所看到的我会有点疯狂,所以我试图关闭几乎所有的东西:

 设置cindent
设置cinkeys = O,O-
设置cinoptions =
设置cinwords =
设置indentexpr =

在大多数情况下,它似乎做工精细,它确实一个凹槽打开一个块之后,一切都很好。但是,是推动我疯了,当有一个 {情况语句,下一行一例是路太远缩进:

 开关(){
    案例CASE:{
                   //< - 下一行缩进被这里的,为什么?
        //< - 应缩进到这里

我怎样才能使它停止这样做呢? TIA


解决方案

 :设置cinoptions = L1

(这是ELL后跟一个数字一个字母)

看:帮助cinoptions值的默认字符串和不同选项的说明。

I'm currently fighting with Vim, I can't seem to make the indentation options do what I want.

Here are my settings, I put them at the bottom of .vimrc to make sure they take precedence. As you can see I'm going a little crazy, so I tried turning off almost everything:

set cindent
set cinkeys=o,O
set cinoptions=
set cinwords=
set indentexpr=

In most cases it seems to work fine, it does one indent after opening a block and everything is fine. But there is one case that is driving me crazy, when there is a { after a case statement, the next line is way too far indented:

switch () {
    case CASE: {
                   // <-- next line gets indented to here, why??
        // <-- should be indented to here

How can I make it stop doing this? TIA

解决方案

:set cinoptions=l1

(that's the letter ell followed by a number one)

Look at :help cinoptions-values for the default string and descriptions of the different options.

这篇关于如何禁用开关的情况下vim的缩进?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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