Vim不按空格缩进
我有一个文件设置为缩进四个空格。我有一段代码,看起来像:Vim不按空格缩进,vim,indentation,Vim,Indentation,我有一个文件设置为缩进四个空格。我有一段代码,看起来像: content content end content content new line #(2 spaces, not 4) end 您可以看到上面的所有内容都是4个空格。Vim喜欢做以下事情: content content end content content new line #(2 spaces, not 4) end 我将vimrc文件设置为除了默认设置之外还有
content
content
end
content
content
new line #(2 spaces, not 4)
end
您可以看到上面的所有内容都是4个空格。Vim喜欢做以下事情:
content
content
end
content
content
new line #(2 spaces, not 4)
end
我将vimrc文件设置为除了默认设置之外还有以下几行:
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
发生什么事了?即使我做了
1>>
它也走得太远了,1我认为smartindent
被贬低了。对于C风格的语言,请尝试使用cindent
。您还可以尝试将文件类型缩进添加到vimrc中,并查看效果。这有什么问题吗?文件类型是什么?
?需要检查几件事。。。在vim中,编辑该文件时,:设置
,查看tabstop、shiftwidth和expandtab的设置。(只是为了确保它们正确地从.vimrc加载)。此外,您还可以尝试设置softtabstop=4
。