Vim不是用空格缩进

时间:2014-03-14 15:15:53

标签: vim indentation

我有一个设置为缩进四个空格的文件。我有一段看起来像这样的代码:

content
    content
end

你可以看到上面的所有内容都是4个空格.Vim喜欢做类似的事情:

content
    content
      new line #(2 spaces, not 4)
end

除了默认设置外,我还将我的vimrc文件设置为以下行:

set smartindent
set tabstop=4
set shiftwidth=4
set expandtab

发生了什么?即使我1>>它移动太远而且1<<移动到最左边。

2 个答案:

答案 0 :(得分:1)

我认为smartindent已弃用。尝试cindent用于C风格的语言。您也可以尝试filetype indent on

答案 1 :(得分:1)

set cindent添加到您的vimrc并查看效果。

相关问题